xref: /freebsd-13.1/stand/lua/core.lua.8 (revision 1a14a0bf)
1913bd098SKyle Evans.\"
2913bd098SKyle Evans.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3913bd098SKyle Evans.\"
4913bd098SKyle Evans.\" Copyright (c) 2018 Kyle Evans <[email protected]>
5913bd098SKyle Evans.\"
6913bd098SKyle Evans.\" Redistribution and use in source and binary forms, with or without
7913bd098SKyle Evans.\" modification, are permitted provided that the following conditions
8913bd098SKyle Evans.\" are met:
9913bd098SKyle Evans.\" 1. Redistributions of source code must retain the above copyright
10913bd098SKyle Evans.\"    notice, this list of conditions and the following disclaimer.
11913bd098SKyle Evans.\" 2. Redistributions in binary form must reproduce the above copyright
12913bd098SKyle Evans.\"    notice, this list of conditions and the following disclaimer in the
13913bd098SKyle Evans.\"    documentation and/or other materials provided with the distribution.
14913bd098SKyle Evans.\"
15913bd098SKyle Evans.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16913bd098SKyle Evans.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17913bd098SKyle Evans.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18913bd098SKyle Evans.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19913bd098SKyle Evans.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20913bd098SKyle Evans.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21913bd098SKyle Evans.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22913bd098SKyle Evans.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23913bd098SKyle Evans.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24913bd098SKyle Evans.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25913bd098SKyle Evans.\" SUCH DAMAGE.
26913bd098SKyle Evans.\"
27913bd098SKyle Evans.\" $FreeBSD$
28913bd098SKyle Evans.\"
295a79ea48SKyle Evans.Dd March 21, 2018
30913bd098SKyle Evans.Dt CORE.LUA 8
31913bd098SKyle Evans.Os
32913bd098SKyle Evans.Sh NAME
33913bd098SKyle Evans.Nm core.lua
34913bd098SKyle Evans.Nd FreeBSD core module
35913bd098SKyle Evans.Sh DESCRIPTION
36913bd098SKyle Evans.Nm
37913bd098SKyle Evanscontains core functionality that does not have a more fitting module.
38913bd098SKyle Evans.Pp
39913bd098SKyle EvansBefore hooking into or using the functionality provided by
40913bd098SKyle Evans.Nm ,
41913bd098SKyle Evansit must be included with a statement such as the following:
42913bd098SKyle Evans.Pp
43913bd098SKyle Evans.Dl local core = require("core")
44913bd098SKyle Evans.Ss CONSTANTS
45913bd098SKyle EvansThe following raw key code constants are defined in
46913bd098SKyle Evans.Nm :
47913bd098SKyle Evans.Bl -tag -width KEY_BACKSPACE -compact -offset indent
48913bd098SKyle Evans.It Ic KEY_BACKSPACE
49913bd098SKyle EvansThe backspace code.
50913bd098SKyle EvansShould generally be checked along with
51913bd098SKyle Evans.Ic KEY_DELETE
52913bd098SKyle Evansfor backspace functionality.
53913bd098SKyle Evans.It Ic KEY_ENTER
54913bd098SKyle EvansThe enter key, or hard return.
55913bd098SKyle Evans.It Ic KEY_DELETE
56913bd098SKyle EvansThe delete code.
57913bd098SKyle EvansShould generally be checked along with
58913bd098SKyle Evans.Ic KEY_BACKSPACE
59913bd098SKyle Evansfor backspace functionality.
60913bd098SKyle Evans.El
61913bd098SKyle Evans.Pp
62913bd098SKyle EvansThe following key-string constants are defined in
63913bd098SKyle Evans.Nm :
64913bd098SKyle Evans.Bl -tag -width KEYSTR_ESCAPE -compact -offset indent
65913bd098SKyle Evans.It Ic KEYSTR_ESCAPE
66913bd098SKyle EvansThe escape key.
679eded7f4SKyle Evans.It Ic KEYSTR_CSI
689eded7f4SKyle EvansThe ANSI CSI sequence.
69913bd098SKyle Evans.El
70913bd098SKyle Evans.Pp
71913bd098SKyle EvansThe following menu entry type constants are defined in
72913bd098SKyle Evans.Nm :
73913bd098SKyle Evans.Bl -tag -width MENU_CAROUSEL_ENTRY -compact -offset indent
74913bd098SKyle Evans.It Ic MENU_RETURN
75913bd098SKyle EvansReturn to the parent menu.
76913bd098SKyle Evans.It Ic MENU_ENTRY
77913bd098SKyle EvansA normal menu entry.
78913bd098SKyle Evans.It Ic MENU_SEPARATOR
79913bd098SKyle EvansA menu entry that serves as a separator.
80913bd098SKyle Evans.It Ic MENU_SUBMENU
81913bd098SKyle EvansA menu entry that opens a submenu when selected.
82913bd098SKyle Evans.It Ic MENU_CAROUSEL_ENTRY
83913bd098SKyle EvansA menu entry that rotates through items like a carousel upon selection of the
84913bd098SKyle Evansmenu entry.
85913bd098SKyle Evans.El
86913bd098SKyle Evans.Pp
87913bd098SKyle EvansPlease see
88913bd098SKyle Evans.Xr menu.lua 8
89913bd098SKyle Evansfor extended descriptions and usage of the
90913bd098SKyle Evans.Ic MENU_*
91913bd098SKyle Evansconstants.
92913bd098SKyle Evans.Ss Exported functions
93913bd098SKyle EvansThe following functions are exported from
94913bd098SKyle Evans.Nm :
95913bd098SKyle Evans.Bl -tag -width core.getACPIPresent -offset indent
96913bd098SKyle Evans.It Fn core.setVerbose verbose
97913bd098SKyle EvansSets or unsets
98913bd098SKyle Evans.Ev boot_verbose .
99913bd098SKyle EvansIf
100913bd098SKyle Evans.Fa verbose
101913bd098SKyle Evansis omitted, toggle the current verbose setting.
102913bd098SKyle Evans.It Fn core.setSingleUser singleUser
103913bd098SKyle EvansSets or unsets
104913bd098SKyle Evans.Ev boot_single .
105913bd098SKyle EvansIf
106913bd098SKyle Evans.Fa singleUser
107913bd098SKyle Evansis omitted, toggle the current single user setting.
108913bd098SKyle Evans.It Fn core.getACPIPresent checkingSystemDefaults
109913bd098SKyle EvansCheck whether ACPI is present.
110913bd098SKyle EvansThis will only be accurate for i386-compatible loaders, including non-UEFI
111913bd098SKyle Evansloaders on amd64 systems.
112913bd098SKyle EvansIf
113913bd098SKyle Evans.Fa checkingSystemDefaults
114913bd098SKyle Evansis true, ignore the current value of
115913bd098SKyle Evans.Ev hint.acpi.0.disabled .
116913bd098SKyle EvansOtherwise, return true only if ACPI is both present and not disabled.
117913bd098SKyle Evans.It Fn core.setACPI acpi
118913bd098SKyle EvansSets or unsets
119913bd098SKyle Evans.Ev acpi_load ,
120913bd098SKyle Evans.Ev hint.acpi.0.disabled ,
121913bd098SKyle Evansand
122913bd098SKyle Evans.Ev loader.acpi_disabled_by_user .
123913bd098SKyle EvansIf
124913bd098SKyle Evans.Fa acpi
125913bd098SKyle Evansis omitted, toggle the current ACPI setting.
126913bd098SKyle Evans.It Fn core.setSafeMode safeMode
127913bd098SKyle EvansSet the safe mode setting.
128913bd098SKyle EvansSets or unsets
129913bd098SKyle Evans.Ev kern.smp.disabled ,
130913bd098SKyle Evans.Ev hw.ata.ata_dma ,
131913bd098SKyle Evans.Ev hw.ata.atapi_dma ,
132913bd098SKyle Evans.Ev hw.ata.wc ,
133913bd098SKyle Evans.Ev hw.eisa_slots ,
134913bd098SKyle Evans.Ev kern.eventtimer.periodic ,
135913bd098SKyle Evansand
136913bd098SKyle Evans.Ev kern.geom.part.check_integrity .
137913bd098SKyle EvansIf
138913bd098SKyle Evans.Fa safeMode
139913bd098SKyle Evansis omitted, toggle the current safe mode setting.
1405a79ea48SKyle Evans.It Fn core.clearCachedKernels
1415a79ea48SKyle EvansClears out the cache of kernels to be displayed on the boot menu.
1425a79ea48SKyle EvansThis function is registered as a
1435a79ea48SKyle Evans.Ev config.reloaded
1445a79ea48SKyle Evanshook.
1455a79ea48SKyle EvansIt is used to invalidate the kernel list whenever it may have changed, either
1465a79ea48SKyle Evansdue to a boot environment change or a potential change in either
1475a79ea48SKyle Evans.Ic kernel
1485a79ea48SKyle Evansor
1495a79ea48SKyle Evans.Ic kernels .
150913bd098SKyle Evans.It Fn core.kernelList
151913bd098SKyle EvansReturns a table of kernels to display on the boot menu.
152913bd098SKyle EvansThis will combine
153913bd098SKyle Evans.Ic kernel
154913bd098SKyle Evansand
155913bd098SKyle Evans.Ic kernels
156913bd098SKyle Evansfrom
157913bd098SKyle Evans.Xr loader.conf 5 .
158913bd098SKyle EvansIf
159913bd098SKyle Evans.Ic kernels_autodetect
160913bd098SKyle Evansis set in
161913bd098SKyle Evans.Xr loader.conf 5 ,
162913bd098SKyle Evanskernels will be autodetected from the current system.
163913bd098SKyle Evans.It Fn core.bootenvDefault
164913bd098SKyle EvansReturns the default boot environment, nil if unset.
165913bd098SKyle Evans.It Fn core.bootenvList
166913bd098SKyle EvansReturns a table of boot environments, or an empty table.
167913bd098SKyle EvansThese will be picked up using the
168913bd098SKyle Evans.Ev bootenvs
169913bd098SKyle Evansand
170913bd098SKyle Evans.Ev bootenvs_count
171913bd098SKyle Evansvariables set by
172*1a14a0bfSWarner Losh.Xr loader 8 .
173913bd098SKyle Evans.It Fn core.setDefaults
174913bd098SKyle EvansResets ACPI, safe mode, single user, and verbose settings to their system
175913bd098SKyle Evansdefauilts.
176913bd098SKyle Evans.It Fn core.autoboot argstr
177913bd098SKyle EvansLoads the kernel and specified modules, then invokes the
178913bd098SKyle Evans.Ic autoboot
179913bd098SKyle Evans.Xr loader 8
180913bd098SKyle Evanscommand with
181913bd098SKyle Evans.Fa argstr
182913bd098SKyle Evansas-is.
183913bd098SKyle Evans.It Fn core.boot argstr
184913bd098SKyle EvansLoads the kernel and specified modules, then invokes the
185913bd098SKyle Evans.Ic boot
186913bd098SKyle Evans.Xr loader 8
187913bd098SKyle Evanscommand with
188913bd098SKyle Evans.Fa argstr
189913bd098SKyle Evansas-is.
190913bd098SKyle Evans.It Fn core.isSingleUserBoot
191913bd098SKyle EvansReturns true if
192913bd098SKyle Evans.Ev boot_single
193913bd098SKyle Evansis set to yes.
194913bd098SKyle Evans.It Fn core.isZFSBoot
195913bd098SKyle EvansReturns true if
196913bd098SKyle Evans.Ev currdev
197913bd098SKyle Evansis set to a
198913bd098SKyle Evans.Xr zfs 8
199913bd098SKyle Evansdataset.
200913bd098SKyle Evans.It Fn core.isSerialBoot
201913bd098SKyle EvansReturns true if we are booting over serial.
202913bd098SKyle EvansThis checks
203913bd098SKyle Evans.Ev console ,
204913bd098SKyle Evans.Ev boot_serial ,
205913bd098SKyle Evansand
206913bd098SKyle Evans.Ev boot_multicons .
207913bd098SKyle Evans.It Fn core.isSystem386
208913bd098SKyle EvansReturns true if this bootloader was compiled as an i386 binary.
209913bd098SKyle EvansThis generally applies to i386 loaders as well as non-UEFI loaders on amd64.
210913bd098SKyle Evans.It Fn core.deepCopyTable tbl
211913bd098SKyle EvansRecursively deep copies
212913bd098SKyle Evans.Fa tbl
213913bd098SKyle Evansand returns the result.
214913bd098SKyle Evans.It Fn core.popFrontTable tbl
215913bd098SKyle EvansPops the front element off of
216913bd098SKyle Evans.Fa tbl ,
217913bd098SKyle Evansand returns two return values: the front element, and the rest of the table.
218913bd098SKyle EvansIf there are no elements, this returns nil and nil.
219913bd098SKyle EvansIf there is one element, this returns the front element and an empty table.
220913bd098SKyle EvansThis will not operate on truly associative tables; numeric indices are
221913bd098SKyle Evansrequired.
222913bd098SKyle Evans.El
223913bd098SKyle Evans.Sh SEE ALSO
224913bd098SKyle Evans.Xr loader.conf 5 ,
225913bd098SKyle Evans.Xr loader 8 ,
226913bd098SKyle Evans.Xr menu.lua 8
227913bd098SKyle Evans.Sh AUTHORS
228913bd098SKyle EvansThe
229913bd098SKyle Evans.Nm
230913bd098SKyle Evansfile was originally written by
231913bd098SKyle Evans.An Pedro Souza Aq Mt [email protected] .
232913bd098SKyle EvansLater work and this manual page was done by
233913bd098SKyle Evans.An Kyle Evans Aq Mt [email protected] .
234