boot0 provides a simple menu (e.g., F1 Win, F2 FreeBSD) allowing you to select which partition to boot from.boot0 executes the code in the first sector of that slice, which is boot1. boot2.boot1 on the disk but logically separate; it resides in the first 16 sectors of the FreeBSD slice.boot1, it contains a small driver for the UFS file system, allowing it to find and read files from the disk.>> FreeBSD/i386 BOOT) where you can manually specify a kernel or loader to run.| Stage |
|---|
| File Name | Primary Task | |
|---|---|---|
| Stage 0 | boot0 | Selects which disk partition to boot from (MBR). |
| Stage 1 | boot1 | Locates and loads boot2 from the slice. |
| Stage 2 | boot2 | Locates and loads the loader file from the UFS partition. |
| Stage 3 | loader | Final stage that loads the FreeBSD Kernel. |
/boot/boot1.efi or loader.efi) that the firmware loads directly.boot0 is the code placed in the MBR (sector 0) of the disk. It allows you to select which partition to boot from during startup. boot0cfg to write the MBR code to your disk (e.g., ada0):boot0cfg -B ada0
-B installs the boot code.fdisk (legacy): fdisk -B -b /boot/boot0 ada0.boot0cfg -s 1 -t 182 ada0
boot1 and boot2 are conceptually part of the same program but are split for space reasons. They are installed into the first track of the FreeBSD slice (partition) itself. ada0):bsdlabel -B ada0s1
-B flag tells bsdlabel to obtain the boot blocks from /boot/boot (which is a concatenated version of boot1 and boot2) and write them to the beginning of the slice.bsdlabel -b /boot/boot1 -s /boot/boot2 ada0s1
```
| Stage | File Path | Location | Installation Tool |
|---|---|---|---|
| Stage 0 (boot0) | /boot/boot0 | Master Boot Record (MBR) | boot0cfg -B |
| Stage 1 & 2 (boot1/2) | /boot/boot | First track of the FreeBSD Slice | bsdlabel -B |
boot0. Instead, you use gpart bootcode to write to a freebsd-boot partition: gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
```