Skip to content

Building from Source

MerlionOS uses Rust nightly with a custom target. The rust-toolchain.toml in the repo manages the toolchain version automatically.

Terminal window
# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Required components
rustup component add rust-src --toolchain nightly
rustup component add llvm-tools --toolchain nightly
# Bootimage tool
cargo install bootimage
Terminal window
brew install qemu
Terminal window
sudo apt install qemu-system-x86
Terminal window
sudo pacman -S qemu-full
Terminal window
git clone https://github.com/MerlionOS/merlion-kernel.git
cd merlion-kernel
# Build the bootable image
make build
# The output is at target/x86_64-merlion/debug/bootimage-merlion-kernel.bin
src/
├── main.rs # Kernel entry point
├── acpi.rs # ACPI shutdown and reboot
├── allocator.rs # Kernel heap
├── driver.rs # Kernel driver framework
├── gdt.rs # GDT + TSS
├── interrupts.rs # IDT, exceptions, IRQs, syscall
├── ipc.rs # IPC channels
├── keyboard.rs # PS/2 scancode decoder
├── log.rs # Kernel log ring buffer
├── memory.rs # Page tables, frame allocator
├── process.rs # User processes + page tables
├── serial.rs # UART serial driver
├── shell.rs # Interactive kernel shell
├── syscall.rs # Syscall dispatch
├── task.rs # Task management + context switching
├── timer.rs # PIT tick counter
├── vfs.rs # Virtual filesystem
└── vga.rs # VGA console with ANSI color