feat(OS): Create basic kernel that can be run through both QEMU and on hardware (#1)

Reviewed-on: #1
This commit is contained in:
2025-07-20 21:15:05 +02:00
parent 2b6df6578e
commit f0ae99f652
10 changed files with 791 additions and 1 deletions

20
src/main.rs Normal file
View File

@@ -0,0 +1,20 @@
// Helper amin that will allow the kernel of FerrOS to be run through QEMU with just the "cargo run" command
fn main() {
// read env variables that were set in build script
let uefi_path = env!("UEFI_PATH");
let bios_path = env!("BIOS_PATH");
// choose whether to start the UEFI or BIOS image
let uefi = true;
let mut cmd = std::process::Command::new("qemu-system-x86_64");
if uefi {
cmd.arg("-bios").arg(ovmf_prebuilt::ovmf_pure_efi());
cmd.arg("-drive").arg(format!("format=raw,file={uefi_path}"));
} else {
cmd.arg("-drive").arg(format!("format=raw,file={bios_path}"));
}
let mut child = cmd.spawn().unwrap();
child.wait().unwrap();
}