---
name: "loader"
section: "8"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/loader"
---

# loader(8)

kernel bootstrapping final stage

## NAME

**loader** – kernel bootstrapping final stage

## DESCRIPTION

The program called **loader** is the final stage of FreeBSD's kernel bootstrapping process. It is responsible for bringing the kernel, kernel modules and other files into memory. It creates a set of [sh(1)](/sh/1.md) like environment variables that are passed to the kernel. It executes boot scripts written in one of several interpreters. Together with the scripts, it controls the booting process and interaction with the user.

It provides a scripting language that can be used to automate tasks, do pre-configuration or assist in recovery procedures. This scripting language is roughly divided in two main components. The smaller one is a set of commands designed for direct use by the casual user, called "builtin commands" for historical reasons. The main drive behind these commands is user-friendliness. The larger component is the scripting language built into the boot loader. FreeBSD provides three different interpreters: Forth, Lua and Simple. The Forth loader is based on an ANS Forth compatible Forth interpreter based on FICL, by John Sadler. The Lua loader is a full Lua interpreter from *https://www.lua.org/*. The Simple loader only interprets a list of builtin commands without any control structure.

During initialization, **loader** will probe for a console and set the *console* variable, or set it to serial console (“comconsole”) if the previous boot stage used that. If multiple consoles are selected, they will be listed separated by spaces. Then, devices are probed, *currdev* and *loaddev* are set, and *LINES* is set to 24. Finally, an interpreter specific file will be executed.

## BUILTIN COMMANDS

The commands common to all interpreters are described in the [loader\_simp(8)](/loader_simp/8.md) “BUILTIN COMMANDS” section.

The following commands are only available in [loader\_lua(8)](/loader_lua/8.md) and [loader\_4th(8)](/loader_4th/8.md):

- **be-list**

  Lists the boot environments that are visible to **loader**. The listed names may be used directly with **be-switch**.

- **be-switch** *beName*

  Switch to the *beName* boot environment. The **loader** configuration will be reloaded from the new root, and any previously loaded kernel and modules will be immediately unloaded.

- **boot-conf**

  Load the **loader** config and commence the autoboot sequence.

- **read-conf** *file*

  Load the specified configuration file.

- **reload-conf**

  Revert any previously applied settings, and reload the configuration. Set comands that were executed at the command line to override variables previously **set** by [loader.conf(5)](/loader.conf/5.md) configuration will also be reverted, along with any module options that were toggled.

- **enable-module** *kmod-name*

  - **disable-module** *kmod-name*

  - **toggle-module** *kmod-name*

  Enable, disable, or toggle loading of the kernel module named “*kmod-name*”.

- **show-module-options**

  Describe all modules the **loader** is aware of, and show if they are enabled or not.

The following command is only available in [loader\_lua(8)](/loader_lua/8.md):

- **disable-device** *device*

  Set a newbus hint to disable the *device*.

### BUILTIN ENVIRONMENT VARIABLES

The environment variables common to all interpreters are described in the [loader\_simp(8)](/loader_simp/8.md) “BUILTIN ENVIRONMENT VARIABLES” section.

## SEE ALSO

[libsa(3)](/libsa/3.md), [loader.conf(5)](/loader.conf/5.md), [tuning(7)](/tuning/7.md), [boot(8)](/boot/8.md), [btxld(8)](/btxld/8.md), [loader.efi(8)](/loader.efi/8.md), [loader\_4th(8)](/loader_4th/8.md), [loader\_lua(8)](/loader_lua/8.md), [loader\_simp(8)](/loader_simp/8.md)

## HISTORY

The **loader** first appeared in FreeBSD 3.1. The **loader** scripting language changed to Lua by default in FreeBSD 12.0.

## AUTHORS

The **loader** was written by Michael Smith ⟨*msmith@FreeBSD.org*⟩.

FICL was written by John Sadler ⟨*john\_sadler@alum.mit.edu*⟩.

Warner Losh ⟨*imp@FreeBSD.org*⟩ integrated Lua into the tree based on initial work done by Pedro Souza for the 2014 Google Summer of Code.
