Add qemu serial output to stdio
Signed-off-by: Noah Knegt <git@noahknegt.com>
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -4,17 +4,22 @@ fn main() {
|
|||||||
// read env variables that were set in build script
|
// read env variables that were set in build script
|
||||||
let uefi_path = env!("UEFI_PATH");
|
let uefi_path = env!("UEFI_PATH");
|
||||||
let bios_path = env!("BIOS_PATH");
|
let bios_path = env!("BIOS_PATH");
|
||||||
|
|
||||||
// choose whether to start the UEFI or BIOS image
|
// choose whether to start the UEFI or BIOS image
|
||||||
let uefi = true;
|
let uefi = true;
|
||||||
|
|
||||||
let mut cmd = std::process::Command::new("qemu-system-x86_64");
|
let mut cmd = std::process::Command::new("qemu-system-x86_64");
|
||||||
if uefi {
|
if uefi {
|
||||||
cmd.arg("-bios").arg(ovmf_prebuilt::ovmf_pure_efi());
|
cmd.arg("-bios").arg(ovmf_prebuilt::ovmf_pure_efi());
|
||||||
cmd.arg("-drive").arg(format!("format=raw,file={uefi_path}"));
|
cmd.arg("-drive")
|
||||||
|
.arg(format!("format=raw,file={uefi_path}"));
|
||||||
} else {
|
} else {
|
||||||
cmd.arg("-drive").arg(format!("format=raw,file={bios_path}"));
|
cmd.arg("-drive")
|
||||||
|
.arg(format!("format=raw,file={bios_path}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd.arg("-serial").arg("stdio");
|
||||||
|
|
||||||
let mut child = cmd.spawn().unwrap();
|
let mut child = cmd.spawn().unwrap();
|
||||||
child.wait().unwrap();
|
child.wait().unwrap();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user