KernelNewbies:

Linux 0.01 bootstrap from PC Bios.

Back to Kernel001WalkThrough.

This is in assembler source file boot/boot.s. Read Linus' BootComments if you like. In short, the boot device is assumed to be a floppy drive, and Linus has designed for a maximum kernel size of 512k (8*64k). PCs with only 1MB RAM were fairly common in the early 1990's.

The first thing it does when loaded by bios_start at 0x7c00 is to copy itself to 0x90000, then jump to the relocated code, where it uses BIOS calls to write the message "\nLoading system...\n\n", reads the system image directly at address 0x10000 from the boot device using BIOS calls, then turns off the floppy drive, saves the cursor position, turns off interrupts, and relocates the system image to address 0.

The addresses of a suitable Interrupt Descriptor Table (IDT) and Global Descriptor Table (GDT) are then loaded into the appropriate 386 registers. These tables are stored as data in the bootstrap code image.

The key-board buffer is emptied. The interrupts are reprogrammed (ouch! you can really feel Linus's pain, here!). Then the process is switched to protected mode. It then jumps to execute the relocated system image. The code involved here is described in ThirtyTwoBitInitialization.

KernelNewbies: BootStrapFromPcBios (last edited 2017-12-30 01:30:05 by localhost)