Master the fundamental concepts of boot sector development through this focused micro-challenge.
Kernels often ship as ELF binaries with program headers describing loadable segments. A bootloader reads each PT_LOAD segment from disk to its p_paddr or p_vaddr and jumps to e_entry. For example, a ET_EXEC kernel at LBA 100 might place .text at 0x100000 and entry at 0x101000.
cLoading…
Verify e_ident[EI_MAG] bytes and e_machine == EM_386 before trusting headers. p_paddr may be zero for some objects; fall back to p_vaddr when loading a linked kernel expecting low memory. Read sectors in chunks if your DAP cannot span the whole segment in one BIOS call. Clear the BSS portion when p_memsz > p_filesz so global variables start at zero.
You will parse ELF headers and load at least one PT_LOAD segment from disk. This exercise requires computing file offsets, physical addresses, and the entry point before transfer of control.
Implement an ELF binary parser and loader in boot sector code.
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