From ba8b0392b824c136c05ae663585dc73cb2b4b489 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Mon, 1 May 2023 14:20:01 +0200 Subject: [PATCH] Add a `qemu-bios` executable to start the BIOS disk image in QEMU --- Cargo.toml | 1 + src/bin/qemu-bios.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/bin/qemu-bios.rs diff --git a/Cargo.toml b/Cargo.toml index a566af24..0c3e136a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "blog_os" version = "0.1.0" edition = "2021" +default-run = "blog_os" [workspace] members = ["kernel"] diff --git a/src/bin/qemu-bios.rs b/src/bin/qemu-bios.rs new file mode 100644 index 00000000..663bd512 --- /dev/null +++ b/src/bin/qemu-bios.rs @@ -0,0 +1,12 @@ +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!("BIOS_IMAGE"))); + let exit_status = qemu.status().unwrap(); + process::exit(exit_status.code().unwrap_or(-1)); +}