1 .\" Copyright (c) 2011-2013 Devin Teske
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .Nd FreeBSD dynamic menu boot module
32 The file that goes by the name of
34 is a set of commands designed to display a dynamic menu system managed through
35 a system of carefully named environment variables.
38 by themselves are not enough for most uses.
40 examples below for the most common situations, and to
42 for additional commands.
44 Before using any of the commands provided in
51 This line is present in the default
53 file, so it is not needed (and should not be re-issued) in a normal setup.
55 The commands provided by it are:
57 .Bl -tag -width disable-module_module -compact -offset indent
59 Draws the menu bounding box and initializes some internal state variables.
60 This should be called before any other menu-related functions.
62 Displays the menu (configured via the below documented environment variables)
63 and blocks on keyboard input, awaiting user action.
65 Clears the screen area within the menu bounding box.
69 and then redraws the menu.
71 Unsets the environment variables associated with individual menu items,
72 clearing the way for a new menu.
80 The environment variables that effect its behavior are:
81 .Bl -tag -width bootfile -offset indent
87 causes the menu to be displayed without color.
88 The default is to use ANSI coloring whenever possible.
89 If serial boot is enabled, color is disabled by default.
90 Color features include the use of ANSI bold for numbers appearing to the left
91 of menuitems and the use of special
93 variables described below.
97 will wait before executing
98 .Va menu_timeout_command
100 by default) unless a key is pressed.
105 will wait for user input and never execute
106 .Ic menu_timeout_command .
110 will boot immediately, preventing both interruption of the
112 process and escaping to the loader prompt.
117 for additional information.
118 .It Va menu_timeout_command
119 The command to be executed after
121 seconds if a key is not pressed.
124 .It Va loader_menu_frame
125 Sets the desired box style to draw around the boot menu.
132 .It Va loader_menu_timeout_x
133 Sets the desired column position of the timeout countdown text.
135 .It Va loader_menu_timeout_y
136 Sets the desired row position of the timeout countdown text.
138 .It Va loader_menu_title
139 The text to display above the menu.
141 .Dq Li "Welcome to FreeBSD" .
142 .It Va loader_menu_title_align
144 .Ic loader_menu_title
145 centered above the menu. This can be set to
149 to instead display the title left-or-right justified
152 Sets the desired column position of the boot menu.
155 Sets the desired row position of the boot menu.
157 .It Va menu_caption[x]
158 The text to be displayed for the numbered menuitem
160 .It Va menu_command[x]
161 The command to be executed when the number associated with menuitem
164 See the list of included FICL words below for some ideas.
165 .It Va menu_keycode[x]
166 An optional decimal ASCII keycode to be associated with menuitem
168 When pressed, will cause the execution of
169 .Va menu_command[x] .
170 .It Va ansi_caption[x]
174 .Pq enabled by default ,
175 use this caption for menuitem
178 .Va menu_caption[x] .
179 .It Va toggled_text[x]
183 .Dq Li toggle_menuitem
184 (or a derivative thereof), the text displayed
185 will toggle between this and
186 .Va menu_caption[x] .
187 .It Va toggled_ansi[x]
194 .It Va menu_caption[x][y]
198 .Dq Li cycle_menuitem
199 (or a derivative thereof), the text displayed will cycle between this and other
200 .Va menu_caption[x][y]
202 .It Va ansi_caption[x][y]
204 .Va menu_caption[x][y]
212 associated with a given menuitem, that menuitem will only appear when
213 running on ACPI-compatible hardware,
215 is set (indicating the presence of hardware ACPI support as detected by
218 .Va hint.acpi.0.disabled
220 On non-i386 hardware, menuitems configured after the
222 menuitem will use a lower number (to compensate for the missing ACPI menuitem)
223 but continue to function as expected.
224 On i386-compatible hardware lacking ACPI support (as detected by
226 subsequent menuitems will retain their associated numbers.
230 on ACPI-compatible hardware when ACPI support is detected at boot time.
231 Effects the display of the
233 menuitem (if configured).
234 .It Va hint.acpi.0.disabled
235 Effects the display of the
238 If set, the menuitem will display
240 .Va ( toggled_ansi[x]
245 .Va ( ansi_caption[x]
252 a single blank-line and an
254 header are inserted between
255 .Va menu_caption[x-1]
260 If set, adds a built-in
262 menuitem to the end of the last configured menuitem.
267 menuitem will be inserted before the
272 In addition, it provides the following FICL words:
274 .Bl -tag -width disable-module_module -compact -offset indent
275 .It Ic arch-i386? ( -- BOOL )
276 Returns true (-1) on i386 and false (0) otherwise.
277 .It Ic acpipresent? ( -- BOOL )
278 Returns true (-1) if ACPI is present and false (0) otherwise.
279 .It Ic acpienabled? ( -- BOOL )
280 Returns true (-1) if ACPI is enabled and false (0) otherwise.
281 .It Ic toggle_menuitem ( N -- N )
290 represents the ASCII decimal value for
292 .It Ic cycle_menuitem ( N -- N )
296 .Va menu_caption[x][y]
299 represents the ASCII decimal value for
305 above, use any number between 1 through 9. Sorry, double-digits are not
308 .Bl -tag -width /boot/loader.4th -compact
312 .It Pa /boot/menu.4th
315 .It Pa /boot/loader.rc
317 bootstrapping script.
322 .Bd -literal -offset indent -compact
323 include /boot/menu.4th
325 set menu_caption[1]="Boot"
326 set menu_command[1]="boot"
328 set menu_caption[2]="Option: NO"
329 set toggled_text[2]="Option: YES"
330 set menu_command[2]="toggle_menuitem"
331 set menu_timeout_command="boot"
343 set of commands first appeared in
348 set of commands was written by
350 .An Devin Teske Aq dteske@FreeBSD.org .