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.
-
๐ง 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 commandsclear- Clear the terminalflex- ASCII art displayuptime- Show system uptime since bootecho- Echo text back to terminalreboot- Restart the operating system
- Interactive prompt (
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
| 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 |
Ubuntu / Debian / WSL2:
sudo apt update
sudo apt install -y build-essential gcc-multilib nasm genisoimage qemu-system-x86Arch Linux:
sudo pacman -S base-devel gcc-multilib nasm cdrtools qemu-system-x86Fedora / RHEL:
sudo dnf groupinstall "Development Tools"
sudo dnf install gcc.i686 nasm genisoimage qemu-system-x86makeThis compiles the kernel, assembles the loader, and packages everything into a bootable ISO (kernel.iso).
make runLaunches the OS in QEMU with optimized settings for development.
make cleanRemoves all compiled binaries and intermediate files.
make clean && makeOnce 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 |
- Type commands naturally
- Enter executes the command
- Backspace deletes characters
- Screen automatically scrolls when full
- Target: x86 (IA-32)
- Boot Protocol: Multiboot
- Environment: Freestanding (no hosted C library)
- Linking: Custom linker script (
link.ld)
0x00100000 (1MB) - Kernel load address
0x000B8000 - VGA text buffer (80x25x2 bytes)
- VGA: Memory-mapped I/O at
0xB8000 - Keyboard: Port
0x60(data) and0x64(status) - Direct I/O: No abstraction layers
- Assembly:
nasmassemblesloader.stoloader.o - Compilation:
gcccompiles C sources with-m32 -ffreestanding - Linking:
ldcreateskernel.elfusing custom script - ISO Creation:
genisoimagepackages kernel with GRUB
- Bootloader integration
- Basic kernel setup
- VGA driver
- Keyboard input
- Interrupt Descriptor Table (IDT)
- Programmable Interrupt Controller (PIC) setup
- Keyboard interrupt handler (IRQ1)
- Timer interrupt (IRQ0)
- Serial port driver (COM1)
-
kprintfformatted output - Logging system
- Global Descriptor Table (GDT)
- Paging implementation
- Physical memory manager
- Virtual memory allocator
- Process/task management
- Filesystem support
- User mode transition
- System calls
- File manager interface
- Extended shell commands
- Multi-tasking support
This project was built using knowledge from:
- OSDev Wiki
- Intelยฎ 64 and IA-32 Architectures Software Developer Manuals
- Writing a Simple Operating System from Scratch
- JamesM's Kernel Development Tutorials
- 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
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
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
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.
rff-glitch
Built from the ground up. No shortcuts. No regrets.
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"