Tuesday, August 31, 2010

Understanding the PC Boot Process

The PC boot process in a nutshell


1. Executes code from well-known location.

2. Execute first-stage boot loader from MBR.

3. Execute second-stage boot loader.

4. Load the kernel.

5. Load the first user space program.
 
 
 
BIOS


● BIOS – Basic Input/Output System

● Located at memory location 0xFFFF0

● Boot firmware designed to be run at startup

● POST – Power-on Self-Test

● Identifies, tests, and initializes system devices

● Run-time services

● Initial configuration

● Selects which device to boot from

● Alternatively, Extensible Firmware Interface (EFI)
 
 
Stage 1 Boot Loader: MBR


● MBR – Master Boot Record

● Located on first sector of the boot disk

● Size: 512 bytes

● BIOS loads MBR to RAM, relinquishes control

● Main job: load the second-stage boot loader
 
 
Anatomy of the MBR


● First 446 bytes

● Primary boot loader

● Code and error messages

● Next 64 bytes

● Partition information

● Last 2 bytes

● Magic number

● Validation check for MBR

 
Stage 2 Boot Loader


● Loads the kernel

● On Linux:

● GRUB – Grand Universal Bootloader

● LILO – Linux Loader

● Others: SysLinux, ISOLinux, PXELinux

● From Windows NT to Windows XP:

● NTLDR

● On Windows Vista:

● Windows Boot Manager
 

No comments:

Post a Comment