A bare-metal Rust kernel for x86_64 - no standard library, no operating system underneath. Built from scratch using Rust nightly with a custom target, hand-wired drivers, and a fully custom UEFI bootloader.
This project is currently a kernel, not a full desktop/server operating system. It boots, initializes core hardware and memory services, and runs a small cooperative task scheduler inside the kernel itself.
- Boots into a
#![no_std],#![no_main]kernel via a custom UEFI bootloader. - Initializes core x86_64 architecture features: GDT, TSS, IDT, and PIC.
- Sets up virtual memory paging and a 256 KiB kernel heap.
- Uses a cooperative round-robin scheduler for kernel tasks.
- Handles hardware interrupts for timer and keyboard (PS/2 scancode set 1).
- Provides a tiny interactive shell with basic commands (
help,uname,uptime,ps, etc.). - Outputs to both the UEFI GOP framebuffer and a UART serial port simultaneously.
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
rustup target add x86_64-unknown-uefiYou also need QEMU with OVMF firmware installed:
- macOS:
brew install qemu - Linux:
sudo apt install qemu-system-x86 ovmf
The simplest way to build the kernel, bootloader, and run the OS in QEMU is to use the provided run.sh script:
./run.shThis script will automatically:
- Build the kernel and custom UEFI bootloader
- Create a virtual FAT directory under
build/mnt - Copy the compiled files into the virtual EFI system partition
- Start the OS in QEMU with an interactive COM1 terminal
- Mirror COM1 output into
serial.log
After the open_kernel> prompt appears, type commands either in the terminal that
launched run.sh or by clicking the QEMU window and using its PS/2 keyboard.
Roadmap of things that would turn this kernel into a more complete operating system:
- Preemptive multitasking and real context switching with per-task CPU state.
- Separate stacks for each task.
- User mode support and privilege switching.
- System calls so user programs can request kernel services.
- Process creation, termination, and waiting.
- Per-process virtual memory spaces and memory isolation.
- ELF loading for executable binaries.
- A file system layer.
- Better keyboard input handling, including modifiers and special keys.
- Basic driver model for storage and graphics.
- Network stack support.
- Multicore bring-up and scheduler scaling.
