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