How die-banane/bootloader works
This is a small x86 BIOS bootloader: stage 1 loads stage 2, whose C entry initializes the console, locates the active partition, and initializes a FAT volume. The sampled FAT code also provides directory lookup and FAT16 file-reading logic, backed by BIOS disk reads. Stage-2 support includes real-mode entry, A20/GDT setup, VGA text output, and freestanding formatting/string helpers. Several assembly modules and FAT-related paths are represented from the tree, but their internal call relationships were not sampled; those links are omitted.
Main entry points: main.c Stage-2 Main · fat.c FAT Volume Init · bios.c Disk Read Wrapper · console.c VGA Console
Components 18
Boot Stages
- Stage-1 MBR
src/stage1/mbr.asm - Stage-2 Entry
src/stage2/entry.asm - A20 Setup
src/stage2/a20.asm - GDT Setup
src/stage2/gdt.asm
FAT Filesystem
- FAT Volume Init
src/stage2/fs/fat/fat.c - Active Partition
src/stage2/fs/fat/fat.c - Root Directory
src/stage2/fs/fat/fat.c - FAT File Reading
src/stage2/fs/fat/fat.c - Filesystem API
src/stage2/include/filesystem.h - Filesystem Error Text
src/stage2/fs/fs.c
BIOS Disk I/O
- Disk Read Wrapper
src/stage2/bios.c - BIOS Disk Interrupt
src/stage2/bios16.asm
Stage-2 Runtime
- Stage-2 Main
src/stage2/main.c - Formatted Output
src/stage2/stdio.c - VGA Console
src/stage2/console.c - String Primitives
src/stage2/string.c - Character Helpers
src/stage2/ctype.c
Other components
- BIOS Firmware
Connections 14
- Stage-2 Main → VGA Console: clears screen
src/stage2/main.c - Stage-2 Main → Active Partition: finds partition
src/stage2/main.c - Stage-2 Main → FAT Volume Init: initializes volume
src/stage2/main.c - Stage-2 Main → Formatted Output: prints errors
src/stage2/main.c - Stage-2 Main → VGA Console: sets color
src/stage2/main.c - FAT Volume Init → Active Partition: uses partition
src/stage2/fs/fat/fat.c - FAT Volume Init → Root Directory: loads directory
src/stage2/fs/fat/fat.c - FAT Volume Init → Disk Read Wrapper: reads boot sector
src/stage2/fs/fat/fat.c - Root Directory → Disk Read Wrapper: reads directory sectors
src/stage2/fs/fat/fat.c - FAT File Reading → Disk Read Wrapper: reads file clusters
src/stage2/fs/fat/fat.c - Disk Read Wrapper → BIOS Disk Interrupt: calls disk service
src/stage2/bios.c - BIOS Disk Interrupt → BIOS Firmware: requests disk I/O
- Formatted Output → VGA Console: writes characters
src/stage2/stdio.c - Stage-1 MBR → Stage-2 Entry: loads stage two