A teaching operating system kernel written in Rust, developed by following the Writing an OS in Rust tutorial. The repository demonstrates how to use a custom target specification, integrate the bootloader crate, and run the built image in QEMU through bootimage.
The repository includes a custom osconfig.json target file and augments .cargo/config.toml to make the compiler use it, while enabling build-std support and configuring the runner:
[build]
target = "osconfig.json"
[unstable]
build-std = ["core", "compiler_builtins"]
build-std-features = ["compiler-builtins-mem"]
[target.'cfg(target_os = "none")']
runner = "bootimage runner"rustup component add rust-src llvm-tools-preview --toolchain nightly-x86_64-pc-windows-msvc
rustup override set nightlyInstall the required tooling and declare the dependency:
cargo install bootimage
rustup component add llvm-tools-preview[dependencies]
bootloader = "0.9"Compile with the nightly toolchain using the custom target:
cargo +nightly build --target osconfig.jsonThe compiled binary is placed at target/osconfig/debug/hello.
Create a bootable disk image:
cargo bootimageWith QEMU installed, start the kernel with the default runner:
cargo runcargo run invokes the bootimage runner, which launches QEMU with the generated image.
- Writing an OS in Rust — https://os.phil-opp.com/