diff options
author | dteske <dteske@FreeBSD.org> | 2012-10-14 06:52:49 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2012-10-14 06:52:49 +0000 |
commit | e2a3c64f39d969bdf8be6bf228453712102da3b5 (patch) | |
tree | 28caec5137cd8820e06a88a2ae8815fd530112cf /sys/boot/forth/menu-commands.4th | |
parent | f327bafb9bbdf8e0564b2adac626940b56c5d6c8 (diff) | |
download | FreeBSD-src-e2a3c64f39d969bdf8be6bf228453712102da3b5.zip FreeBSD-src-e2a3c64f39d969bdf8be6bf228453712102da3b5.tar.gz |
Since the introduction of the new advanced boot menu (r222417), options like
"boot verbose", "single user mode", "ACPI" and more are now stateful boolean
menuitems rather than direct action-items.
A short-coming in this new menu system is that when a user sets a non-default
value in loader.conf(5), this non-default state is not reflected in the menu
-- leading to confusion as to whether the option was taking effect or not.
This patch adds dynamic menuitem constructors _and_ the necessary Forth
callbacks to initialize these stateful menuitems -- causing the aforementioned
menuitems to adhere to loader.conf(5) settings.
PR: bin/172529
Approved by: adrian (co-mentor)
MFC after: 21 days
Diffstat (limited to 'sys/boot/forth/menu-commands.4th')
-rw-r--r-- | sys/boot/forth/menu-commands.4th | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sys/boot/forth/menu-commands.4th b/sys/boot/forth/menu-commands.4th index b4f7033..4dba8b3 100644 --- a/sys/boot/forth/menu-commands.4th +++ b/sys/boot/forth/menu-commands.4th @@ -26,6 +26,9 @@ marker task-menu-commands.4th +variable kernel_state +variable root_state + : acpi_enable ( -- ) s" set acpi_load=YES" evaluate \ XXX deprecated but harmless s" set hint.acpi.0.disabled=0" evaluate @@ -53,6 +56,13 @@ marker task-menu-commands.4th TRUE \ loop menu again ; +: init_safemode ( N -- N ) + s" kern.smp.disabled" getenv -1 <> if + drop ( n c-addr -- n ) \ unused + toggle_menuitem ( n -- n ) + then +; + : toggle_safemode ( N -- N TRUE ) toggle_menuitem @@ -84,6 +94,13 @@ marker task-menu-commands.4th TRUE \ loop menu again ; +: init_singleuser ( N -- N ) + s" boot_single" getenv -1 <> if + drop ( n c-addr -- n ) \ unused + toggle_menuitem ( n -- n ) + then +; + : toggle_singleuser ( N -- N TRUE ) toggle_menuitem menu-redraw @@ -102,6 +119,13 @@ marker task-menu-commands.4th TRUE \ loop menu again ; +: init_verbose ( N -- N ) + s" boot_verbose" getenv -1 <> if + drop ( n c-addr -- n ) \ unused + toggle_menuitem ( n -- n ) + then +; + : toggle_verbose ( N -- N TRUE ) toggle_menuitem menu-redraw @@ -132,6 +156,27 @@ marker task-menu-commands.4th FALSE \ exit the menu ; +: init_cyclestate ( N K -- N ) + over ( n k -- n k n ) + s" cycle_stateN" ( n k n -- n k n c-addr u ) + -rot tuck 11 + c! swap ( n k n c-addr u -- n k c-addr u ) + evaluate ( n k c-addr u -- n k addr ) + begin + tuck @ ( n k addr -- n addr k c ) + over <> ( n addr k c -- n addr k 0|-1 ) + while + rot ( n addr k -- addr k n ) + cycle_menuitem + swap rot ( addr k n -- n k addr ) + repeat + 2drop ( n k addr -- n ) +; + +: init_kernel ( N -- N ) + kernel_state @ ( n -- n k ) + init_cyclestate ( n k -- n ) +; + : cycle_kernel ( N -- N TRUE ) cycle_menuitem menu-redraw @@ -142,6 +187,7 @@ marker task-menu-commands.4th -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral evaluate \ translate name into address @ \ dereference address into value + dup kernel_state ! \ save a copy for re-initialization 48 + \ convert to ASCII numeral s" set kernel=${kernel_prefix}${kernel[N]}${kernel_suffix}" @@ -152,6 +198,11 @@ marker task-menu-commands.4th TRUE \ loop menu again ; +: init_root ( N -- N ) + root_state @ ( n -- n k ) + init_cyclestate ( n k -- n ) +; + : cycle_root ( N -- N TRUE ) cycle_menuitem menu-redraw @@ -162,6 +213,7 @@ marker task-menu-commands.4th -rot 2dup 11 + c! rot \ replace 'N' with ASCII numeral evaluate \ translate name into address @ \ dereference address into value + dup root_state ! \ save a copy for re-initialization 48 + \ convert to ASCII numeral s" set root=${root_prefix}${root[N]}${root_suffix}" |