@@ -29,7 +29,7 @@ test-kernel = { path = "kernel", artifact = "bin", target = "x86_64-unknown-none
2929
3030[dependencies ]
3131# used for UEFI booting in QEMU
32- ovmf_prebuilt = " 0.1.0-alpha.1"
32+ ovmf-prebuilt = " 0.1.0-alpha.1"
3333
3434[workspace ]
3535members = [" kernel" ]
@@ -38,20 +38,22 @@ members = ["kernel"]
3838``` rust
3939// build.rs
4040
41+ use std :: path :: PathBuf ;
42+
4143fn main () {
4244 // set by cargo, build scripts should use this directory for output files
43- let out_dir = std :: env :: var_os (" OUT_DIR" ). unwrap ();
45+ let out_dir = PathBuf :: from ( std :: env :: var_os (" OUT_DIR" ). unwrap () );
4446 // set by cargo's artifact dependency feature, see
4547 // https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#artifact-dependencies
46- let kernel = std :: env :: var_os (" CARGO_BIN_FILE_KERNEL_kernel" );
48+ let kernel = PathBuf :: from ( std :: env :: var_os (" CARGO_BIN_FILE_KERNEL_kernel" ) . unwrap () );
4749
4850 // create an UEFI disk image (optional)
4951 let uefi_path = out_dir . join (" uefi.img" );
50- bootloader :: UefiBoot :: new (& kernel ). create_disk_image (uefi_path ). unwrap ();
52+ bootloader :: UefiBoot :: new (& kernel ). create_disk_image (& uefi_path ). unwrap ();
5153
52- // create a BIOS disk image (optional)
53- let out_bios_path = out_dir . join (" bios.img" );
54- bootloader :: BiosBoot :: new (& kernel ). create_disk_image (uefi_path ). unwrap ();
54+ // create a BIOS disk image
55+ let bios_path = out_dir . join (" bios.img" );
56+ bootloader :: BiosBoot :: new (& kernel ). create_disk_image (& bios_path ). unwrap ();
5557
5658 // pass the disk image paths as env variables to the `main.rs`
5759 println! (" cargo:rustc-env=UEFI_PATH={}" , uefi_path . display ());
@@ -77,8 +79,8 @@ fn main() {
7779 } else {
7880 cmd . arg (" -drive" ). arg (format! (" format=raw,file={bios_path}" ));
7981 }
80- let mut child = cmd . spawn ()? ;
81- child . wait ()? ;
82+ let mut child = cmd . spawn (). unwrap () ;
83+ child . wait (). unwrap () ;
8284}
8385```
8486
0 commit comments