This is a minimal x86_64 kernel written in Rust.
It boots in a virtual machine using the Rust bootloader project and QEMU.
The goal of this project is playing around with low level OS stuff, with as few moving parts as possible, while keeping everything explicit and easy to reason about.
-
kernel
The actual operating system kernel.
Runs without an underlying OS (#![no_std]) and is entered directly by the bootloader. -
builder
A small host-side Rust program that uses thebootloadercrate to create a BIOS-bootable disk image (bios.img) containing the kernel. -
Makefile
Orchestrates the workflow:- build the kernel
- generate the bootable disk image
- launch QEMU
install qemu-system-x86 make
install edk2-ovmf (for UEFI boot)
This project requires Rust nightly and bare-metal support.
Install Rust (if not already installed):
curl https://sh.rustup.rs -sSf | shInstall required components:
rustup toolchain install nightly
rustup component add rust-src llvm-tools-preview --toolchain nightly
rustup target add x86_64-unknown-none --toolchain nightly(Optional but recommended)
Add a rust-toolchain.toml at the workspace root so nightly is selected
automatically.
From the workspace root:
make runThis will:
- Build the kernel for the
x86_64-unknown-nonetarget - Create a bootable BIOS disk image (
bios.img) - Launch QEMU and boot the kernel
You should see graphical output produced directly by the kernel via the framebuffer.
- The kernel runs without the Rust standard library (
no_std). - All output is done by writing directly to memory provided by the bootloader.
- QEMU emulates a PC; no real hardware access is required.
- This project currently targets BIOS boot (not UEFI).