A repository for a long-term OS project titled DasOS (named after the Greek for "forest")

Adding QEMU run scripts

+30
+2
Cargo.toml
··· 2 2 name = "dasos" 3 3 version = "0.1.0" 4 4 edition = "2024" 5 + default-run = "dasos" 5 6 6 7 [workspace] 7 8 members = ["kernel"] 8 9 9 10 [dependencies] 11 + ovmf-prebuilt = "0.2.4" 10 12 11 13 [build-dependencies] 12 14 kernel = { path = "kernel", artifact = "bin", target = "x86_64-unknown-none" }
+9
src/bin/qemu-bios.rs
··· 1 + use std::{env, process::{self, Command}}; 2 + 3 + fn main() { 4 + let mut qemu = Command::new("qemu-system-x86_64"); 5 + qemu.arg("-drive"); 6 + qemu.arg(format!("format=raw,file={}", env!("BIOS_IMAGE"))); 7 + let exit_status = qemu.status().unwrap(); 8 + process::exit(exit_status.code().unwrap_or(-1)); 9 + }
+19
src/bin/qemu-uefi.rs
··· 1 + use std::{env, process::{self, Command}}; 2 + use ovmf_prebuilt::{Arch, FileType, Prebuilt, Source}; 3 + 4 + fn main() { 5 + let prebuilt = Prebuilt::fetch(Source::LATEST, "target/ovmf").unwrap(); 6 + let ovmf_code = prebuilt.get_file(Arch::X64, FileType::Code); 7 + let ovmf_vars = prebuilt.get_file(Arch::X64, FileType::Vars); 8 + let mut qemu = Command::new("qemu-system-x86_64"); 9 + qemu.args([ 10 + "-drive", 11 + &format!("format=raw,if=pflash,readonly=on,file={}", ovmf_code.display()), 12 + "-drive", 13 + &format!("format=raw,if=pflash,file={}", ovmf_vars.display()), 14 + "-drive", 15 + &format!("format=raw,file={}", env!("UEFI_IMAGE")), 16 + ]); 17 + let exit_status = qemu.status().unwrap(); 18 + process::exit(exit_status.code().unwrap_or(-1)); 19 + }