A feature-rich 32-bit x86 operating system written in C and Assembly, designed with a comprehensive kernel and userland architecture.
- Bootloader: Multiboot-compliant bootloader with GRUB support
- Protected Mode: Full 32-bit protected mode operation
- Memory Segmentation: GDT (Global Descriptor Table) with kernel and user segments
- Interrupt Handling: IDT (Interrupt Descriptor Table) with ISRs and IRQs
- Hardware Drivers:
- VGA text mode driver (80x25 color output)
- PS/2 keyboard driver (with key buffer)
- PIT timer driver (programmable interval timer)
- Shell: Built-in command-line interface with commands:
help- Display available commandsclear- Clear the screenuptime- Show system uptimeabout- Display OS information
- Memory Management:
- Physical memory manager
- Virtual memory manager (paging)
- Heap allocator (kmalloc/kfree)
- Process Management:
- Task structures and process control blocks
- Preemptive multitasking scheduler
- Context switching
- System Calls:
- Usermode/kernel mode switching
- System call interface (int 0x80)
- File System:
- Virtual File System (VFS) layer
- Initial RAM filesystem support
- Userland:
- Standard C library for applications
- Init process
- Shell and utilities (ls, cat, echo, ps, etc.)
- GCC: Cross-compiler for i686-elf or native GCC with -m32 support
- NASM: Netwide Assembler for x86 assembly
- LD: GNU linker
- Make: Build automation
- QEMU: For testing (qemu-system-i386)
- GRUB (optional): For creating bootable ISOs
- xorriso (optional): For ISO creation
Arch Linux / Manjaro:
sudo pacman -S gcc nasm qemu-system-x86 grub xorrisoUbuntu / Debian:
sudo apt install gcc nasm qemu-system-x86 grub-pc-bin xorrisoFedora:
sudo dnf install gcc nasm qemu-system-x86 grub2 xorriso# Clean previous builds
make clean
# Build kernel
make kernel.bin
# Build ISO image (requires grub-mkrescue and xorriso)
make iso# Run kernel directly in QEMU
make run
# Run with ISO image
make run-iso
# Run in debug mode (GDB server on port 1234)
make debug- Build the ISO:
make iso - Create a new VM with the following settings:
- Type: Other/Unknown
- Memory: 128 MB minimum
- Boot from ISO:
barraos.iso
WARNING: Experimental! Test in a VM first.
- Build the ISO:
make iso - Write to USB:
sudo dd if=barraos.iso of=/dev/sdX bs=4M(replace sdX with your USB device) - Boot from USB
barraos/
├── boot/
│ ├── boot.asm # Boot assembly with multiboot header
│ └── grub.cfg # GRUB configuration
├── kernel/
│ ├── include/ # Header files
│ │ ├── types.h # Type definitions
│ │ ├── vga.h # VGA driver header
│ │ ├── gdt.h # GDT header
│ │ ├── idt.h # IDT header
│ │ ├── timer.h # Timer driver header
│ │ ├── keyboard.h # Keyboard driver header
│ │ ├── io.h # Port I/O functions
│ │ └── string.h # String functions
│ ├── arch/x86/ # Architecture-specific code
│ │ ├── gdt.c # GDT implementation
│ │ └── idt.c # IDT implementation
│ ├── drivers/ # Device drivers
│ │ ├── vga.c # VGA text mode driver
│ │ ├── keyboard.c # Keyboard driver
│ │ └── timer.c # Timer driver
│ ├── main.c # Kernel entry point
│ └── string.c # String library implementation
├── userland/ # User-space programs (planned)
│ ├── libc/ # Standard C library
│ └── bin/ # User programs
├── linker.ld # Linker script
├── Makefile # Build system
└── README.md # This file
- GRUB loads the kernel at 1MB in memory
- Multiboot header is detected and validated
- Kernel entry point (_start) is called
- Stack is set up
- kernel_main() is invoked with multiboot info
0x00000000 - 0x000FFFFF: Real mode area (1MB)0x00100000 - ...: Kernel loaded here (1MB+)0xB8000: VGA text mode buffer- Stack grows downward from top of available memory
- ISRs 0-31: CPU exceptions (divide by zero, page fault, etc.)
- IRQs 32-47: Hardware interrupts (remapped from 0-15)
- IRQ 0 (32): Timer
- IRQ 1 (33): Keyboard
- INT 128 (0x80): System call interface (planned)
- Bootloader and kernel entry
- VGA text mode driver
- GDT setup
- IDT and interrupt handling
- Timer driver
- Keyboard driver
- Basic shell
- Physical memory manager
- Virtual memory (paging)
- Heap allocator
- Task structures
- Scheduler
- Context switching
- System calls
- VFS layer
- Initial RAM filesystem
- File operations
- User mode switching
- Standard C library
- Init process
- Shell and utilities
The kernel currently boots and provides an interactive shell. Try these commands:
- Type
helpto see available commands - Type
aboutto see OS information - Type
uptimeto see how long the system has been running - Type
clearto clear the screen
# Terminal 1: Start QEMU in debug mode
make debug
# Terminal 2: Connect GDB
gdb kernel.bin
(gdb) target remote localhost:1234
(gdb) break kernel_main
(gdb) continue"Error: Invalid multiboot magic number!"
- The bootloader didn't load properly. Ensure GRUB is configured correctly.
Keyboard not responding
- Check that interrupts are enabled (STI instruction)
- Verify PIC is remapped correctly
Triple fault / Reboot loop
- Check GDT and IDT are properly configured
- Verify stack is set up correctly
- Enable QEMU debug output:
-d int,cpu_reset
This is a personal OS development project. Feel free to fork and experiment!
MIT
- OSDev Wiki - Comprehensive OS development resource
- Intel x86 Manuals - Official x86 documentation
- GRUB Manual - Bootloader documentation
- James Molloy's Kernel Tutorial - Classic tutorial
For questions or issues, please open a GitHub issue (if hosted on GitHub).
Note: This OS is a work in progress. Features are being actively developed.