My-Operating-System-OpenOS

OpenOS - Advanced Educational Kernel

OpenOS is an educational, open-source operating system built from scratch for the x86 architecture. It features a modular monolithic architecture, complete exception handling, memory management, and timer support - a production-ready foundation for learning OS development.

The goal is to build a small, understandable OS from zero, inspired by hobby OS projects like MyraOS, xv6, and OSDev examples β€” but implemented with our own code, fully documented, and open for community contribution.

🎯 Mission

To create a collaborative OS development environment where students, beginners, and low-level enthusiasts can learn:

All with clean, simple, modern C + Assembly code in a well-organized modular structure.

πŸ—οΈ Architecture

OpenOS follows a modular monolithic kernel architecture:

β”œβ”€β”€ arch/x86/          # Architecture-specific code (IDT, ISR, PIC, exceptions)
β”œβ”€β”€ kernel/            # Core kernel (initialization, panic handling)
β”œβ”€β”€ memory/            # Memory management (PMM, VMM, heap)
β”œβ”€β”€ drivers/           # Hardware drivers (console, keyboard, timer)
β”œβ”€β”€ fs/                # File systems (VFS - future)
β”œβ”€β”€ process/           # Process management (future)
└── include/           # Common headers (types, multiboot)

Benefits:

See docs/architecture/ARCHITECTURE.md for detailed architecture documentation.

✨ Features

Phase 0 - Core Foundation (βœ… Complete)

Phase 1 - Process Management (🚧 Planned)

Future Phases (πŸ“‹ Roadmap)

πŸš€ Quick Start

Build and Run (QEMU)

make run

You should see:

OpenOS - Advanced Educational Kernel
====================================
Running in 32-bit protected mode.

[1/5] Initializing IDT...
[2/5] Installing exception handlers...
[3/5] Initializing PIC...
[4/5] Initializing timer...
[5/5] Initializing keyboard...

*** System Ready ***
- Exception handling: Active
- Timer interrupts: 100 Hz
- Keyboard: Ready

Type commands and press Enter!

OpenOS> _

Build Bootable ISO

make iso

Run in VirtualBox

make run-vbox

This automatically creates a VM, builds an ISO, and launches OpenOS in VirtualBox!

πŸ› οΈ Build & Run

Prerequisites

To build and run OpenOS, you’ll need:

Installing Prerequisites

Ubuntu/Debian:

sudo apt-get install gcc-multilib nasm make qemu-system-x86 grub-pc-bin xorriso mtools

Arch Linux:

sudo pacman -S gcc nasm make qemu-system-x86 grub xorriso mtools

macOS (with Homebrew):

brew install i686-elf-gcc nasm make qemu grub xorriso mtools

Building

From the project root directory:

make

This will compile the kernel and produce Kernel2.0/openos.bin.

Running

Option 1: QEMU (Quick Testing)

To build and run the kernel in QEMU with direct kernel boot:

make run

This launches QEMU with the kernel. You should see:

OpenOS - Educational Kernel Prototype
-------------------------------------
Running in 32-bit protected mode.
Initializing interrupts...
Keyboard initialized. Type something!

OpenOS> _

Type on your keyboard and press Enter to interact with the shell!

πŸ“– Phase 0 Implementation Details

OpenOS Phase 0 includes complete implementations of:

For complete implementation details, see docs/roadmap/UPGRADE_PHASE0.md.

πŸ§ͺ Testing Exception Handling

Want to see the exception handler in action? Add this to kernel.c:

void test_exception(void) {
    volatile int x = 1 / 0;  // Trigger divide-by-zero
}

You’ll get a detailed crash report with full register dump!

Option 2: VirtualBox (Full Emulation)

To create a bootable ISO and run in VirtualBox:

make run-vbox

This will:

  1. Build the kernel
  2. Create a bootable ISO image with GRUB (openos.iso)
  3. Create and configure a VirtualBox VM
  4. Start the VM with the ISO attached

Manual VirtualBox Setup:

If you prefer to set up VirtualBox manually:

  1. Create the ISO image:
    make iso
    
  2. Create a new VirtualBox VM:
    • Name: OpenOS
    • Type: Other
    • Version: Other/Unknown
    • Memory: 512 MB (minimum)
    • No hard disk needed
  3. Configure the VM:
    • System β†’ Boot Order: CD-ROM first
    • System β†’ Enable I/O APIC
    • Storage β†’ Add IDE Controller
    • Storage β†’ Attach openos.iso as CD-ROM
  4. Start the VM and enjoy!

Troubleshooting: If you encounter any issues with VirtualBox, see the VirtualBox Troubleshooting Guide.

Option 3: ISO in QEMU

To test the ISO image in QEMU:

make run-iso

Cleaning

To remove build artifacts:

make clean

🀝 Contributing

OpenOS welcomes contributions at all levels! Whether you’re fixing a bug, adding a feature, improving documentation, or just learning, your contributions are valuable.

Please see CONTRIBUTING.md for detailed guidelines on:

Quick Start for Contributors

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and test them
  4. Commit with clear messages (git commit -m "Add amazing feature")
  5. Push to your fork (git push origin feature/amazing-feature)
  6. Open a Pull Request

πŸ“š Documentation

The /docs directory contains comprehensive documentation organized by topic:

πŸ“Š Project Stats

πŸ“„ License

MIT License β€” free to use, modify, and contribute.