2 .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 .\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .Nd FreeBSD core module
37 contains core functionality that does not have a more fitting module.
39 Before hooking into or using the functionality provided by
41 it must be included with a statement such as the following:
43 .Dl local core = require("core")
45 The following raw key code constants are defined in
47 .Bl -tag -width KEY_BACKSPACE -compact -offset indent
50 Should generally be checked along with
52 for backspace functionality.
54 The enter key, or hard return.
57 Should generally be checked along with
59 for backspace functionality.
62 The following key-string constants are defined in
64 .Bl -tag -width KEYSTR_ESCAPE -compact -offset indent
68 The ANSI CSI sequence.
71 The following menu entry type constants are defined in
73 .Bl -tag -width MENU_CAROUSEL_ENTRY -compact -offset indent
75 Return to the parent menu.
79 A menu entry that serves as a separator.
81 A menu entry that opens a submenu when selected.
82 .It Ic MENU_CAROUSEL_ENTRY
83 A menu entry that rotates through items like a carousel upon selection of the
89 for extended descriptions and usage of the
92 .Ss Exported functions
93 The following functions are exported from
95 .Bl -tag -width core.getACPIPresent -offset indent
96 .It Fn core.setVerbose verbose
101 is omitted, toggle the current verbose setting.
102 .It Fn core.setSingleUser singleUser
107 is omitted, toggle the current single user setting.
108 .It Fn core.getACPIPresent checkingSystemDefaults
109 Check whether ACPI is present.
110 This will only be accurate for i386-compatible loaders, including non-UEFI
111 loaders on amd64 systems.
113 .Fa checkingSystemDefaults
114 is true, ignore the current value of
115 .Ev hint.acpi.0.disabled .
116 Otherwise, return true only if ACPI is both present and not disabled.
117 .It Fn core.setACPI acpi
120 .Ev hint.acpi.0.disabled ,
122 .Ev loader.acpi_disabled_by_user .
125 is omitted, toggle the current ACPI setting.
126 .It Fn core.setSafeMode safeMode
127 Set the safe mode setting.
129 .Ev kern.smp.disabled ,
131 .Ev hw.ata.atapi_dma ,
134 .Ev kern.eventtimer.periodic ,
136 .Ev kern.geom.part.check_integrity .
139 is omitted, toggle the current safe mode setting.
140 .It Fn core.clearCachedKernels
141 Clears out the cache of kernels to be displayed on the boot menu.
142 This function is registered as a
145 It is used to invalidate the kernel list whenever it may have changed, either
146 due to a boot environment change or a potential change in either
150 .It Fn core.kernelList
151 Returns a table of kernels to display on the boot menu.
159 .Ic kernels_autodetect
162 kernels will be autodetected from the current system.
163 .It Fn core.bootenvDefault
164 Returns the default boot environment, nil if unset.
165 .It Fn core.bootenvList
166 Returns a table of boot environments, or an empty table.
167 These will be picked up using the
173 .It Fn core.setDefaults
174 Resets ACPI, safe mode, single user, and verbose settings to their system
176 .It Fn core.autoboot argstr
177 Loads the kernel and specified modules, then invokes the
183 .It Fn core.boot argstr
184 Loads the kernel and specified modules, then invokes the
190 .It Fn core.isSingleUserBoot
194 .It Fn core.isZFSBoot
200 .It Fn core.isSerialBoot
201 Returns true if we are booting over serial.
207 .It Fn core.isSystem386
208 Returns true if this bootloader was compiled as an i386 binary.
209 This generally applies to i386 loaders as well as non-UEFI loaders on amd64.
210 .It Fn core.deepCopyTable tbl
211 Recursively deep copies
213 and returns the result.
214 .It Fn core.popFrontTable tbl
215 Pops the front element off of
217 and returns two return values: the front element, and the rest of the table.
218 If there are no elements, this returns nil and nil.
219 If there is one element, this returns the front element and an empty table.
220 This will not operate on truly associative tables; numeric indices are
230 file was originally written by
231 .An Pedro Souza Aq Mt pedrosouza@FreeBSD.org .
232 Later work and this manual page was done by
233 .An Kyle Evans Aq Mt kevans@FreeBSD.org .