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.\" 269e1dc7beSWarner Losh.Dd September 29, 2021 27ca987d46SWarner Losh.Dt LOADER 8 28ca987d46SWarner Losh.Os 29ca987d46SWarner Losh.Sh NAME 30ca987d46SWarner Losh.Nm loader 31ca987d46SWarner Losh.Nd kernel bootstrapping final stage 32ca987d46SWarner Losh.Sh DESCRIPTION 33ca987d46SWarner LoshThe program called 34ca987d46SWarner Losh.Nm 35ca987d46SWarner Loshis the final stage of 36ca987d46SWarner Losh.Fx Ns 's 37ca987d46SWarner Loshkernel bootstrapping process. 389e1dc7beSWarner LoshIt is responsible for bringing the kernel, kernel modules and other files into 399e1dc7beSWarner Loshmemory. 409e1dc7beSWarner LoshIt creates a set of 419e1dc7beSWarner Losh.Xr sh 1 429e1dc7beSWarner Loshlike environment variables that are passed to the kernel. 439e1dc7beSWarner LoshIt executes boot scripts written in one of several interpreters. 449e1dc7beSWarner LoshTogether with the scripts, it controls the booting process and 459e1dc7beSWarner Loshinteraction with the user. 46ca987d46SWarner Losh.Pp 47ca987d46SWarner LoshIt provides a scripting language that can be used to 48ca987d46SWarner Loshautomate tasks, do pre-configuration or assist in recovery 49ca987d46SWarner Loshprocedures. 50ca987d46SWarner LoshThis scripting language is roughly divided in 51ca987d46SWarner Loshtwo main components. 52ca987d46SWarner LoshThe smaller one is a set of commands 53ca987d46SWarner Loshdesigned for direct use by the casual user, called "builtin 54ca987d46SWarner Loshcommands" for historical reasons. 55ca987d46SWarner LoshThe main drive behind these commands is user-friendliness. 569e1dc7beSWarner LoshThe larger component is the scripting language built into 579e1dc7beSWarner Loshthe boot loader. 589e1dc7beSWarner Losh.Fx 599e1dc7beSWarner Loshprovides three different interpreters: Forth, Lua and Simple. 609e1dc7beSWarner LoshThe Forth loader is based on an ANS Forth compatible 619e1dc7beSWarner LoshForth interpreter based on FICL, by 62ca987d46SWarner Losh.An John Sadler . 63f7b0434dSJens SchweikhardtThe Lua loader is a full Lua interpreter from 649e1dc7beSWarner Losh.Pa https://www.lua.org/ . 659e1dc7beSWarner LoshThe Simple loader only interprets a list of builtin commands 669e1dc7beSWarner Loshwithout any control structure. 67ca987d46SWarner Losh.Pp 68ca987d46SWarner LoshDuring initialization, 69ca987d46SWarner Losh.Nm 70ca987d46SWarner Loshwill probe for a console and set the 71ca987d46SWarner Losh.Va console 72ca987d46SWarner Loshvariable, or set it to serial console 73ca987d46SWarner Losh.Pq Dq Li comconsole 74ca987d46SWarner Loshif the previous boot stage used that. 75ca987d46SWarner LoshIf multiple consoles are selected, they will be listed separated by spaces. 76ca987d46SWarner LoshThen, devices are probed, 77ca987d46SWarner Losh.Va currdev 78ca987d46SWarner Loshand 79ca987d46SWarner Losh.Va loaddev 80ca987d46SWarner Loshare set, and 81ca987d46SWarner Losh.Va LINES 82ca987d46SWarner Loshis set to 24. 839e1dc7beSWarner LoshFinally, an interpreter specific file will be executed. 84ca987d46SWarner Losh.Sh BUILTIN COMMANDS 859e1dc7beSWarner LoshThe commands common to all interpreters are described in the 869e1dc7beSWarner Losh.Xr loader_simp 8 879e1dc7beSWarner Losh.Dq BUILTIN COMMANDS 88ca987d46SWarner Loshsection. 899e1dc7beSWarner Losh.Ss BUILTIN ENVIRONMENT VARIABLES 909e1dc7beSWarner LoshThe environment variables common to all interpreters are described in the 919e1dc7beSWarner Losh.Xr loader_simp 8 929e1dc7beSWarner Losh.Dq BUILTIN ENVIRONMENT VARIABLES 939e1dc7beSWarner Loshsection. 94ca987d46SWarner Losh.Sh SEE ALSO 95*11f49259SWarner Losh.Xr libsa 3 , 96ca987d46SWarner Losh.Xr loader.conf 5 , 97ca987d46SWarner Losh.Xr tuning 7 , 98ca987d46SWarner Losh.Xr boot 8 , 999e1dc7beSWarner Losh.Xr btxld 8 , 1009e1dc7beSWarner Losh.Xr loader.efi 8 , 1019e1dc7beSWarner Losh.Xr loader_4th 8 , 1029e1dc7beSWarner Losh.Xr loader_lua 8 , 1039e1dc7beSWarner Losh.Xr loader_simp 8 104ca987d46SWarner Losh.Sh HISTORY 105ca987d46SWarner LoshThe 106ca987d46SWarner Losh.Nm 107ca987d46SWarner Loshfirst appeared in 108ca987d46SWarner Losh.Fx 3.1 . 1099e1dc7beSWarner LoshThe 1109e1dc7beSWarner Losh.Nm 1119e1dc7beSWarner Loshscripting language changed to Lua by default in 1129e1dc7beSWarner Losh.Fx 12.0 . 113ca987d46SWarner Losh.Sh AUTHORS 114ca987d46SWarner Losh.An -nosplit 115ca987d46SWarner LoshThe 116ca987d46SWarner Losh.Nm 117ca987d46SWarner Loshwas written by 118ca987d46SWarner Losh.An Michael Smith Aq msmith@FreeBSD.org . 119ca987d46SWarner Losh.Pp 1209e1dc7beSWarner LoshFICL was written by 121ca987d46SWarner Losh.An John Sadler Aq john_sadler@alum.mit.edu . 1229e1dc7beSWarner Losh.Pp 1239e1dc7beSWarner Losh.An Warner Losh Aq imp@FreeBSD.org 1249e1dc7beSWarner Loshintegrated Lua into the tree based on initial work done by Pedro Souza 1259e1dc7beSWarner Loshfor the 2014 Google Summer of Code. 126