mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 06:17:49 +00:00
Add a qemu-uefi executable to start the UEFI disk image in QEMU
This commit is contained in:
7
Cargo.lock
generated
7
Cargo.lock
generated
@@ -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"
|
||||
|
||||
@@ -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" }
|
||||
|
||||
13
src/bin/qemu-uefi.rs
Normal file
13
src/bin/qemu-uefi.rs
Normal file
@@ -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));
|
||||
}
|
||||
Reference in New Issue
Block a user