Files
XunilOS/kernel/build.rs
T
csd4ni3l 1205d8ce7a Add virtio driver for aarch64 with only input for now, move keyboard,
mouse and other io logic to an io folder, make ps2 convert to linux
event codes like virtio, force modern mmio and gic version 2 on aarch64
2026-05-17 20:32:42 +02:00

27 lines
915 B
Rust

use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let timer_frequency_hz = env::var("TIMER_FREQUENCY_HZ").unwrap_or_else(|_| "1000".to_string());
let karch = env::var("KARCH").unwrap_or_else(|_| "x86_64".to_string());
let out_dir = PathBuf::from("src");
fs::write(
out_dir.join("config.rs"),
format!("pub const TIMER_FREQUENCY_HZ: usize = {timer_frequency_hz};\npub const KARCH: &str = \"{karch}\";"),
)
.unwrap();
println!("cargo:rerun-if-env-changed=KARCH");
println!("cargo:rerun-if-env-changed=TIMER_FREQUENCY_HZ");
println!("cargo:rerun-if-env-changed=OUTPUT");
// Tell cargo to pass the linker script to the linker..
println!("cargo:rustc-link-arg=-Tlinker-{arch}.ld");
// ..and to re-run if it changes.
println!("cargo:rerun-if-changed=linker-{arch}.ld");
}