diff --git a/Cargo.lock b/Cargo.lock index 6aa2ebcb..0e3705c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,6 +132,7 @@ version = "0.1.0" dependencies = [ "bootloader", "kernel", + "ovmf-prebuilt", ] [[package]] @@ -495,6 +496,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "ovmf-prebuilt" +version = "0.1.0-alpha.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa50141d081512ab30fd9e7e7692476866df5098b028536ad6680212e717fa8d" + [[package]] name = "parking" version = "2.1.0" diff --git a/Cargo.toml b/Cargo.toml index 0c3e136a..a69e6de4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ default-run = "blog_os" members = ["kernel"] [dependencies] +ovmf-prebuilt = "0.1.0-alpha" [build-dependencies] kernel = { path = "kernel", artifact = "bin", target = "x86_64-unknown-none" } diff --git a/src/bin/qemu-uefi.rs b/src/bin/qemu-uefi.rs new file mode 100644 index 00000000..8ed6c7ad --- /dev/null +++ b/src/bin/qemu-uefi.rs @@ -0,0 +1,13 @@ +use std::{ + env, + process::{self, Command}, +}; + +fn main() { + let mut qemu = Command::new("qemu-system-x86_64"); + qemu.arg("-drive"); + qemu.arg(format!("format=raw,file={}", env!("UEFI_IMAGE"))); + qemu.arg("-bios").arg(ovmf_prebuilt::ovmf_pure_efi()); + let exit_status = qemu.status().unwrap(); + process::exit(exit_status.code().unwrap_or(-1)); +}