@@ -29,7 +29,7 @@ test-kernel = { path = "kernel", artifact = "bin", target = "x86_64-unknown-none
29
29
30
30
[dependencies ]
31
31
# used for UEFI booting in QEMU
32
- ovmf_prebuilt = " 0.1.0-alpha.1"
32
+ ovmf-prebuilt = " 0.1.0-alpha.1"
33
33
34
34
[workspace ]
35
35
members = [" kernel" ]
@@ -38,20 +38,22 @@ members = ["kernel"]
38
38
``` rust
39
39
// build.rs
40
40
41
+ use std :: path :: PathBuf ;
42
+
41
43
fn main () {
42
44
// 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 () );
44
46
// set by cargo's artifact dependency feature, see
45
47
// 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 () );
47
49
48
50
// create an UEFI disk image (optional)
49
51
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 ();
51
53
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 ();
55
57
56
58
// pass the disk image paths as env variables to the `main.rs`
57
59
println! (" cargo:rustc-env=UEFI_PATH={}" , uefi_path . display ());
@@ -77,8 +79,8 @@ fn main() {
77
79
} else {
78
80
cmd . arg (" -drive" ). arg (format! (" format=raw,file={bios_path}" ));
79
81
}
80
- let mut child = cmd . spawn ()? ;
81
- child . wait ()? ;
82
+ let mut child = cmd . spawn (). unwrap () ;
83
+ child . wait (). unwrap () ;
82
84
}
83
85
```
84
86
0 commit comments