summaryrefslogtreecommitdiffstats
path: root/sys/boot/forth/menu-commands.4th
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2014-03-03 07:16:39 +0000
committerdteske <dteske@FreeBSD.org>2014-03-03 07:16:39 +0000
commitc6179218038fdc57a0de59ddf481672a3ce48e1f (patch)
tree1f3380572d5d2b80c4ca3831c7d8fc2391650a4e /sys/boot/forth/menu-commands.4th
parent1719e3beff3a830dd8b8ffec78fb6b7812c63a16 (diff)
downloadFreeBSD-src-c6179218038fdc57a0de59ddf481672a3ce48e1f.zip
FreeBSD-src-c6179218038fdc57a0de59ddf481672a3ce48e1f.tar.gz
MFC r257650:
Defer loading of kernel and modules if the beastie menu is enabled. Add a kernel selection menu to the beastie menu. List of kernels is taken from `kernels' in loader.conf(5) as a space (or comma) separated list of names to display (up to 9). If not set, default value is "kernel kernel.old". Does not validate that kernels exist because the next enhancement will be to allow selection of the root device. Discussed on: -current
Diffstat (limited to 'sys/boot/forth/menu-commands.4th')
-rw-r--r--sys/boot/forth/menu-commands.4th52
1 files changed, 27 insertions, 25 deletions
diff --git a/sys/boot/forth/menu-commands.4th b/sys/boot/forth/menu-commands.4th
index baee0b1..70ae9d8 100644
--- a/sys/boot/forth/menu-commands.4th
+++ b/sys/boot/forth/menu-commands.4th
@@ -1,4 +1,4 @@
-\ Copyright (c) 2006-2012 Devin Teske <dteske@FreeBSD.org>
+\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,8 @@ include /boot/menusets.4th
variable kernel_state
variable root_state
+0 kernel_state !
+0 root_state !
\
\ Boot
@@ -279,21 +281,21 @@ variable root_state
init_cyclestate ( n k -- n )
;
-: cycle_kernel ( N -- N TRUE )
- cycle_menuitem
- menu-redraw
-
- \ Now we're going to make the change effective
-
- dup cycle_stateN @
- dup kernel_state ! \ save a copy for re-initialization
- 48 + \ convert to ASCII numeral
+: activate_kernel ( N -- N )
+ dup cycle_stateN @ ( n -- n n2 )
+ dup kernel_state ! ( n n2 -- n n2 ) \ copy for re-initialization
+ 48 + ( n n2 -- n n2' ) \ kernel_state to ASCII num
s" set kernel=${kernel_prefix}${kernel[N]}${kernel_suffix}"
- 36 +c! \ replace 'N' with ASCII numeral
- evaluate \ sets $kernel to full kernel-path
+ 36 +c! ( n n2 c-addr/u -- n c-addr/u ) \ 'N' to ASCII num
+ evaluate ( n c-addr/u -- n ) \ sets $kernel to full kernel-path
+;
- TRUE \ loop menu again
+: cycle_kernel ( N -- N TRUE )
+ cycle_menuitem \ cycle cycle_stateN to next value
+ activate_kernel \ apply current cycle_stateN
+ menu-redraw \ redraw menu
+ TRUE \ loop menu again
;
\
@@ -305,21 +307,21 @@ variable root_state
init_cyclestate ( n k -- n )
;
-: cycle_root ( N -- N TRUE )
- cycle_menuitem
- menu-redraw
-
- \ Now we're going to make the change effective
-
- dup cycle_stateN @
- dup root_state ! \ save a copy for re-initialization
- 48 + \ convert to ASCII numeral
+: activate_root ( N -- N )
+ dup cycle_stateN @ ( n -- n n2 )
+ dup root_state ! ( n n2 -- n n2 ) \ copy for re-initialization
+ 48 + ( n n2 -- n n2' ) \ root_state to ASCII num
s" set root=${root_prefix}${root[N]}${root_suffix}"
- 30 +c! \ replace 'N' with ASCII numeral
- evaluate \ sets $root to full root-path
+ 30 +c! ( n n2 c-addr/u -- n c-addr/u ) \ 'N' to ASCII num
+ evaluate ( n c-addr/u -- n ) \ sets $root to full kernel-path
+;
- TRUE \ loop menu again
+: cycle_root ( N -- N TRUE )
+ cycle_menuitem \ cycle cycle_stateN to next value
+ activate_root \ apply current cycle_stateN
+ menu-redraw \ redraw menu
+ TRUE \ loop menu again
;
\
OpenPOWER on IntegriCloud