The Hardware Handshake: BIOS vs. UEFI
Before an operating system can manage memory or schedule processes, it must be brought into existence by the hardware. This process, known as booting (short for bootstrapping), is the sequence of events that occurs from the moment you press the power button until the kernel takes control.
1. The Power-On Self-Test (POST)
When power is applied, the CPU is “reset” to a fixed execution state. On x86 systems, it begins in Real Mode (16-bit) and jumps to a specific memory address (usually 0xFFFFFFF0, the “reset vector”) where the firmware resides.
The firmware—either a Legacy BIOS or a modern UEFI—first performs the POST. This verifies that the hardware is functional: it checks the CPU, initializes the memory controller (RAM), and detects storage devices.
2. Legacy BIOS and the MBR
For decades, the BIOS (Basic Input/Output System) was the standard. It is limited by its 16-bit origins.
The Master Boot Record (MBR)
The BIOS looks at the first 512 bytes of the bootable disk. This sector is the MBR.
- Bootstrap Code (446 bytes): Tiny machine code that knows how to find the rest of the OS.
- Partition Table (64 bytes): Defines up to 4 primary partitions.
- Boot Signature (2 bytes): The hex value
0x55AA. If this is missing, the BIOS won’t boot the disk.
BIOS Limitations
- 16-bit Real Mode: Access to only 1MB of RAM initially.
- 2TB Limit: MBR partitioning cannot address disks larger than 2TB.
- Interrupt Reliance: Relies on slow, ancient software interrupts (like
INT 0x13for disk I/O).
3. The Modern Standard: UEFI
The UEFI (Unified Extensible Firmware Interface) replaced BIOS to address these limitations. It is essentially a miniature operating system itself.
Key Advantages of UEFI
- Mode Transition: Runs in 32-bit or 64-bit mode immediately, allowing access to all system memory.
- GPT (GUID Partition Table): Supports disks up to 9.4 Zettabytes and up to 128 partitions by default.
- EFI System Partition (ESP): Instead of hiding code in a “magic” sector (MBR), UEFI looks for a FAT32 partition containing
.efiexecutable files. - Secure Boot: Uses digital signatures to ensure only trusted code (like a signed Linux or Windows bootloader) is executed.
MBR vs. GPT Comparison
| Feature | MBR (BIOS) | GPT (UEFI) |
|---|---|---|
| Max Disk Size | 2 TB | 9.4 ZB |
| Max Partitions | 4 Primary | 128 (Default) |
| Redundancy | None (Single sector) | Header and Table Backups |
| Execution Mode | 16-bit Real Mode | 32/64-bit Protected Mode |
Interactive Exercise: The Magic Number
In the world of Legacy BIOS, how does the firmware know that a disk is actually bootable?
The Boot Signature
/* The last two bytes of a bootable MBR must be */\n0xWhether you are using a 30-year-old server or a brand-new laptop, understanding this initial handshake is the first step in “operating” the system. In the next lesson, we’ll see how the Bootloader bridges the gap between this firmware and the Operating System kernel.