The bootstrapping process is a bit confusing, I hope I understand it correctly. I will try to describe my understandings and hopefully can be corrected. As this is an extremely important and I want to dive into the small details.
BIOS:
It sets up an interrupt descriptor table and initializes various devices. After initializing all the important devices the BIOS knows about, it searches for a bootable device such as a floppy, hard drive, or CD-ROM.
Hard disks are divided into 512 bytes regions called sectors and the first sector is known as boot-sector. Once the BIOS finds a bootable floppy or hard disk, it loads the 512-byte boot sector into memory, then passes control to the boot loader.
Boot-loader:
1. The boot loader switches the processor from real mode to 32-bit protected mode, because it is only in this mode that software can access all the memory above 1MB in the processor's physical address space.
2. The boot loader reads the kernel from the hard disk
Kernel:
The kernel begins with some assembly language code that sets things up so that C language code can execute properly. And enables paging.
Memory layout
|---------|
| |
| boat | Sector 0
| loader |
| |
|---------|
| |
| |
| | Sector 1
.
.
.
My questions:
How does the boot-loader know where is the kernel found ?
From what I remember, anELFheader contains the number of sectors the boatloader should load. But how does it find thisELFheader ? What structures does it use to find these details ?The Bios is located on an
EEPROMchip, yet some books like to show that BIOS is on the first sector in hard disk and bootloader is on second. This confuses me a bit.Is the Kernel always brought into the same address in main-memory ? if so who/what determines this address ?
Is the boot-loader always brought to
0x0000 - 0x7c00block of memory ?
Any additional information about the flow will be welcomed. And I am sure I missed some responsibilities of these 3.