A minimal operating system kernel written in Rust, designed for the x86-64 architecture.
Drakmor OS is a bare-metal operating system kernel project that demonstrates low-level system programming concepts using Rust. This project showcases:
- Bare-metal programming without the Rust standard library (
#![no_std]) - Custom bootloader integration using the bootloader crate
- Direct hardware interaction through VGA buffer manipulation
- Memory safety in kernel-level code using Rust's ownership system
- Custom target specification for x86-64 bare-metal environment
The kernel currently implements basic VGA text mode output, serving as a foundation for building more advanced operating system features. This project is perfect for learning about:
- Operating system fundamentals
- Rust systems programming
- x86-64 architecture
- Bootloader protocols
- Memory management concepts
Before you can build and run Drakmor OS, ensure you have the following installed:
- Rust (latest nightly version)
- Cargo (comes with Rust)
- QEMU (for emulation)
- bootimage crate for creating bootable disk images
-
Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.cargo/env
-
Install QEMU:
# On Ubuntu/Debian sudo apt install qemu-system-x86 # On macOS brew install qemu # On Arch Linux sudo pacman -S qemu
-
Install bootimage:
cargo install bootimage
-
Install required Rust components:
rustup component add rust-src rustup component add llvm-tools-preview
-
Clone the repository:
git clone <repository-url> cd drakmor
-
Add the custom target:
rustup target add x86_64-unknown-none
# Build the kernel
cargo build --target x86_64-drakmor.json
# Build in release mode for better performance
cargo build --target x86_64-drakmor.json --release# Create a bootable disk image
cargo bootimage --target x86_64-drakmor.json# Run the OS in QEMU
qemu-system-x86_64 -drive format=raw,file=target/x86_64-drakmor/debug/bootimage-drakmor.bin
# Or with more verbose output
qemu-system-x86_64 -drive format=raw,file=target/x86_64-drakmor/debug/bootimage-drakmor.bin -serial stdioFor convenience, you can combine building and running:
cargo bootimage --target x86_64-drakmor.json && qemu-system-x86_64 -drive format=raw,file=target/x86_64-drakmor/debug/bootimage-drakmor.binOnce you run the OS in QEMU, you should see:
- A black screen with "Hello World!" displayed in light cyan text
- The system will be in an infinite loop (as expected for a minimal kernel)
To exit QEMU:
- Press
Ctrl+AthenX(in the QEMU console) - Or close the QEMU window
drakmor/
├── src/
│ └── main.rs # Main kernel entry point
├── .cargo/ # Cargo configuration
├── target/ # Build artifacts
├── Cargo.toml # Project configuration
├── x86_64-drakmor.json # Custom target specification
├── .gitignore # Git ignore rules
└── README.md # This file
Cargo.toml: Defines the project metadata, dependencies, and build profilesx86_64-drakmor.json: Custom target specification for bare-metal x86-64.cargo/config.toml: Cargo configuration for build settings (if present)
Contributions are welcome! Here are some ways you can contribute:
- Report bugs by creating an issue
- Suggest features for the operating system
- Submit pull requests with improvements or new features
- Improve documentation and code comments
- Follow Rust coding conventions
- Add comments for complex low-level operations
- Test changes in QEMU before submitting
- Update documentation for new features