os-kernel-demo
x86 bare-metal project

A Toy x86 Kernel
From Scratch

A minimal, educational operating system kernel for the x86 architecture. Written entirely in C and assembly with no standard library, no Unix, and no existing OS code. Just a bare-metal bootloader, a GDT, a VGA text-mode driver, and the kernel entry point itself.

Project Goals

01

Educational

Understand how x86 boots: real mode, protected mode, GDT, and the journey from power-on to a running C kernel.

02

Minimal

The kernel is tiny and readable. Every line serves a purpose. No bloat, no abstraction layers you don't need.

03

Bare Metal

No standard library, no OS services, no firmware abstractions. Just your code, the CPU, and the VGA buffer.

Boot Process

Step 1

BIOS / UEFI

On power-on, the CPU starts in 16-bit real mode. The BIOS runs POST, then loads the first sector (512 bytes) from the boot device into memory at 0x7C00 and jumps to it.

Step 2

Bootloader

The 512-byte bootloader (written in NASM assembly) sets up a minimal GDT, switches the CPU to 32-bit protected mode, loads the kernel binary from disk, and jumps to 0x00100000.

Step 3

Kernel Entry

Written in C and compiled with -ffreestanding, the kernel initializes the VGA text-mode driver, prints a message to screen, and halts. No Unix, no libc, no runtime.

Try the terminal

The kernel includes a simulated terminal. Type help to see available commands.

Open terminal