Skip to content

โšก Educational x86โš™๏ธ operating system๐Ÿ–ฅ๏ธ | Multiboot kernel, VGA framebuffer, PS/2 keyboard driver | Freestanding C implementation ๐Ÿ› ๏ธ

Notifications You must be signed in to change notification settings

rff-glitch/raef-os

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Raef OS

License Architecture Language

A minimal 32-bit x86 operating system built from scratch for educational purposes

Raef OS is a freestanding operating system kernel developed to explore low-level systems programming, OS internals, and x86 architecture. Built without external libraries, it demonstrates fundamental OS concepts including bootloading, memory-mapped I/O, and hardware interaction.


โœจ Features

Current Implementation

  • ๐Ÿ”ง Bootloader Integration

    • GRUB Multiboot-compliant bootloader
    • Custom assembly loader (loader.s)
    • ISO generation for deployment
  • ๐Ÿ’ป Kernel Capabilities

    • 32-bit x86 freestanding C kernel
    • No standard library dependencies
    • Direct hardware access via I/O ports
  • ๐Ÿ–ฅ๏ธ Display System

    • VGA text-mode framebuffer driver (80x25)
    • Screen clearing and cursor management
    • Automatic scrolling
    • Backspace functionality
  • โŒจ๏ธ Input Handling

    • PS/2 keyboard driver (polling mode)
    • Real-time character input
    • Command-line interface
  • ๐Ÿš Simple Shell

    • Interactive prompt (>)
    • Built-in commands:
      • help - Display available commands
      • clear - Clear the terminal
      • flex - ASCII art display
      • uptime - Show system uptime since boot
      • echo - Echo text back to terminal
      • reboot - Restart the operating system

๐Ÿ“ Project Structure

raef-os/
โ”œโ”€โ”€ drivers/              # Hardware drivers
โ”‚   โ”œโ”€โ”€ framebuffer.c     # VGA text-mode driver
โ”‚   โ””โ”€โ”€ framebuffer.h     # Framebuffer interface
โ”œโ”€โ”€ kernel/               # Kernel source
โ”‚   โ””โ”€โ”€ kmain.c           # Main kernel entry point
โ”œโ”€โ”€ lib/                  # Utility libraries
โ”œโ”€โ”€ iso/                  # ISO build directory
โ”‚   โ””โ”€โ”€ boot/
โ”‚       โ”œโ”€โ”€ grub/         # GRUB configuration
โ”‚       โ”‚   โ”œโ”€โ”€ menu.lst  # GRUB menu
โ”‚       โ”‚   โ””โ”€โ”€ stage2_eltorito
โ”‚       โ””โ”€โ”€ kernel.elf    # Compiled kernel
โ”œโ”€โ”€ loader.s              # Assembly bootloader
โ”œโ”€โ”€ link.ld               # Linker script
โ”œโ”€โ”€ Makefile              # Build automation
โ”œโ”€โ”€ bochsrc.txt           # Bochs emulator config
โ”œโ”€โ”€ stage2_eltorito       # GRUB Stage 2 bootloader
โ””โ”€โ”€ README.md

๐Ÿ› ๏ธ Requirements

Build Tools

Tool Purpose
gcc (with multilib) C compiler for 32-bit targets
nasm Netwide Assembler for x86
ld GNU linker
genisoimage ISO 9660 filesystem creation
qemu-system-i386 x86 emulator for testing

Installation

Ubuntu / Debian / WSL2:

sudo apt update
sudo apt install -y build-essential gcc-multilib nasm genisoimage qemu-system-x86

Arch Linux:

sudo pacman -S base-devel gcc-multilib nasm cdrtools qemu-system-x86

Fedora / RHEL:

sudo dnf groupinstall "Development Tools"
sudo dnf install gcc.i686 nasm genisoimage qemu-system-x86

๐Ÿš€ Quick Start

Build the OS

make

This compiles the kernel, assembles the loader, and packages everything into a bootable ISO (kernel.iso).

Run in QEMU

make run

Launches the OS in QEMU with optimized settings for development.

