summaryrefslogtreecommitdiff
path: root/stand/man/loader.8
blob: 484e0a7b300c136e405bd735f154ce9198b483f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 1999 Daniel C. Sobral
.\" All rights reserved.
.\" Copyright (c) 2021 Warner Losh <imp@FreeBSD.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd November 14, 2025
.Dt LOADER 8
.Os
.Sh NAME
.Nm loader
.Nd kernel bootstrapping final stage
.Sh DESCRIPTION
The program called
.Nm
is the final stage of
.Fx Ns 's
kernel bootstrapping process.
It is responsible for bringing the kernel, kernel modules and other files into
memory.
It creates a set of
.Xr sh 1
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.
.Pp
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.
.Fx
provides three different interpreters: Forth, Lua and Simple.
The Forth loader is based on an ANS Forth compatible
Forth interpreter based on FICL, by
.An John Sadler .
The Lua loader is a full Lua interpreter from
.Pa https://www.lua.org/ .
The Simple loader only interprets a list of builtin commands
without any control structure.
.Pp
During initialization,
.Nm
will probe for a console and set the
.Va console
variable, or set it to serial console
.Pq Dq Li comconsole
if the previous boot stage used that.
If multiple consoles are selected, they will be listed separated by spaces.
Then, devices are probed,
.Va currdev
and
.Va loaddev
are set, and
.Va LINES
is set to 24.
Finally, an interpreter specific file will be executed.
.Sh BUILTIN COMMANDS
The commands common to all interpreters are described in the
.Xr loader_simp 8
.Dq BUILTIN COMMANDS
section.
.Pp
The following commands are only available in
.Xr loader_lua 8
and
.Xr loader_4th 8 :
.Pp
.Bl -tag -width indent -compact
.\" sort the following entries according to the second field
.It Ic boot-conf
Load the
.Nm
config and commence the autoboot sequence.
.Pp
.It Ic read-conf Ar file
Load the specified configuration file.
.Pp
.It Ic reload-conf
Revert any previously applied settings, and reload the configuration.
Set comands that were executed at the command line to override variables
previously
.Cm set
by
.Xr loader.conf 5
configuration will also be reverted,
along with any module options that were toggled.
.Pp
.It Ic enable-module Ar kmod-name
.It Ic disable-module Ar kmod-name
.It Ic toggle-module Ar kmod-name
Enable, disable, or toggle loading of the kernel module named
.Dq Ar kmod-name .
.Pp
.It Ic show-module-options
Describe all modules the
.Nm
is aware of, and show if they are enabled or not.
.El
.Pp
The following command is only available in
.Xr loader_lua 8 :
.Pp
.Bl -tag -width indent -compact
.It Ic disable-device Ar device
Set a newbus hint to disable the
.Ar device .
.El
.Ss BUILTIN ENVIRONMENT VARIABLES
The environment variables common to all interpreters are described in the
.Xr loader_simp 8
.Dq BUILTIN ENVIRONMENT VARIABLES
section.
.Sh SEE ALSO
.Xr libsa 3 ,
.Xr loader.conf 5 ,
.Xr tuning 7 ,
.Xr boot 8 ,
.Xr btxld 8 ,
.Xr loader.efi 8 ,
.Xr loader_4th 8 ,
.Xr loader_lua 8 ,
.Xr loader_simp 8
.Sh HISTORY
The
.Nm
first appeared in
.Fx 3.1 .
The
.Nm
scripting language changed to Lua by default in
.Fx 12.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
was written by
.An Michael Smith Aq Mt msmith@FreeBSD.org .
.Pp
FICL was written by
.An John Sadler Aq Mt john_sadler@alum.mit.edu .
.Pp
.An Warner Losh Aq Mt imp@FreeBSD.org
integrated Lua into the tree based on initial work done by Pedro Souza
for the 2014 Google Summer of Code.