Master the fundamental concepts of the boot process — theory through this focused micro-challenge.
Chainloading means one bootloader loads another without installing its own stage-1 in the MBR. GRUB can hand off to Windows bootmgr, another GRUB on another disk, or a raw sector image. For example, chainloader +1 reads the next sector from the selected partition and jumps to 0x7C00 like the BIOS would.
cLoading…
ntldr or BCD path on Windows volumesGRUB uses insmod part_msdos or part_gpt to find the target, then sets root to that partition before chainloader.
MBR entries at offset 0x1BE hold the starting LBA of each partition; GRUB's root command selects which boot sector gets chainloaded. GPT systems may still use BIOS compatibility images with a protective MBR pointing at the EFI partition. Windows bootmgr expects certain fields in the BPB region to remain intact; overwriting them breaks chainloading even if your own sector is valid.
You will document how GRUB chainloads another bootloader and which partition bytes are executed. This exercise requires explaining register setup, the +1 sector read, and why dual-boot setups rely on this instead of overwriting the Windows MBR code.
Simulate bootloader chainloading in C.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github