@@ -42,24 +42,18 @@ use std::path::Path;
42
42
43
43
fn main () {
44
44
// set by cargo, build scripts should use this directory for output files
45
- let out_dir = std :: env :: var_os (" OUT_DIR" ). unwrap ();
46
- let out_dir_path = Path :: new (& out_dir );
45
+ let out_dir = Path :: new (& std :: env :: var_os (" OUT_DIR" ). unwrap ());
47
46
// set by cargo's artifact dependency feature, see
48
47
// https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#artifact-dependencies
49
- let kernel = std :: env :: var_os (" CARGO_BIN_FILE_KERNEL_kernel" ). unwrap ();
50
- let kernel_path = Path :: new (& kernel );
48
+ let kernel = Path :: new (& std :: env :: var_os (" CARGO_BIN_FILE_KERNEL_kernel" ). unwrap ());
51
49
52
50
// create an UEFI disk image (optional)
53
- let uefi_path = out_dir_path . join (" uefi.img" );
54
- bootloader :: UefiBoot :: new (& kernel_path )
55
- . create_disk_image (& uefi_path )
56
- . unwrap ();
51
+ let uefi_path = out_dir . join (" uefi.img" );
52
+ bootloader :: UefiBoot :: new (& kernel ). create_disk_image (& uefi_path ). unwrap ();
57
53
58
54
// create a BIOS disk image
59
- let bios_path = out_dir_path . join (" bios.img" );
60
- bootloader :: BiosBoot :: new (& kernel_path )
61
- . create_disk_image (& bios_path )
62
- . unwrap ();
55
+ let bios_path = out_dir . join (" bios.img" );
56
+ bootloader :: BiosBoot :: new (& kernel ). create_disk_image (& bios_path ). unwrap ();
63
57
64
58
// pass the disk image paths as env variables to the `main.rs`
65
59
println! (" cargo:rustc-env=UEFI_PATH={}" , uefi_path . display ());
0 commit comments