FreeBSD has a bootloader vastly different than GRUB or LILO. The equivalent of stage1 in GRUB (which is used to locate the rest of GRUB and load it) is boot0 in FreeBSD, which is actually used to directly chainload Windows (or any other dual boot setup using the FreeBSD bootloader). The problem with boot0 is that, because it fits entirely in the MBR’s boot code area (which is 440 bytes), it doesn’t load a configuration file at all. FreeBSD still gives you a way to configure it, however, with
boot0cfg. Read on for a simple tutorial on the basics of
boot0cfg, you can easily hide partitions from the
boot0 menu. For example, Windows 7 uses two NTFS partitions (one is the “System Reserved Partition”, and the other is the C: partition), but only the System Reserved Partition is bootable. On my system, the partition order is:
/dev/ada0s1 System Reserved Partition
/dev/ada0s3 FreeBSD slice
/dev/ada0s2 (F2 in
boot0) doesn’t work, so let’s hide it from the list of partitions.
boot0cfg lets you set a mask that
boot0 will use to determine what partitions to show. The mask is a hexadecimal number from 0×0 (all disabled) to 0xf (all enabled). In the example above, partitions 1 and 3 should be enabled, so the mask is 0b0101, or 0×5. The right-most bit is partition 1, and the left-most bit is partition 4.
This is a table for the different masks you can use:
|Part. 1||Part. 2||Part. 3||Part. 4||Mask|
Once you know what mask you need to use, run
boot0cfg -m $MASK /dev/$DISK, replacing
$MASK with the mask in the table above, and
$DISK with the disk you want to configure. The disk should be the disk, not a partition (for example,
/dev/ada0 instead of
/dev/ada0s1). In our example above, the command would be
boot0cfg -m 0x5 /dev/ada0. The next time you reboot, you should only see the enabled partitions. The mask won’t, however, force a partition
boot0 wouldn’t normally show to be shown. It is only capable of disabling partitions that
boot0 normally shows.
An important note: you cannot boot from disabled partitions, at all! Trying to hit the key for a disabled partition just results in
# and waiting for another key to be pressed.