Skip to content

feat: 实现 QEMU 配置文件查找功能,支持架构优先级#49

Merged
ZR233 merged 1 commit intomainfrom
dev-qemu
Mar 18, 2026
Merged

feat: 实现 QEMU 配置文件查找功能,支持架构优先级#49
ZR233 merged 1 commit intomainfrom
dev-qemu

Conversation

@ZR233
Copy link
Member

@ZR233 ZR233 commented Mar 18, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 18, 2026 03:09
@ZR233 ZR233 merged commit 40c733c into main Mar 18, 2026
4 checks passed
@ZR233 ZR233 deleted the dev-qemu branch March 18, 2026 03:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds architecture-aware discovery of the QEMU configuration file so run_qemu can prefer per-arch config filenames when available.

Changes:

  • Switch default config-path selection to a helper (find_qemu_config) when --qemu-config is not provided.
  • Add find_qemu_config that searches for qemu-<arch>.toml / .qemu-<arch>.toml before falling back to generic qemu.toml / .qemu.toml.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +513 to +520
/// Find QEMU configuration file with architecture-specific priority.
///
/// Search order:
/// 1. qemu-<arch>.toml
/// 2. .qemu-<arch>.toml
/// 3. qemu.toml
/// 4. .qemu.toml
fn find_qemu_config(ctx: &AppContext) -> anyhow::Result<PathBuf> {
Comment on lines +528 to +535
let candidates = [
manifest_dir.join(format!("qemu-{}.toml", arch)),
manifest_dir.join(format!(".qemu-{}.toml", arch)),
];
for path in &candidates {
if path.exists() {
return Ok(path.clone());
}
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5e9476a41

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +541 to +542
manifest_dir.join("qemu.toml"),
manifest_dir.join(".qemu.toml"),

Choose a reason for hiding this comment

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

P2 Badge Preserve .qemu.toml precedence over qemu.toml

This reverses the existing default config path: run_qemu used to read and auto-generate .qemu.toml, QemuArgs still documents .qemu.toml as the default (ostool/src/main.rs:55-57), and handle_qemu_config still edits that file (ostool/src/menuconfig.rs:71-90). If a project contains both files after this change, ostool run qemu will silently ignore the documented/default config and use qemu.toml instead, so menuconfig edits and previously working .qemu.toml settings stop taking effect.

Useful? React with 👍 / 👎.

Comment on lines +529 to +530
manifest_dir.join(format!("qemu-{}.toml", arch)),
manifest_dir.join(format!(".qemu-{}.toml", arch)),

Choose a reason for hiding this comment

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

P2 Badge Keep menuconfig aligned with the new arch-specific lookup

The new arch-priority search means run_qemu now prefers qemu-<arch>.toml or .qemu-<arch>.toml, but MenuConfigHandler::handle_qemu_config still only loads and saves .qemu.toml (ostool/src/menuconfig.rs:71-90). In any multi-arch project that adds one of these per-arch files, interactive QEMU config changes no longer affect the file that is actually used for that architecture, which is a user-visible regression introduced by this lookup order.

Useful? React with 👍 / 👎.

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