Building from Source
Toolchain Setup
Section titled “Toolchain Setup”MerlionOS uses Rust nightly with a custom target. The rust-toolchain.toml in the repo manages the toolchain version automatically.
# Install Rust (if not already installed)curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Required componentsrustup component add rust-src --toolchain nightlyrustup component add llvm-tools --toolchain nightly
# Bootimage toolcargo install bootimagebrew install qemuUbuntu/Debian
Section titled “Ubuntu/Debian”sudo apt install qemu-system-x86Arch Linux
Section titled “Arch Linux”sudo pacman -S qemu-fullBuilding
Section titled “Building”git clone https://github.com/MerlionOS/merlion-kernel.gitcd merlion-kernel
# Build the bootable imagemake build
# The output is at target/x86_64-merlion/debug/bootimage-merlion-kernel.binProject Structure
Section titled “Project Structure”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