xref: /freebsd/stand/man/loader.8 (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
1.\" Copyright (c) 1999 Daniel C. Sobral
2.\" All rights reserved.
3.\" Copyright (c) 2021 Warner Losh <imp@FreeBSD.org>
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd September 29, 2021
27.Dt LOADER 8
28.Os
29.Sh NAME
30.Nm loader
31.Nd kernel bootstrapping final stage
32.Sh DESCRIPTION
33The program called
34.Nm
35is the final stage of
36.Fx Ns 's
37kernel bootstrapping process.
38It is responsible for bringing the kernel, kernel modules and other files into
39memory.
40It creates a set of
41.Xr sh 1
42like environment variables that are passed to the kernel.
43It executes boot scripts written in one of several interpreters.
44Together with the scripts, it controls the booting process and
45interaction with the user.
46.Pp
47It provides a scripting language that can be used to
48automate tasks, do pre-configuration or assist in recovery
49procedures.
50This scripting language is roughly divided in
51two main components.
52The smaller one is a set of commands
53designed for direct use by the casual user, called "builtin
54commands" for historical reasons.
55The main drive behind these commands is user-friendliness.
56The larger component is the scripting language built into
57the boot loader.
58.Fx
59provides three different interpreters: Forth, Lua and Simple.
60The Forth loader is based on an ANS Forth compatible
61Forth interpreter based on FICL, by
62.An John Sadler .
63The Lua loader is a full Lua interpreter from
64.Pa https://www.lua.org/ .
65The Simple loader only interprets a list of builtin commands
66without any control structure.
67.Pp
68During initialization,
69.Nm
70will probe for a console and set the
71.Va console
72variable, or set it to serial console
73.Pq Dq Li comconsole
74if the previous boot stage used that.
75If multiple consoles are selected, they will be listed separated by spaces.
76Then, devices are probed,
77.Va currdev
78and
79.Va loaddev
80are set, and
81.Va LINES
82is set to 24.
83Finally, an interpreter specific file will be executed.
84.Sh BUILTIN COMMANDS
85The commands common to all interpreters are described in the
86.Xr loader_simp 8
87.Dq BUILTIN COMMANDS
88section.
89.Ss BUILTIN ENVIRONMENT VARIABLES
90The environment variables common to all interpreters are described in the
91.Xr loader_simp 8
92.Dq BUILTIN ENVIRONMENT VARIABLES
93section.
94.Sh SEE ALSO
95.Xr libsa 3 ,
96.Xr loader.conf 5 ,
97.Xr tuning 7 ,
98.Xr boot 8 ,
99.Xr btxld 8 ,
100.Xr loader.efi 8 ,
101.Xr loader_4th 8 ,
102.Xr loader_lua 8 ,
103.Xr loader_simp 8
104.Sh HISTORY
105The
106.Nm
107first appeared in
108.Fx 3.1 .
109The
110.Nm
111scripting language changed to Lua by default in
112.Fx 12.0 .
113.Sh AUTHORS
114.An -nosplit
115The
116.Nm
117was written by
118.An Michael Smith Aq msmith@FreeBSD.org .
119.Pp
120FICL was written by
121.An John Sadler Aq john_sadler@alum.mit.edu .
122.Pp
123.An Warner Losh Aq imp@FreeBSD.org
124integrated Lua into the tree based on initial work done by Pedro Souza
125for the 2014 Google Summer of Code.
126