A hobby x86 operating system born from loneliness, written from scratch in assembly and C with a working shell, text editor, virtual filesystem, ROM filesystem, and a playable Snake game.
- Real Mode to Protected Mode switching
- Global Descriptor Table (GDT) implementation
- A20 line enable
- Kernel loaded from disk
- C kernel with assembly entry point
- Physical Memory Manager (PMM)
- PIT-based timer driver
- Interactive Shell with piping (
|) and redirection (>,>>,<) - Virtual Filesystem (VFS) with inode/dentry tree
- RAM Filesystem (flat structure)
- ROM Filesystem (built-in read-only files: help.txt, version.txt, motd.txt)
- Gap-buffer text editor (
edit) - VGA Mode 13h graphics driver (320×200, 256 colors)
- Playable Snake game (
snake) - QEMU testing support
- GDB debugging capabilities
- Bootloader (
src/arch/x86/boot.asm): Real mode initialization, disk loading, mode switching - Kernel Assembly (
src/arch/x86/kernel.asm): 32-bit entry point - Interrupts and IDT (
src/arch/x86/interrupts.asm,src/arch/x86/idt.c,src/arch/x86/idt.h): Exception and interrupt setup - Drivers (
src/drivers/): VGA text mode, VGA mode 13h, keyboard, and timer - Kernel C (
src/kernel/kernel.c): Main kernel logic - Memory (
src/memory/pmm.c,src/memory/pmm.h): Physical memory management (256MB) - ROM Filesystem (
src/fs/romfs/): Built-in read-only files (help.txt, version.txt, motd.txt) - Shell (
src/shell/): Interactive shell and command history - Filesystem (
src/fs/): Flat RAM FS and VFS layer - Editor (
src/editor/): Gap-buffer text editor - Games (
src/games/): Snake - Linker Script (
linkerscript.ld): Memory layout
The bootloader requires GCC (GNU Compiler Collection) and binutils to compile and link the kernel and bootloader code.
GCC compiles C code to machine code, while binutils provides essential tools like:
as(assembler) - assembles .asm files to object filesld(linker) - links object files into the final kernel binaryobjdump,objcopy,readelf- utilities for examining and manipulating binary files
sudo apt install gcc binutils nasmsudo pacman -S gcc binutils nasmsudo dnf install gcc binutils nasmbrew install gcc binutils nasmVerify installation:
gcc --version
ld --version
as --versionAfter installing dependencies (see Installation section):
# Build OS image using native GCC (with -m32)
make clean
make# Run with QEMU
qemu-system-x86_64 -drive format=raw,file=./bin/os.bin,if=ide,index=0
# Debug with GDB
qemu-system-x86_64 -drive format=raw,file=./bin/os.bin,if=ide,index=0 -s -S &
gdb ./bin/kernel.bin
(gdb) target remote localhost:1234
(gdb) break shoot_on_your_own_foot
(gdb) continue- NASM assembler
- GCC (with support for -m32)
- GNU Make
- QEMU (for testing)
- GDB (for debugging)
- ~76hours
MIT