Skip to content

chore: 更新版本号至 0.8.13,并增强 QEMU UEFI 支持#42

Merged
ZR233 merged 2 commits intomainfrom
dev-fix-x86
Mar 16, 2026
Merged

chore: 更新版本号至 0.8.13,并增强 QEMU UEFI 支持#42
ZR233 merged 2 commits intomainfrom
dev-fix-x86

Conversation

@ZR233
Copy link
Member

@ZR233 ZR233 commented Mar 16, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 16, 2026 06:26
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

This PR bumps ostool from version 0.8.12 to 0.8.13 and enhances QEMU UEFI boot support by switching from the -bios approach to a pflash-based UEFI boot flow with proper ESP directory and NVRAM vars setup.

Changes:

  • Replaces the simple -bios OVMF loading with pflash drives (code + vars) and a FAT ESP directory, enabling a more realistic UEFI boot experience.
  • Refactors architecture detection to be done inline in run() and selects q35 machine type for x86 architectures instead of always using virt.
  • Adds helper methods (prepare_uefi_esp, prepare_uefi_vars, uefi_artifact_dir, default_uefi_boot_filename) to construct the UEFI boot environment.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
ostool/Cargo.toml Version bump to 0.8.13
Cargo.lock Lock file update for version 0.8.13
ostool/src/run/qemu.rs Replaces -bios with pflash-based UEFI boot, adds ESP/vars preparation, refactors arch detection and machine type selection

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

Comment on lines +328 to +337
let code = prebuilt.get_file(arch, FileType::Code);
let vars_template = prebuilt.get_file(arch, FileType::Vars);
let esp_dir = self.prepare_uefi_esp(arch).await?;
let vars = self.prepare_uefi_vars(&vars_template).await?;

Ok(Some(UefiBootConfig::Pflash {
code,
vars,
esp_dir,
}))
Comment on lines +235 to +244
cmd.arg("-drive").arg(format!(
"if=pflash,format=raw,unit=0,readonly=on,file={}",
code.display()
));
cmd.arg("-drive").arg(format!(
"if=pflash,format=raw,unit=1,file={}",
vars.display()
));
cmd.arg("-drive")
.arg(format!("format=raw,file=fat:rw:{}", esp_dir.display()));
Comment on lines +26 to 27
path::Path,
path::PathBuf,
@ZR233 ZR233 merged commit c155ef8 into main Mar 16, 2026
1 check passed
@ZR233 ZR233 deleted the dev-fix-x86 branch March 16, 2026 06:30
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: 426874eb31

ℹ️ 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".

.with_path("failed to create directory", &boot_dir)?;

let boot_path = boot_dir.join(Self::default_uefi_boot_filename(arch));
fs::copy(bin_path, &boot_path).await.with_context(|| {

Choose a reason for hiding this comment

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

P1 Badge Avoid booting raw BIN as an EFI application

With uefi = true, this path copies ctx.paths.artifacts.bin into EFI/BOOT/BOOT*.EFI, but in this codebase objcopy_output_bin() produces a raw -O binary image, not a PE/COFF EFI executable. Because the commit also disables the -kernel loader in UEFI mode, default workflows (to_bin = true) now hand OVMF a non-EFI file and the VM will fail to boot for existing ELF-based kernels.

Useful? React with 👍 / 👎.

}

fn uefi_artifact_dir(&self, bin_path: &Path) -> anyhow::Result<PathBuf> {
let metadata = self.ctx.metadata()?;

Choose a reason for hiding this comment

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

P2 Badge Do not require Cargo metadata in UEFI artifact path

This helper unconditionally calls self.ctx.metadata() before computing the artifact directory, so UEFI runs now fail in system = "Custom" projects that do not have a Cargo.toml in manifest (a supported mode). Previously the UEFI preparation path did not depend on Cargo metadata, so this introduces a regression for non-Cargo custom build workflows.

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