A custom operating system kernel written in Rust for the x86_64 architecture. This project is designed to explore low-level programming concepts and OS development.
Untitled.design.1.mp4
- Custom bootloader integration using the
bootloadercrate - VGA text buffer for screen output
- Hardware interrupt handling (keyboard, timer)
- Memory management with paging and heap allocation
- Async/await support for cooperative multitasking
- Serial port communication for debugging
- Integration tests with QEMU
- Built-in Text Editor with flicker-free rendering and custom dashboard UI
The OS now boots directly into a memory-resident text editor featuring:
- Dashboard UI: Custom ASCII art header with system status information.
- Interactive Editing: Supports typing, backspace, newlines, and arrow key navigation.
- Flicker-Free Rendering: Optimized VGA driver uses an overwrite strategy to prevent screen flashing.
- System Control: Press
ESCto instantly shutdown the QEMU machine.
src/main.rs- Kernel entry point and initializationsrc/lib.rs- Shared library code and test frameworksrc/vga_buffer.rs- VGA text mode driver for screen outputsrc/interrupts.rs- Interrupt descriptor table (IDT) and interrupt handlerssrc/gdt.rs- Global descriptor table setupsrc/memory.rs- Memory management and pagingsrc/allocator.rs- Heap allocator implementationsrc/allocator.rs- Heap allocator implementationsrc/editor/mod.rs- Text editor logic and UI renderingsrc/serial.rs- Serial port driver for debugging output
src/allocator/- Different heap allocator implementations (bump, linked list, fixed-size block)src/task/- Async task executor and keyboard tasktests/- Integration tests
Cargo.toml- Project dependencies and metadata.cargo/config.toml- Build configuration for custom targetx86_64-os.json- Custom target specification for bare-metal x86_64
- Rust nightly toolchain
- rust-src component
- QEMU for running the OS
- bootimage tool
-
Install Rust nightly:
rustup override set nightly -
Install required components:
rustup component add rust-src
-
Install bootimage:
cargo install bootimage
-
Install QEMU (macOS):
brew install qemu
Or on Linux:
# Ubuntu/Debian sudo apt install qemu-system-x86 # Fedora sudo dnf install qemu-system-x86
cargo buildcargo runThis will compile the kernel and automatically launch it in QEMU.
cargo test#![no_std]- Disables the standard library for bare-metal programming#![no_main]- Uses a custom entry point instead of the standardmainfunction- Custom allocator - Implements heap allocation in a freestanding environment
- Async executor - Cooperative multitasking without OS thread support
- Hardware interrupts - Direct handling of keyboard input and timer interrupts
Make sure you're using rustup's nightly Rust, not Homebrew's Rust:
# Check your Rust version
cargo --version
# If using Homebrew's Rust, uninstall it
brew uninstall rust
# Ensure rustup's cargo is in your PATH
export PATH="$HOME/.cargo/bin:$PATH"Ensure rust-src is installed:
rustup component add rust-src