1\ Copyright (c) 2006-2012 Devin Teske <dteske@FreeBSD.org> 2\ All rights reserved. 3\ 4\ Redistribution and use in source and binary forms, with or without 5\ modification, are permitted provided that the following conditions 6\ are met: 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. 12\ 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 23\ SUCH DAMAGE. 24\
| 1\ Copyright (c) 2006-2012 Devin Teske <dteske@FreeBSD.org> 2\ All rights reserved. 3\ 4\ Redistribution and use in source and binary forms, with or without 5\ modification, are permitted provided that the following conditions 6\ are met: 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. 12\ 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 23\ SUCH DAMAGE. 24\
|
29variable kernel_state 30variable root_state 31 32: acpi_enable ( -- ) 33 s" set acpi_load=YES" evaluate \ XXX deprecated but harmless 34 s" set hint.acpi.0.disabled=0" evaluate 35 s" loader.acpi_disabled_by_user" unsetenv 36; 37 38: acpi_disable ( -- ) 39 s" acpi_load" unsetenv \ XXX deprecated but harmless 40 s" set hint.acpi.0.disabled=1" evaluate 41 s" set loader.acpi_disabled_by_user=1" evaluate 42; 43 44: toggle_acpi ( N -- N TRUE ) 45 46 \ Make changes effective _before_ calling menu-redraw 47 48 acpienabled? if 49 acpi_disable 50 else 51 acpi_enable 52 then 53 54 menu-redraw 55 56 TRUE \ loop menu again 57; 58 59: init_safemode ( N -- N ) 60 s" kern.smp.disabled" getenv -1 <> if 61 drop ( n c-addr -- n ) \ unused 62 toggle_menuitem ( n -- n ) 63 then 64; 65 66: toggle_safemode ( N -- N TRUE ) 67 toggle_menuitem 68 69 \ Now we're going to make the change effective 70 71 s" toggle_stateN @" \ base name of toggle state var 72 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral 73 74 evaluate 0= if 75 s" kern.smp.disabled" unsetenv 76 s" hw.ata.ata_dma" unsetenv 77 s" hw.ata.atapi_dma" unsetenv 78 s" hw.ata.wc" unsetenv 79 s" hw.eisa_slots" unsetenv 80 s" kern.eventtimer.periodic" unsetenv 81 s" kern.geom.part.check_integrity" unsetenv 82 else 83 s" set kern.smp.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 kern.eventtimer.periodic=1" evaluate 89 s" set kern.geom.part.check_integrity=0" evaluate 90 then 91 92 menu-redraw 93 94 TRUE \ loop menu again 95; 96 97: init_singleuser ( N -- N ) 98 s" boot_single" getenv -1 <> if 99 drop ( n c-addr -- n ) \ unused 100 toggle_menuitem ( n -- n ) 101 then 102; 103 104: toggle_singleuser ( N -- N TRUE ) 105 toggle_menuitem 106 menu-redraw 107 108 \ Now we're going to make the change effective 109 110 s" toggle_stateN @" \ base name of toggle state var 111 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral 112 113 evaluate 0= if 114 s" boot_single" unsetenv 115 else 116 s" set boot_single=YES" evaluate 117 then 118 119 TRUE \ loop menu again 120; 121 122: init_verbose ( N -- N ) 123 s" boot_verbose" getenv -1 <> if 124 drop ( n c-addr -- n ) \ unused 125 toggle_menuitem ( n -- n ) 126 then 127; 128 129: toggle_verbose ( N -- N TRUE ) 130 toggle_menuitem 131 menu-redraw 132 133 \ Now we're going to make the change effective 134 135 s" toggle_stateN @" \ base name of toggle state var 136 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral 137 138 evaluate 0= if 139 s" boot_verbose" unsetenv 140 else 141 s" set boot_verbose=YES" evaluate 142 then 143 144 TRUE \ loop menu again 145; 146 147: goto_prompt ( N -- N FALSE ) 148 149 s" set autoboot_delay=NO" evaluate 150 151 cr 152 ." To get back to the menu, type `menu' and press ENTER" cr 153 ." or type `boot' and press ENTER to start FreeBSD." cr 154 cr 155 156 FALSE \ exit the menu 157; 158 159: init_cyclestate ( N K -- N ) 160 over ( n k -- n k n ) 161 s" cycle_stateN" ( n k n -- n k n c-addr u ) 162 -rot tuck 11 + c! swap ( n k n c-addr u -- n k c-addr u ) 163 evaluate ( n k c-addr u -- n k addr ) 164 begin 165 tuck @ ( n k addr -- n addr k c ) 166 over <> ( n addr k c -- n addr k 0|-1 ) 167 while 168 rot ( n addr k -- addr k n ) 169 cycle_menuitem 170 swap rot ( addr k n -- n k addr ) 171 repeat 172 2drop ( n k addr -- n ) 173; 174 175: init_kernel ( N -- N ) 176 kernel_state @ ( n -- n k ) 177 init_cyclestate ( n k -- n ) 178; 179 180: cycle_kernel ( N -- N TRUE ) 181 cycle_menuitem 182 menu-redraw 183 184 \ Now we're going to make the change effective 185 186 s" cycle_stateN" \ base name of array state var 187 -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral 188 evaluate \ translate name into address 189 @ \ dereference address into value 190 dup kernel_state ! \ save a copy for re-initialization 191 48 + \ convert to ASCII numeral 192 193 s" set kernel=${kernel_prefix}${kernel[N]}${kernel_suffix}" 194 \ command to assemble full kernel-path 195 -rot tuck 36 + c! swap \ replace 'N' with array index value 196 evaluate \ sets $kernel to full kernel-path 197 198 TRUE \ loop menu again 199; 200 201: init_root ( N -- N ) 202 root_state @ ( n -- n k ) 203 init_cyclestate ( n k -- n ) 204; 205 206: cycle_root ( N -- N TRUE ) 207 cycle_menuitem 208 menu-redraw 209 210 \ Now we're going to make the change effective 211 212 s" cycle_stateN" \ base name of array state var 213 -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral 214 evaluate \ translate name into address 215 @ \ dereference address into value 216 dup root_state ! \ save a copy for re-initialization 217 48 + \ convert to ASCII numeral 218 219 s" set root=${root_prefix}${root[N]}${root_suffix}" 220 \ command to assemble root image-path 221 -rot tuck 30 + c! swap \ replace 'N' with array index value 222 evaluate \ sets $kernel to full kernel-path 223 224 TRUE \ loop menu again 225;
| 31variable kernel_state 32variable root_state 33 34: acpi_enable ( -- ) 35 s" set acpi_load=YES" evaluate \ XXX deprecated but harmless 36 s" set hint.acpi.0.disabled=0" evaluate 37 s" loader.acpi_disabled_by_user" unsetenv 38; 39 40: acpi_disable ( -- ) 41 s" acpi_load" unsetenv \ XXX deprecated but harmless 42 s" set hint.acpi.0.disabled=1" evaluate 43 s" set loader.acpi_disabled_by_user=1" evaluate 44; 45 46: toggle_acpi ( N -- N TRUE ) 47 48 \ Make changes effective _before_ calling menu-redraw 49 50 acpienabled? if 51 acpi_disable 52 else 53 acpi_enable 54 then 55 56 menu-redraw 57 58 TRUE \ loop menu again 59; 60 61: init_safemode ( N -- N ) 62 s" kern.smp.disabled" getenv -1 <> if 63 drop ( n c-addr -- n ) \ unused 64 toggle_menuitem ( n -- n ) 65 then 66; 67 68: toggle_safemode ( N -- N TRUE ) 69 toggle_menuitem 70 71 \ Now we're going to make the change effective 72 73 s" toggle_stateN @" \ base name of toggle state var 74 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral 75 76 evaluate 0= if 77 s" kern.smp.disabled" unsetenv 78 s" hw.ata.ata_dma" unsetenv 79 s" hw.ata.atapi_dma" unsetenv 80 s" hw.ata.wc" unsetenv 81 s" hw.eisa_slots" unsetenv 82 s" kern.eventtimer.periodic" unsetenv 83 s" kern.geom.part.check_integrity" unsetenv 84 else 85 s" set kern.smp.disabled=1" evaluate 86 s" set hw.ata.ata_dma=0" evaluate 87 s" set hw.ata.atapi_dma=0" evaluate 88 s" set hw.ata.wc=0" evaluate 89 s" set hw.eisa_slots=0" evaluate 90 s" set kern.eventtimer.periodic=1" evaluate 91 s" set kern.geom.part.check_integrity=0" evaluate 92 then 93 94 menu-redraw 95 96 TRUE \ loop menu again 97; 98 99: init_singleuser ( N -- N ) 100 s" boot_single" getenv -1 <> if 101 drop ( n c-addr -- n ) \ unused 102 toggle_menuitem ( n -- n ) 103 then 104; 105 106: toggle_singleuser ( N -- N TRUE ) 107 toggle_menuitem 108 menu-redraw 109 110 \ Now we're going to make the change effective 111 112 s" toggle_stateN @" \ base name of toggle state var 113 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral 114 115 evaluate 0= if 116 s" boot_single" unsetenv 117 else 118 s" set boot_single=YES" evaluate 119 then 120 121 TRUE \ loop menu again 122; 123 124: init_verbose ( N -- N ) 125 s" boot_verbose" getenv -1 <> if 126 drop ( n c-addr -- n ) \ unused 127 toggle_menuitem ( n -- n ) 128 then 129; 130 131: toggle_verbose ( N -- N TRUE ) 132 toggle_menuitem 133 menu-redraw 134 135 \ Now we're going to make the change effective 136 137 s" toggle_stateN @" \ base name of toggle state var 138 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral 139 140 evaluate 0= if 141 s" boot_verbose" unsetenv 142 else 143 s" set boot_verbose=YES" evaluate 144 then 145 146 TRUE \ loop menu again 147; 148 149: goto_prompt ( N -- N FALSE ) 150 151 s" set autoboot_delay=NO" evaluate 152 153 cr 154 ." To get back to the menu, type `menu' and press ENTER" cr 155 ." or type `boot' and press ENTER to start FreeBSD." cr 156 cr 157 158 FALSE \ exit the menu 159; 160 161: init_cyclestate ( N K -- N ) 162 over ( n k -- n k n ) 163 s" cycle_stateN" ( n k n -- n k n c-addr u ) 164 -rot tuck 11 + c! swap ( n k n c-addr u -- n k c-addr u ) 165 evaluate ( n k c-addr u -- n k addr ) 166 begin 167 tuck @ ( n k addr -- n addr k c ) 168 over <> ( n addr k c -- n addr k 0|-1 ) 169 while 170 rot ( n addr k -- addr k n ) 171 cycle_menuitem 172 swap rot ( addr k n -- n k addr ) 173 repeat 174 2drop ( n k addr -- n ) 175; 176 177: init_kernel ( N -- N ) 178 kernel_state @ ( n -- n k ) 179 init_cyclestate ( n k -- n ) 180; 181 182: cycle_kernel ( N -- N TRUE ) 183 cycle_menuitem 184 menu-redraw 185 186 \ Now we're going to make the change effective 187 188 s" cycle_stateN" \ base name of array state var 189 -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral 190 evaluate \ translate name into address 191 @ \ dereference address into value 192 dup kernel_state ! \ save a copy for re-initialization 193 48 + \ convert to ASCII numeral 194 195 s" set kernel=${kernel_prefix}${kernel[N]}${kernel_suffix}" 196 \ command to assemble full kernel-path 197 -rot tuck 36 + c! swap \ replace 'N' with array index value 198 evaluate \ sets $kernel to full kernel-path 199 200 TRUE \ loop menu again 201; 202 203: init_root ( N -- N ) 204 root_state @ ( n -- n k ) 205 init_cyclestate ( n k -- n ) 206; 207 208: cycle_root ( N -- N TRUE ) 209 cycle_menuitem 210 menu-redraw 211 212 \ Now we're going to make the change effective 213 214 s" cycle_stateN" \ base name of array state var 215 -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral 216 evaluate \ translate name into address 217 @ \ dereference address into value 218 dup root_state ! \ save a copy for re-initialization 219 48 + \ convert to ASCII numeral 220 221 s" set root=${root_prefix}${root[N]}${root_suffix}" 222 \ command to assemble root image-path 223 -rot tuck 30 + c! swap \ replace 'N' with array index value 224 evaluate \ sets $kernel to full kernel-path 225 226 TRUE \ loop menu again 227;
|