diff --git a/src/main.rs b/src/main.rs index f8a638a..692ec29 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,25 +1,33 @@ fn main() { // read env variables that were set in build script let uefi_path = env!("UEFI_PATH"); - // let bios_path = env!("BIOS_PATH"); + //let bios_path = env!("BIOS_PATH"); let mut cmd = std::process::Command::new("qemu-system-x86_64"); cmd.arg("-nographic"); + cmd.arg("-nodefaults"); cmd.arg("-m").arg("4G"); - cmd.arg("-device") - .arg("isa-debug-exit,iobase=0xf4,iosize=0x04"); cmd.arg("--no-reboot"); - cmd.arg("--machine").arg("type=q35,accel=kvm"); + cmd.arg("--machine") + .arg("type=q35,accel=kvm,sata=false,smbus=false"); cmd.arg("-bios").arg(ovmf_prebuilt::ovmf_pure_efi()); - cmd.arg("-drive") - .arg(format!("format=raw,file={uefi_path},if=ide,index=0")); - //.arg(format!("format=raw,file={bios_path}")); - cmd.arg("-drive") - .arg("format=raw,file=ext2.img,if=ide,index=1"); - //cmd.arg("-s"); - //cmd.arg("-S"); cmd.arg("-serial").arg("mon:stdio"); cmd.arg("-serial").arg("file:capture.pcapng"); + cmd.arg("-device").arg("ahci,id=ahci"); + //cmd.arg("-device").arg("VGA"); + cmd.arg("-blockdev").arg(format!( + "driver=raw,node-name=boot,file.driver=file,file.filename={uefi_path}" + )); + //cmd.arg("-blockdev").arg(format!( + // "driver=raw,node-name=boot,file.driver=file,file.filename={bios_path}" + //)); + cmd.arg("-device").arg("ide-hd,drive=boot,bus=ahci.0"); + cmd.arg("-blockdev").arg(format!( + "driver=raw,node-name=fs,file.driver=file,file.filename=ext2.img" + )); + cmd.arg("-device").arg("ide-hd,drive=fs,bus=ahci.1"); + cmd.arg("-device") + .arg("isa-debug-exit,iobase=0xf4,iosize=0x04"); let mut child = cmd.spawn().unwrap(); child.wait().unwrap(); }