menu-commands.4th revision 241367
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\ 25\ $FreeBSD: head/sys/boot/forth/menu-commands.4th 241367 2012-10-09 03:54:53Z dteske $ 26 27marker task-menu-commands.4th 28 29: acpi_enable ( -- ) 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 33; 34 35: acpi_disable ( -- ) 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 39; 40 41: toggle_acpi ( N -- N TRUE ) 42 43 \ Make changes effective _before_ calling menu-redraw 44 45 acpienabled? if 46 acpi_disable 47 else 48 acpi_enable 49 then 50 51 menu-redraw 52 53 TRUE \ loop menu again 54; 55 56: toggle_safemode ( N -- N TRUE ) 57 toggle_menuitem 58 59 \ Now we're going to make the change effective 60 61 s" toggle_stateN @" \ base name of toggle state var 62 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral 63 64 evaluate 0= if 65 s" kern.smp.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" kern.eventtimer.periodic" unsetenv 71 s" kern.geom.part.check_integrity" unsetenv 72 else 73 s" set kern.smp.disabled=1" evaluate 74 s" set hw.ata.ata_dma=0" evaluate 75 s" set hw.ata.atapi_dma=0" evaluate 76 s" set hw.ata.wc=0" evaluate 77 s" set hw.eisa_slots=0" evaluate 78 s" set kern.eventtimer.periodic=1" evaluate 79 s" set kern.geom.part.check_integrity=0" evaluate 80 then 81 82 menu-redraw 83 84 TRUE \ loop menu again 85; 86 87: toggle_singleuser ( N -- N TRUE ) 88 toggle_menuitem 89 menu-redraw 90 91 \ Now we're going to make the change effective 92 93 s" toggle_stateN @" \ base name of toggle state var 94 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral 95 96 evaluate 0= if 97 s" boot_single" unsetenv 98 else 99 s" set boot_single=YES" evaluate 100 then 101 102 TRUE \ loop menu again 103; 104 105: toggle_verbose ( N -- N TRUE ) 106 toggle_menuitem 107 menu-redraw 108 109 \ Now we're going to make the change effective 110 111 s" toggle_stateN @" \ base name of toggle state var 112 -rot 2dup 12 + c! rot \ replace 'N' with ASCII numeral 113 114 evaluate 0= if 115 s" boot_verbose" unsetenv 116 else 117 s" set boot_verbose=YES" evaluate 118 then 119 120 TRUE \ loop menu again 121; 122 123: goto_prompt ( N -- N FALSE ) 124 125 s" set autoboot_delay=NO" evaluate 126 127 cr 128 ." To get back to the menu, type `menu' and press ENTER" cr 129 ." or type `boot' and press ENTER to start FreeBSD." cr 130 cr 131 132 FALSE \ exit the menu 133; 134 135: cycle_kernel ( N -- N TRUE ) 136 cycle_menuitem 137 menu-redraw 138 139 \ Now we're going to make the change effective 140 141 s" cycle_stateN" \ base name of array state var 142 -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral 143 evaluate \ translate name into address 144 @ \ dereference address into value 145 48 + \ convert to ASCII numeral 146 147 s" set kernel=${kernel_prefix}${kernel[N]}${kernel_suffix}" 148 \ command to assemble full kernel-path 149 -rot tuck 36 + c! swap \ replace 'N' with array index value 150 evaluate \ sets $kernel to full kernel-path 151 152 TRUE \ loop menu again 153; 154 155: cycle_root ( N -- N TRUE ) 156 cycle_menuitem 157 menu-redraw 158 159 \ Now we're going to make the change effective 160 161 s" cycle_stateN" \ base name of array state var 162 -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral 163 evaluate \ translate name into address 164 @ \ dereference address into value 165 48 + \ convert to ASCII numeral 166 167 s" set root=${root_prefix}${root[N]}${root_suffix}" 168 \ command to assemble root image-path 169 -rot tuck 30 + c! swap \ replace 'N' with array index value 170 evaluate \ sets $kernel to full kernel-path 171 172 TRUE \ loop menu again 173; 174