Skip to content

fix(starry): route app qemu through dynamic boot#1267

Merged
ZR233 merged 1 commit into
rcore-os:devfrom
Antareske:fix/x86-qemu-build
Jun 15, 2026
Merged

fix(starry): route app qemu through dynamic boot#1267
ZR233 merged 1 commit into
rcore-os:devfrom
Antareske:fix/x86-qemu-build

Conversation

@Antareske

Copy link
Copy Markdown
Contributor

背景

Starry app 的 qemu 路径在 x86_64 上会直接把 dynamic 平台内核以 -kernel <ELF> 方式交给 QEMU。当前生成的 ELF 不包含 PVH ELF Note,因此会在启动阶段失败:

qemu-system-x86_64: Error loading uncompressed kernel without PVH ELF Note

在 starry apps 测试中发现 #1038。该问题不属于 nginx 测试业务本身,而是 scripts/axbuild 的 app-qemu 派发路径没有复用 dynamic platform boot 逻辑。

修改内容

  1. scripts/axbuild/src/context/mod.rs 中,将 Context::qemu() 的 x86 KVM 预处理替换为 apply_dynamic_platform_qemu_boot()
  2. 删除 scripts/axbuild/src/test/qemu.rs 中已无调用方的 apply_x86_64_kvm_accel_if_available() 包装函数。

原因

apply_dynamic_platform_qemu_boot() 已经封装了 dynamic 平台所需的 QEMU 修正:

  • x86_64 的 uefi=true
  • to_bin=true
  • 额外的 x86_64 QEMU 参数调整

这和 arceos / starry test 等既有路径保持一致。把它补到 Context::qemu() 后,starry app qemu 会自动走已验证的 UEFI/BIN 启动路径,而不是继续触发裸 ELF + PVH 失败。

验证

  • cargo fmt --all
  • cargo xtask clippy --package axbuild
  • cargo xtask starry app qemu -t redis --arch x86_64

验证结果显示 x86_64 app-qemu 已切换为 OVMF + pflash + starryos.esp,不再使用裸 -kernel 直启。

影响范围

  • 仅影响 starry app qemu 这条原先漏掉的 dynamic boot 路径。
  • 不影响已在上层显式调用 apply_dynamic_platform_qemu_boot() 的 ArceOS / Starry test 路径。
  • 非 dynamic target 保持原有行为不变。

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查总结

PR 变更内容:将 Context::qemu() 中的 apply_x86_64_kvm_accel_if_available() 调用替换为 apply_dynamic_platform_qemu_boot(),并删除已无调用方的包装函数。

实现逻辑:旧函数仅在 x86_64 上添加 -accel kvm,不包含 UEFI 引导、BIN 转换等 dynamic 平台 QEMU 启动所需的修正。apply_dynamic_platform_qemu_boot() 已在 arceos、starry test、axvisor 等所有其他 QEMU 启动路径中使用,本 PR 将遗漏的 Context::qemu() app-qemu 路径对齐到已有统一逻辑,修复了裸 ELF + PVH 失败问题。

本地验证

  • cargo fmt --check:通过
  • cargo clippy --manifest-path scripts/axbuild/Cargo.toml --all-features -- -D warnings:通过,无警告

CI 状态

  • Detect changed paths / Cancel stale CI runs:success
  • Check formatting (run_host/run_container)Run sync-lint (run_host/run_container):正在运行或已完成(PR 仅改 scripts/axbuild/ 脚本代码)
  • 各 test 矩阵 (starry/arceos/axvisor qemu, self-hosted board 等):skipped — 这是预期的 CI 路径过滤行为,因为 scripts/axbuild/ 变更不触发 QEMU 测试工作流
  • 无 PR 相关的 CI 失败

重复/重叠分析

  • 无其他 open PR 涉及 Context::qemu() 路径或 apply_x86_64_kvm_accel_if_availableapply_dynamic_platform_qemu_boot 迁移
  • PR #1038(nginx 测试)是发现此 bug 的来源,非重复 PR
  • PR #1266(Wi-Fi 模式切换)、PR #1265(USB 修复)与此 PR 作用域完全不重叠

审查历史:无先前审查评论或未解决的 review thread。

修复覆盖:本 PR 修复 QEMU 启动配置路径而非运行时行为,不适合单元测试。被调用的 apply_dynamic_platform_qemu_boot() 已有大量 _with_probe 测试覆盖。PR 作者验证了 cargo xtask starry app qemu -t redis --arch x86_64 已切换为 OVMF + pflash 启动路径。

结论:变更正确、最小化且与项目现有模式一致,无阻塞问题。

Powered by mimo-v2.5-pro

@mai-team-app
mai-team-app Bot requested a review from ZCShou June 15, 2026 13:58
@ZR233
ZR233 merged commit 0854958 into rcore-os:dev Jun 15, 2026
50 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 15, 2026
fzg-23 pushed a commit to fzg-23/tgoskits that referenced this pull request Jun 16, 2026
This was referenced Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants