5.2. The Boot Blocks: Bootstrap Stages 1 and 2

Bootstrapping is the process whereby a computer probes and initializes its devices, and works out what programs it is supposed to run.

This involves the use of special Read Only Memory chips, which determine what further operations to do, and these usually pass control to other chips that do consistency and memory tests, configure devices, and provide a mechanism for programs to determine what configuration details were determined.

In standard personal computers, this involves the BIOS (which oversees the bootstrap), and CMOS (which stores configuration). BIOS and CMOS understand disks, and also understand where on the disk to find a program that will know how to load up an operating system.

This chapter will not deal with this first part of the bootstrap process. Instead it will focus on what happens after control is passed to the program on the disk.

The boot blocks are responsible for finding (usually) the loader, and running it, and thus need to understand how to find that program on the filesystem, how to run the program, and also allow minor configuration of how they work.

5.2.1. boot0

There is actually a preceding bootblock, named boot0, which lives on the Master Boot Record, the special part of the disk that the system bootstrap looks for and runs, and it simply shows a list of possible slices to boot from.

boot0 is very simple, since the program in the MBR can only be 512 bytes in size.

It displays something like this:

Example 5-1. boot0 screenshot

    F1 DOS
    F2 FreeBSD
    F3 Linux
    F4 ??
    F5 Drive 1
    
    Default: F2

5.2.2. boot1

boot1 is found on the boot sector of the boot slice, which is where boot0, or any other program on the MBR expects to find the program to run to continue the boot process.

boot1 is very simple, since it too can only be 512 bytes in size, and knows just enough about the FreeBSD disklabel, which stores information about the slice, to find and execute boot2.

5.2.3. boot2

boot2 is slightly more sophisticated, and understands the FreeBSD filesystem enough to find files on it, and can provide a simple interface to choose the kernel or loader to run.

Since the loader is much more sophisticated, and provides a nice easy-to-use boot configuration, boot2 usually runs it, but previously it was tasked to run the kernel directly.

Example 5-2. boot2 screenshot

    >> FreeBSD/i386 BOOT
    Default: 0:wd(0,a)/kernel
    boot:

For questions about FreeBSD, e-mail <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.