feat(adapter): init+storage packed into kernel image; drop adapter FAT16 reader + virtio-blk
This commit is contained in:
@@ -1,5 +1,26 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let ld = std::path::Path::new("linker.ld").canonicalize().unwrap();
|
||||
println!("cargo:rustc-link-arg=-T{}", ld.display());
|
||||
println!("cargo:rerun-if-changed=linker.ld");
|
||||
|
||||
// Init and storage are packed into the kernel image: they are what
|
||||
// reads the disk, so they cannot come from it. `make build` builds them
|
||||
// first; without them the image boots to "init missing".
|
||||
let manifest = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||
let bins = manifest.join("../../target/riscv64gc-unknown-none-elf/release");
|
||||
let out = PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
||||
for (var, bin) in [("KOS_INIT_ELF", "init"), ("KOS_STORAGE_ELF", "storage-qemu")] {
|
||||
let path = bins.join(bin);
|
||||
println!("cargo:rerun-if-changed={}", path.display());
|
||||
let path = if path.is_file() {
|
||||
path
|
||||
} else {
|
||||
let empty = out.join(bin);
|
||||
std::fs::write(&empty, []).unwrap();
|
||||
empty
|
||||
};
|
||||
println!("cargo:rustc-env={}={}", var, path.display());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user