The Beginning: Booting your PC

CS 321 Lecture, Dr. Lawlor, 2006/01/23

Announce the now-complete HW1 on the PC bootloader.
The Silberschatz book has just two pages on the boot loader: pages 463 & 464. System calls are documented in more detail, in section 2.3.

How a PC boots

The boot sequence on an IBM PC is initiated by the BIOS (Basic Input/Output System) stored in the computer's ROM (Read-Only Memory). 

Actually, everything in that sentence is partially a lie:
Er, so back to the the booting process. 
  1. Power flows into the CPU.
  2. The CPU is wired to begin executing code out of its own internal ROM (or flash memory).  This is called "microcode", and is set up at the CPU factory.  The CPU initializes itself (e.g., clears out its registers and cache, and puts itself into a known good state), and performs a self-test.
  3. Once the CPU self-test passes, the CPU jumps to a known location in memory, which is hardwired on your motherboard to point to your motherboard's ROM (er, flash memory).
  4. Your motherboard's ROM contains a piece of software called the "BIOS" that has just one purpose: to load up the *real* operating system.  This is harder than it sounds, because the operating system might be stored on:
  5. Once the BIOS finds a bootable disk, it loads up the "boot sector" (a disk sector, or disk block, of just 512 bytes) and executes it in 16-bit mode.  Why?  Because the original 8086 IBM PC back in 1981 executed the boot sector in 16-bit mode, that's why.  It was good enough for 1981, why isn't it good enough today?  Huh?
In a perfect world, the boot sector would actually be the kernel (more on that in a minute) of the operating system.  Sadly:
The standard thing to do from inside a boot sector is to load up the *real* OS loader ("bootloader") from disk.  The first 64 sectors of the disk are reserved for this, so the real bootloader can be up to 32K.  Known bootloaders include:
The bootloader then loads up the real OS.  So the boot sequence is overall the following amazing cascade: