mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
22 lines
816 B
Rust
22 lines
816 B
Rust
use bootloader::DiskImageBuilder;
|
|
use std::{env, path::PathBuf};
|
|
|
|
fn main() {
|
|
// set by cargo for the kernel artifact dependency
|
|
let kernel_path = env::var("CARGO_BIN_FILE_KERNEL").unwrap();
|
|
let disk_builder = DiskImageBuilder::new(PathBuf::from(kernel_path));
|
|
|
|
// specify output paths
|
|
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
|
let uefi_path = out_dir.join("blog_os-uefi.img");
|
|
let bios_path = out_dir.join("blog_os-bios.img");
|
|
|
|
// create the disk images
|
|
disk_builder.create_uefi_image(&uefi_path).unwrap();
|
|
disk_builder.create_bios_image(&bios_path).unwrap();
|
|
|
|
// pass the disk image paths via environment variables
|
|
println!("cargo:rustc-env=UEFI_IMAGE={}", uefi_path.display());
|
|
println!("cargo:rustc-env=BIOS_IMAGE={}", bios_path.display());
|
|
}
|