http://www.freebsd.org/handbook/boot.html
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.
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.
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.
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.
Loader: Bootstrap Stage Three
The loader is the final stage of the three-stage bootstrap, and is located on
the filesystem, usually as /boot/loader.
Note: While /boot/boot0, /boot/boot1, and /boot/boot2 are files
there, they are not the actual copies in the MBR, the boot sector,
or the disklabel respectively.
The loader is intended as a user-friendly method for configuration, using an
easy-to-use built-in command set, backed up by a more powerful interpreter,
with a more complex command set.
During initialization, the loader will probe for a console and for disks,
and figure out what disk it is booting from. It will set variables
accordingly, and then the interpreter is started, and the easy-to-use
commands are explained to it. loader will then read "/boot/loader.rc",
which by default reads in "/boot/defaults/loader.conf" which sets reasonable
defaults for variables and reads "/boot/loader.conf" for local changes to
those variables. loader.rc then acts on these variables, loading whichever
modules and kernel are selected.
Finally, by default, the loader issues a 10 second wait for key presses, and
boots the kernel if it is not interrupted. If interrupted, the user is
presented with a prompt which understands the easy-to-use command set, where
the user may adjust variables, unload all modules, load modules, and then
finally boot or reboot.
The easy-to-use command set for "loader" comprises of:
autoboot seconds
Proceeds to boot the kernel if not interrupted within the time span
given, in seconds. It displays a countdown, and the default timespan
is 10 seconds.
boot [-options] [kernelname]
Immediately proceeds to boot the kernel, with the given options, if
any, and with the kernel name given, if it is.
boot-conf
Goes through the same automatic configuration of modules based on
variables as what happens at boot. This only makes sense if you use
unload first, and change some variables, most commonly kernel.
help [topic]
Shows help messages read from /boot/loader.help. If the topic given
is index, then the list of available topics is given.
include filename ...
Processes the file with the given filename. The file is read in, and
interpreted line by line. An error immediately stops the include command.
load [-t type] filename
Loads the kernel, kernel module, or file of the type given, with the
filename given. Any arguments after filename are passed to the file.
ls [-l] [path]
Displays a listing of files in the given path, or the root directory,
if the path is not specified. If -l is specified, file sizes will be
shown too.
lsdev [-v]
Lists all of the devices from which it may be possible to load modules.
If -v is specified, more details are printed.
lsmod [-v]
Displays loaded modules. If -v is specified, more details are shown.
more filename
Display the files specified, with a pause at each LINES displayed.
reboot
Immediately reboots the system.
set variable, set variable=value
Set loader's environment variables.
unload
Removes all loaded modules.
-------------------------------------------------------------------------------------
To simply boot your usual kernel, but in single-user mode:
boot -s
To unload your usual kernel and modules, and then load just your old
(or another) kernel:
unload
load kernel.old
You can use kernel.GENERIC to refer to the generic kernel that comes on the
install disk, or kernel.old to refer to your previously installed kernel
(when you've upgraded or configured your own kernel, for example).
Note: Use the following to load your usual modules with another
kernel:
unload
set kernel="kernel.old"
boot-conf
To load a kernel configuration script (an automated script which does the
things you'd normally do in the kernel boot-time configurator):
load -t userconfig_script
/boot/kernel.conf
-------------------------------------------------------------------------------------
Kernel Boot Flags
Here are the more common boot flags:
-a
during kernel initialization, ask for the device to mount as as the
root file system.
-C
boot from CDROM.
-c
run UserConfig, the boot-time kernel configurator
-s
boot into single-user mode
-v
be more verbose during kernel startup
Note: There are other boot flags, read boot(8) for more information on them.