Project 1: The “Do-Nothing” Bootloader & Kernel
A minimal “kernel” that boots from a disk image (in QEMU), prints “Hello from Bare Metal!” to the VGA video memory, and halts. No Linux, no libraries, just you and the hardware.
Quick Reference
| Attribute | Value |
|---|---|
| Primary Language | Assembly (x86) & C |
| Alternative Languages | Rust |
| Difficulty | Level 3: Advanced |
| Time Estimate | Weekend |
| Knowledge Area | Boot Process / Low Level |
| Tooling | QEMU, NASM/GAS, GCC |
| Prerequisites | Basic Assembly knowledge (registers, mov instructions). |
What You Will Build
A minimal “kernel” that boots from a disk image (in QEMU), prints “Hello from Bare Metal!” to the VGA video memory, and halts. No Linux, no libraries, just you and the hardware.
Why It Matters
This project builds core skills that appear repeatedly in real-world systems and tooling.
Core Challenges
- The 512-byte limit: The BIOS only loads the first sector. You have tiny space.
- VGA Memory Mapping: Writing to
0xB8000to make text appear on screen. - Linking: Understanding how code is arranged in the binary file.
Key Concepts
- Boot Sector: MBR format and the 0x7C00 load address.
- Real Mode vs Protected Mode: 16-bit vs 32-bit addressing.
- Bare Metal IO: Writing directly to memory addresses.
Real-World Outcome
$ nasm -f bin boot.asm -o boot.bin
$ qemu-system-x86_64 boot.bin
# A QEMU window opens.
# Inside, white text on black background:
# "Hello from Bare Metal!"
Implementation Guide
- Reproduce the simplest happy-path scenario.
- Build the smallest working version of the core feature.
- Add input validation and error handling.
- Add instrumentation/logging to confirm behavior.
- Refactor into clean modules with tests.
Milestones
- Milestone 1: Minimal working program that runs end-to-end.
- Milestone 2: Correct outputs for typical inputs.
- Milestone 3: Robust handling of edge cases.
- Milestone 4: Clean structure and documented usage.
Validation Checklist
- Output matches the real-world outcome example
- Handles invalid inputs safely
- Provides clear errors and exit codes
- Repeatable results across runs
References
- Main guide:
LEARN_LINUX_UNIX_INTERNALS_DEEP_DIVE.md - “Operating Systems: Three Easy Pieces” (Virtualization Part)