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 keypresses, and boots the kernel if it is 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.
A more technical discussion of the process is available in loader(8)
The easy-to-use command set comprises of:
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.
Immediately proceeds to boot the kernel, with the given options, if any, and with the kernel name given, if it is.
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.
Shows help messages read from /boot/loader.help. If the topic given is index, then the list of available topics is given.
Processes the file with the given filename. The file is read in, and interpreted line by line. An error immediately stops the include command.
Loads the kernel, kernel module, or file of the type given, with the filename given. Any arguments after filename are passed to the file.
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.
Lists all of the devices from which it may be possible to load modules. If -v is specified, more details are printed.
Displays loaded modules. If -v is specified, more details are shown.
Display the files specified, with a pause at each LINES displayed.
Immediately reboots the system.
Set loader's environment variables.
Removes all loaded modules.
Here are some practical examples of loader usage.
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
For questions about FreeBSD, e-mail
<questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.