Master the fundamental concepts of build a mini kernel through this focused micro-challenge.
x86 PCs start in real mode at 0xFFFFFFF0, executing firmware that eventually loads a boot sector to 0x7C00 and jumps there. Your bootloader's job is to find the kernel and switch to protected mode later.
Firmware path:
0x7C00 with 0xAA55 signatureFor example, a 512-byte sector ending with boot signature loads in one INT 13h read of cylinder 0, head 0, sector 1.
This is the exact path every x86 hobby kernel referenced by the OSDev wiki takes, and it's the same MBR-at-0x7C00-then-GRUB flow that boots real Linux installations before the kernel takes over. Getting a single stage wrong , like jumping to the wrong load address , is why 'kernel panics before printing anything' is one of the most common early OS-dev debugging sessions.
Before you call the implementation done, walk failure modes on purpose. Test empty structures, single-element edge cases, maximum concurrency, and errno paths that must not crash the program. OS code usually fails in production when happy-path tests pass but invariants break under contention or memory pressure.
Keep structures small and name fields after kernel counterparts when possible. That lets you read man pages and kernel source side by side while you work. Print observable events during development; remove noisy logs once tests pass reliably.
You will trace the reset vector through your bootloader's first instructions. The task asks you to label each register state (CS:IP) at handoff points in a boot map diagram.
Simulate how a PC boots from a Master Boot Record, the path every BIOS-era x86 machine follows before a kernel runs. The BIOS finishes POST, then tries each drive in boot order. A drive is bootable only if sector 0 ends with the signature 55 AA. The BIOS loads that sector to 0x7C00 and jumps to it. The MBR code then reads the partition table at offset 0x1BE, picks the single active partition, and chain-loads that partition's first sector (the VBR). Implement the checks and print the boot log.
cLoading…
Drives appear in boot order. A line reset power-cycles the machine: finish the current boot (printing BIOS: no bootable device if nothing booted), print an empty line, and start a new boot with the lines that follow.
Four 16-byte entries at 0x1BE, 0x1CE, 0x1DE and 0x1EE: status at +0 (0x80 = active, 0x00 = inactive, anything else invalid), type at +4, first LBA at +8 (u32 LE), sector count at +12 (u32 LE). An entry of type 0 is unused.
ram 0 → POST: no memory, halting (beep code), and no drive is tried; otherwise POST: N KiB conventional memory ok.
For each drive, until one boots: without 55 AA at 510-511, print the "no boot signature" line and try the next. Otherwise print the load line and examine the table:
00/80 → invalid partition table (bad status byte);0xEE entry → the GPT hand-off line;invalid partition table (partitions A and B overlap) (the first such pair);no active partition, or more than one → invalid partition table (N active partitions);These checks run in the order listed. Once a drive has a valid signature, the boot process ends there, whether it succeeds or fails.
If no drive has a signature (checked at reset and at the end of the input): BIOS: no bootable device.
cLoading…
Type names: 01 FAT12, 05/0F extended, 06 FAT16, 07 NTFS/exFAT, 0B FAT32, 0C FAT32 LBA, 82 Linux swap, 83 Linux, EE GPT protective, EF EFI system, and unknown for anything else. Sizes are sectors × 512 in MiB with one decimal. , active is appended to the active entry.
Input:
cLoading…
Output:
cLoading…
u32 helper.Hidden tests cover a GPT protective MBR, two active partitions, overlapping partitions, a bad status byte, no active partition, and no bootable drive at all.
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it works