Clean Build Artifacts

make clean

Removes all compiled binaries and intermediate files.

Full Rebuild

make clean && make

๐ŸŽฎ Usage

Interactive Shell

Once booted, you'll see the Raef OS prompt:

> _

Available Commands:

Command Description
help Display command list and usage information
clear Clear the terminal screen
flex Display ASCII art logo
uptime Show elapsed time since boot
echo [text] Print text to the console
reboot Restart the operating system

Keyboard Controls

  • Type commands naturally
  • Enter executes the command
  • Backspace deletes characters
  • Screen automatically scrolls when full

๐Ÿ”ฌ Technical Details

Architecture

  • Target: x86 (IA-32)
  • Boot Protocol: Multiboot
  • Environment: Freestanding (no hosted C library)
  • Linking: Custom linker script (link.ld)

Memory Layout

0x00100000 (1MB)  - Kernel load address
0x000B8000        - VGA text buffer (80x25x2 bytes)

Hardware Access

  • VGA: Memory-mapped I/O at 0xB8000
  • Keyboard: Port 0x60 (data) and 0x64 (status)
  • Direct I/O: No abstraction layers

Build Process

  1. Assembly: nasm assembles loader.s to loader.o
  2. Compilation: gcc compiles C sources with -m32 -ffreestanding
  3. Linking: ld creates kernel.elf using custom script
  4. ISO Creation: genisoimage packages kernel with GRUB

๐Ÿ—บ๏ธ Roadmap

Phase 1: Core Infrastructure โœ…

  • Bootloader integration
  • Basic kernel setup
  • VGA driver
  • Keyboard input

Phase 2: Interrupts & IRQs ๐Ÿ”„

  • Interrupt Descriptor Table (IDT)
  • Programmable Interrupt Controller (PIC) setup
  • Keyboard interrupt handler (IRQ1)
  • Timer interrupt (IRQ0)

Phase 3: Enhanced I/O

  • Serial port driver (COM1)
  • kprintf formatted output
  • Logging system

Phase 4: Memory Management

  • Global Descriptor Table (GDT)
  • Paging implementation
  • Physical memory manager
  • Virtual memory allocator

Phase 5: Advanced Features

  • Process/task management
  • Filesystem support
  • User mode transition
  • System calls

Phase 6: User Experience

  • File manager interface
  • Extended shell commands
  • Multi-tasking support

๐Ÿ“š Learning Resources

This project was built using knowledge from:


๐Ÿ› Known Limitations

  • Polling-based keyboard: IRQ implementation pending
  • No interrupt handling: Currently uses busy-wait loops
  • Single-threaded: No multitasking support yet
  • No filesystem: Data is hardcoded in kernel
  • Limited error handling: Minimal validation and recovery

๐ŸŽฏ Project Goals

This OS is not intended for production use. It serves as:

  • ๐ŸŽ“ An educational platform for OS development
  • ๐Ÿ”ง A testbed for low-level programming concepts
  • ๐Ÿงช A learning environment for x86 architecture
  • ๐Ÿ’ก A foundation for understanding kernel internals

๐Ÿค Contributing

While this is primarily a personal learning project, suggestions and feedback are welcome! Feel free to:

  • Open issues for bugs or questions
  • Suggest improvements or features
  • Share your own OS development experiences

๐Ÿ“œ License

This project is for educational purposes only. Use at your own risk.

No warranty is provided. The code is provided as-is for learning and experimentation.


๐Ÿ‘จโ€๐Ÿ’ป Author

rff-glitch

Built from the ground up. No shortcuts. No regrets.


๐Ÿ™ Acknowledgments

Special thanks to the OS development community for their extensive documentation and resources that made this project possible.


Made with โ˜• and ๐Ÿ’ป

"Understanding how computers work by building one from scratch"

About

โšก Educational x86โš™๏ธ operating system๐Ÿ–ฅ๏ธ | Multiboot kernel, VGA framebuffer, PS/2 keyboard driver | Freestanding C implementation ๐Ÿ› ๏ธ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •