1 \ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
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
27 marker task-menu-commands.4th
30 s" set acpi_load=YES" evaluate \ XXX deprecated but harmless
31 s" set hint.acpi.0.disabled=0" evaluate
32 s" loader.acpi_disabled_by_user" unsetenv
36 s" acpi_load" unsetenv \ XXX deprecated but harmless
37 s" set hint.acpi.0.disabled=1" evaluate
38 s" set loader.acpi_disabled_by_user=1" evaluate
41 : toggle_acpi ( N -- N TRUE )
43 \ Make changes effective _before_ calling menu-redraw
53 TRUE \ loop menu again
56 : toggle_safemode ( N -- N TRUE )
59 \ Now we're going to make the change effective
61 s" toggle_stateN @" \ base name of toggle state var
62 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
65 s" hint.apic.0.disabled" unsetenv
66 s" hw.ata.ata_dma" unsetenv
67 s" hw.ata.atapi_dma" unsetenv
68 s" hw.ata.wc" unsetenv
69 s" hw.eisa_slots" unsetenv
70 s" hint.kbdmux.0.disabled" unsetenv
73 \ Toggle ACPI elements if necessary
75 acpipresent? if acpienabled? if
77 toggle_menuitem ( N -- N )
83 s" set hint.apic.0.disabled=1" evaluate
84 s" set hw.ata.ata_dma=0" evaluate
85 s" set hw.ata.atapi_dma=0" evaluate
86 s" set hw.ata.wc=0" evaluate
87 s" set hw.eisa_slots=0" evaluate
88 s" set hint.kbdmux.0.disabled=1" evaluate
93 TRUE \ loop menu again
96 : toggle_singleuser ( N -- N TRUE )
100 \ Now we're going to make the change effective
102 s" toggle_stateN @" \ base name of toggle state var
103 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
106 s" boot_single" unsetenv
108 s" set boot_single=YES" evaluate
111 TRUE \ loop menu again
114 : toggle_verbose ( N -- N TRUE )
118 \ Now we're going to make the change effective
120 s" toggle_stateN @" \ base name of toggle state var
121 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral
124 s" boot_verbose" unsetenv
126 s" set boot_verbose=YES" evaluate
129 TRUE \ loop menu again
132 : goto_prompt ( N -- N FALSE )
134 s" set autoboot_delay=NO" evaluate
137 ." To get back to the menu, type `menu' and press ENTER" cr
138 ." or type `boot' and press ENTER to start FreeBSD." cr
141 FALSE \ exit the menu
144 : cycle_kernel ( N -- N TRUE )
148 \ Now we're going to make the change effective
150 s" cycle_stateN" \ base name of array state var
151 -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral
152 evaluate \ translate name into address
153 @ \ dereference address into value
154 48 + \ convert to ASCII numeral
156 \ Since we are [in this file] going to override the standard `boot'
157 \ routine with a custom one, you should know that we use $kernel
158 \ when referencing the desired kernel. Set $kernel below.
160 s" set kernel=${kernel_prefix}${kernel[N]}${kernel_suffix}"
161 \ command to assemble full kernel-path
162 -rot tuck 36 + c! swap \ replace 'N' with array index value
163 evaluate \ sets $kernel to full kernel-path
165 TRUE \ loop menu again
168 : cycle_root ( N -- N TRUE )
172 \ Now we're going to make the change effective
174 s" cycle_stateN" \ base name of array state var
175 -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral
176 evaluate \ translate name into address
177 @ \ dereference address into value
178 48 + \ convert to ASCII numeral
180 \ Since we are [in this file] going to override the standard `boot'
181 \ routine with a custom one, you should know that we use $root when
182 \ booting. Set $root below.
184 s" set root=${root_prefix}${root[N]}${root_prefix}"
185 \ command to assemble full kernel-path
186 -rot tuck 30 + c! swap \ replace 'N' with array index value
187 evaluate \ sets $kernel to full kernel-path
189 TRUE \ loop menu again