1ca987d46SWarner Losh.\" Copyright (c) 1999 Daniel C. Sobral 2ca987d46SWarner Losh.\" All rights reserved. 39e1dc7beSWarner Losh.\" Copyright (c) 2021 Warner Losh <imp@FreeBSD.org> 4ca987d46SWarner Losh.\" 5ca987d46SWarner Losh.\" Redistribution and use in source and binary forms, with or without 6ca987d46SWarner Losh.\" modification, are permitted provided that the following conditions 7ca987d46SWarner Losh.\" are met: 8ca987d46SWarner Losh.\" 1. Redistributions of source code must retain the above copyright 9ca987d46SWarner Losh.\" notice, this list of conditions and the following disclaimer. 10ca987d46SWarner Losh.\" 2. Redistributions in binary form must reproduce the above copyright 11ca987d46SWarner Losh.\" notice, this list of conditions and the following disclaimer in the 12ca987d46SWarner Losh.\" documentation and/or other materials provided with the distribution. 13ca987d46SWarner Losh.\" 14ca987d46SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15ca987d46SWarner Losh.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16ca987d46SWarner Losh.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17ca987d46SWarner Losh.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18ca987d46SWarner Losh.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19ca987d46SWarner Losh.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20ca987d46SWarner Losh.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21ca987d46SWarner Losh.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22ca987d46SWarner Losh.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23ca987d46SWarner Losh.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24ca987d46SWarner Losh.\" SUCH DAMAGE. 25ca987d46SWarner Losh.\" 26ca987d46SWarner Losh.\" $FreeBSD$ 27ca987d46SWarner Losh.\" 289e1dc7beSWarner Losh.Dd September 29, 2021 29ca987d46SWarner Losh.Dt LOADER 8 30ca987d46SWarner Losh.Os 31ca987d46SWarner Losh.Sh NAME 32ca987d46SWarner Losh.Nm loader 33ca987d46SWarner Losh.Nd kernel bootstrapping final stage 34ca987d46SWarner Losh.Sh DESCRIPTION 35ca987d46SWarner LoshThe program called 36ca987d46SWarner Losh.Nm 37ca987d46SWarner Loshis the final stage of 38ca987d46SWarner Losh.Fx Ns 's 39ca987d46SWarner Loshkernel bootstrapping process. 409e1dc7beSWarner LoshIt is responsible for bringing the kernel, kernel modules and other files into 419e1dc7beSWarner Loshmemory. 429e1dc7beSWarner LoshIt creates a set of 439e1dc7beSWarner Losh.Xr sh 1 449e1dc7beSWarner Loshlike environment variables that are passed to the kernel. 459e1dc7beSWarner LoshIt executes boot scripts written in one of several interpreters. 469e1dc7beSWarner LoshTogether with the scripts, it controls the booting process and 479e1dc7beSWarner Loshinteraction with the user. 48ca987d46SWarner Losh.Pp 49ca987d46SWarner LoshIt provides a scripting language that can be used to 50ca987d46SWarner Loshautomate tasks, do pre-configuration or assist in recovery 51ca987d46SWarner Loshprocedures. 52ca987d46SWarner LoshThis scripting language is roughly divided in 53ca987d46SWarner Loshtwo main components. 54ca987d46SWarner LoshThe smaller one is a set of commands 55ca987d46SWarner Loshdesigned for direct use by the casual user, called "builtin 56ca987d46SWarner Loshcommands" for historical reasons. 57ca987d46SWarner LoshThe main drive behind these commands is user-friendliness. 589e1dc7beSWarner LoshThe larger component is the scripting language built into 599e1dc7beSWarner Loshthe boot loader. 609e1dc7beSWarner Losh.Fx 619e1dc7beSWarner Loshprovides three different interpreters: Forth, Lua and Simple. 629e1dc7beSWarner LoshThe Forth loader is based on an ANS Forth compatible 639e1dc7beSWarner LoshForth interpreter based on FICL, by 64ca987d46SWarner Losh.An John Sadler . 65f7b0434dSJens SchweikhardtThe Lua loader is a full Lua interpreter from 669e1dc7beSWarner Losh.Pa https://www.lua.org/ . 679e1dc7beSWarner LoshThe Simple loader only interprets a list of builtin commands 689e1dc7beSWarner Loshwithout any control structure. 69ca987d46SWarner Losh.Pp 70ca987d46SWarner LoshDuring initialization, 71ca987d46SWarner Losh.Nm 72ca987d46SWarner Loshwill probe for a console and set the 73ca987d46SWarner Losh.Va console 74ca987d46SWarner Loshvariable, or set it to serial console 75ca987d46SWarner Losh.Pq Dq Li comconsole 76ca987d46SWarner Loshif the previous boot stage used that. 77ca987d46SWarner LoshIf multiple consoles are selected, they will be listed separated by spaces. 78ca987d46SWarner LoshThen, devices are probed, 79ca987d46SWarner Losh.Va currdev 80ca987d46SWarner Loshand 81ca987d46SWarner Losh.Va loaddev 82ca987d46SWarner Loshare set, and 83ca987d46SWarner Losh.Va LINES 84ca987d46SWarner Loshis set to 24. 859e1dc7beSWarner LoshFinally, an interpreter specific file will be executed. 86ca987d46SWarner Losh.Sh BUILTIN COMMANDS 879e1dc7beSWarner LoshThe commands common to all interpreters are described in the 889e1dc7beSWarner Losh.Xr loader_simp 8 899e1dc7beSWarner Losh.Dq BUILTIN COMMANDS 90ca987d46SWarner Loshsection. 919e1dc7beSWarner Losh.Ss BUILTIN ENVIRONMENT VARIABLES 929e1dc7beSWarner LoshThe environment variables common to all interpreters are described in the 939e1dc7beSWarner Losh.Xr loader_simp 8 949e1dc7beSWarner Losh.Dq BUILTIN ENVIRONMENT VARIABLES 959e1dc7beSWarner Loshsection. 96ca987d46SWarner Losh.Sh SEE ALSO 97*11f49259SWarner Losh.Xr libsa 3 , 98ca987d46SWarner Losh.Xr loader.conf 5 , 99ca987d46SWarner Losh.Xr tuning 7 , 100ca987d46SWarner Losh.Xr boot 8 , 1019e1dc7beSWarner Losh.Xr btxld 8 , 1029e1dc7beSWarner Losh.Xr loader.efi 8 , 1039e1dc7beSWarner Losh.Xr loader_4th 8 , 1049e1dc7beSWarner Losh.Xr loader_lua 8 , 1059e1dc7beSWarner Losh.Xr loader_simp 8 106ca987d46SWarner Losh.Sh HISTORY 107ca987d46SWarner LoshThe 108ca987d46SWarner Losh.Nm 109ca987d46SWarner Loshfirst appeared in 110ca987d46SWarner Losh.Fx 3.1 . 1119e1dc7beSWarner LoshThe 1129e1dc7beSWarner Losh.Nm 1139e1dc7beSWarner Loshscripting language changed to Lua by default in 1149e1dc7beSWarner Losh.Fx 12.0 . 115ca987d46SWarner Losh.Sh AUTHORS 116ca987d46SWarner Losh.An -nosplit 117ca987d46SWarner LoshThe 118ca987d46SWarner Losh.Nm 119ca987d46SWarner Loshwas written by 120ca987d46SWarner Losh.An Michael Smith Aq msmith@FreeBSD.org . 121ca987d46SWarner Losh.Pp 1229e1dc7beSWarner LoshFICL was written by 123ca987d46SWarner Losh.An John Sadler Aq john_sadler@alum.mit.edu . 1249e1dc7beSWarner Losh.Pp 1259e1dc7beSWarner Losh.An Warner Losh Aq imp@FreeBSD.org 1269e1dc7beSWarner Loshintegrated Lua into the tree based on initial work done by Pedro Souza 1279e1dc7beSWarner Loshfor the 2014 Google Summer of Code. 128