Skip to content

Lost-Saint/drakmor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drakmor OS

A minimal operating system kernel written in Rust, designed for the x86-64 architecture.

📖 Description

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

🛠️ Prerequisites

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

Installing Prerequisites

  1. Install Rust:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    source ~/.cargo/env
  2. Install QEMU:

    # On Ubuntu/Debian
    sudo apt install qemu-system-x86
    
    # On macOS
    brew install qemu
    
    # On Arch Linux
    sudo pacman -S qemu
  3. Install bootimage:

    cargo install bootimage
  4. Install required Rust components:

    rustup component add rust-src
    rustup component add llvm-tools-preview

📦 Installation & Setup

  1. Clone the repository:

    git clone <repository-url>
    cd drakmor
  2. Add the custom target:

    rustup target add x86_64-unknown-none

🚀 How to Build and Run

Building the Kernel

# 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

Creating a Bootable Image

# Create a bootable disk image
cargo bootimage --target x86_64-drakmor.json

Running in QEMU

# 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 stdio

Quick Run Command

For 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.bin

🎯 Usage

Once 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+A then X (in the QEMU console)
  • Or close the QEMU window

📁 Project Structure

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

🔧 Configuration Files

  • Cargo.toml: Defines the project metadata, dependencies, and build profiles
  • x86_64-drakmor.json: Custom target specification for bare-metal x86-64
  • .cargo/config.toml: Cargo configuration for build settings (if present)

🤝 Contributing

Contributions are welcome! Here are some ways you can contribute:

  1. Report bugs by creating an issue
  2. Suggest features for the operating system
  3. Submit pull requests with improvements or new features
  4. Improve documentation and code comments

Development Guidelines

  • Follow Rust coding conventions
  • Add comments for complex low-level operations
  • Test changes in QEMU before submitting
  • Update documentation for new features

About

os built in rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages