Skip to content

Commit 82007aa

Browse files
Merge pull request #1876 from rust-osdev/fix-ci
ci/fix: upgrade QEMU on windows
2 parents 0a5da58 + df2a493 commit 82007aa

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
runs-on: windows-latest
6666
steps:
6767
- name: Install QEMU
68-
run: choco install qemu --version 2023.4.24
68+
run: choco install qemu --version 2025.12.24
6969
- name: Checkout sources
7070
uses: actions/checkout@v6
7171
- uses: Swatinem/rust-cache@v2

xtask/src/qemu.rs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,20 +312,38 @@ pub fn run_qemu(arch: UefiArch, opt: &QemuOpt) -> Result<()> {
312312
UefiArch::AArch64 => "qemu-system-aarch64",
313313
UefiArch::IA32 | UefiArch::X86_64 => "qemu-system-x86_64",
314314
};
315-
let mut cmd = Command::new(qemu_exe);
316315

317-
if platform::is_windows() {
318-
// The QEMU installer for Windows does not automatically add the
319-
// directory containing the QEMU executables to the PATH. Add
320-
// the default directory to the PATH to make it more likely that
321-
// QEMU will be found on Windows. (The directory is appended, so
322-
// if a different directory on the PATH already has the QEMU
323-
// binary this change won't affect anything.)
316+
// The QEMU installer for Windows does not automatically add the
317+
// directory containing the QEMU executables to the PATH. Add
318+
// the default directory to the PATH to make it more likely that
319+
// QEMU will be found on Windows. (The directory is appended, so
320+
// if a different directory on the PATH already has the QEMU
321+
// binary this change won't affect anything.)
322+
let fn_append_win_path = |cmd: &mut Command| {
324323
let mut path = env::var_os("PATH").unwrap_or_default();
325324
path.push(r";C:\Program Files\qemu");
326325
cmd.env("PATH", path);
326+
};
327+
328+
// Print the QEMU version
329+
{
330+
let mut cmd = Command::new(qemu_exe);
331+
if platform::is_windows() {
332+
fn_append_win_path(&mut cmd)
333+
};
334+
cmd.arg("--version");
335+
let output = cmd.output()?;
336+
eprintln!("QEMU:");
337+
eprintln!(" binary : {qemu_exe}");
338+
eprintln!(" version: {}", String::from_utf8(output.stdout)?);
327339
}
328340

341+
// Construct the actual QEMU argument
342+
let mut cmd = Command::new(qemu_exe);
343+
if platform::is_windows() {
344+
fn_append_win_path(&mut cmd)
345+
};
346+
329347
// Disable default devices.
330348
// QEMU by defaults enables a ton of devices which slow down boot.
331349
cmd.arg("-nodefaults");

0 commit comments

Comments
 (0)