[RELEASE] New Boot-Loader Menu -- version 1.5
Devin Teske
dteske at vicor.com
Sat May 14 01:23:29 UTC 2011
Happy to bring to you version 1.5 of my loader_menu package. This version
incorporates the suggestions first made by Lan Qing and then re-affirmed by
(in-order) Alexander Leidinger, Dieter BSD, and Julian Elischer (whom brings
word from the devsummit as well as Warner Losh): you guys want to separate the
boot "actions" from the boot "options", and now it's accomplished.
Here's how the re-arrangement looks for each of the different loader
environments...
i386-compatible hardware with ACPI support:
http://twitpic.com/4wvls8
http://twitpic.com/4wvn0f (color)
i386-compatible hardware without ACPI support:
http://twitpic.com/4wvmod
http://twitpic.com/4wvn0f (color)
non-i386 hardware (such as IA64, PPC, etc.):
http://twitpic.com/4wvne3
http://twitpic.com/4wvod5 (color)
Here's the links:
http://druidbsd.sourceforge.net/download/loader_menu-1.5.tgz
or
http://druidbsd.sourceforge.net/
Here's a diff of the changes:
diff -rNup loader_menu-1.4/+CONTENTS loader_menu-1.5/+CONTENTS
--- loader_menu-1.4/+CONTENTS 2011-05-05 00:47:31.000000000 -0700
+++ loader_menu-1.5/+CONTENTS 2011-05-12 16:07:11.000000000 -0700
@@ -1,5 +1,5 @@
@comment PKG_FORMAT_REVISION:1.1
- at name loader_menu-1.4
+ at name loader_menu-1.5
@comment ORIGIN:sysutils/loader_menu
@cwd /boot
beastie.4th
@@ -17,9 +17,9 @@ loader.rc
menu-commands.4th
@comment MD5:0999bd50b8395098bd6bcf9165db4d7b
menu.4th
- at comment MD5:26a61c0ea268334687a63e07b0d708d8
+ at comment MD5:3b97638b4a5608fab425e2751d386c14
menu.rc
- at comment MD5:dcf2993118b991f57b4ab0659d2712ae
+ at comment MD5:f682160708bcf5a537421ab09ce51660
shortcuts.4th
@comment MD5:9a5ed52548bbbaf67ad613e37d0e4b58
version.4th
@@ -30,7 +30,7 @@ version.4th
@comment MD5:69903862d8df34df77522792172b0999
@ignore
+DESC
- at comment MD5:d18419e5babe54b7cc195da7f7f5ac86
+ at comment MD5:597ef7a6779d9e083140eaa985fc1ee1
@ignore
+INSTALL
@comment MD5:76c98eb5e084871d9fe5d4fa4511d8c5
diff -rNup loader_menu-1.4/+DESC loader_menu-1.5/+DESC
--- loader_menu-1.4/+DESC 2011-05-04 12:11:31.000000000 -0700
+++ loader_menu-1.5/+DESC 2011-05-12 13:50:40.000000000 -0700
@@ -91,6 +91,11 @@ loader_delay="N"
until booting the loaded kernel). During the autoboot sequence, any key
pressed except for ENTER will allow escaping to the loader prompt.
+loader_menu_title="..."
+
+ Overrides the default title ("Welcome to FreeBSD") displayed above the
+ dynamic menu.
+
WWW: http://druidbsd.sourceforge.net/
diff -rNup loader_menu-1.4/menu.4th loader_menu-1.5/menu.4th
--- loader_menu-1.4/menu.4th 2011-05-05 00:33:13.000000000 -0700
+++ loader_menu-1.5/menu.4th 2011-05-12 16:07:06.000000000 -0700
@@ -75,7 +75,9 @@ variable menukey6
variable menukey7
variable menukey8
variable menureboot
+variable menurebootadded
variable menuacpi
+variable menuoptions
\ Menu timer [count-down] variables
variable menu_timeout_enabled \ timeout state (internal use only)
@@ -439,7 +441,10 @@ create init_text8 255 allot
: menu-create ( -- )
\ Print the frame caption at (x,y)
- 11 9 at-xy ." FreeBSD Kernel Options"
+ s" loader_menu_title" getenv dup -1 = if
+ drop s" Welcome to FreeBSD"
+ then
+ 24 over 2 / - 9 at-xy type
\ Print our menu options with respective key/variable associations.
\ `printmenuitem' ends by adding the decimal ASCII value for the
@@ -478,8 +483,39 @@ create init_text8 255 allot
then
then
+ \
+ \ Initialize the menu_options visual separator.
+ \
+ 0 menuoptions !
+ s" menu_options" getenv -1 <> if
+ c@ dup 48 > over 57 < and if ( '1' <= c1 <= '8' )
+ menuoptions !
+ else
+ drop
+ then
+ then
+
+ \ Initialize "Reboot" menu state variable (prevents double-entry)
+ false menurebootadded !
+
49 \ Iterator start (loop range 49 to 56; ASCII '1' to '8')
begin
+ \ If the "Options:" separator, print it.
+ dup menuoptions @ = if
+ \ Optionally add a reboot option to the menu
+ s" menu_reboot" getenv -1 <> if
+ drop
+ s" Reboot" printmenuitem menureboot !
+ true menurebootadded !
+ then
+
+ menuX @
+ menurow @ 2 + menurow !
+ menurow @ menuY @ +
+ at-xy
+ ." Options:"
+ then
+
\ If this is the ACPI menu option, act accordingly.
dup menuacpi @ = if
acpimenuitem ( -- C-Addr | -1 )
@@ -520,14 +556,16 @@ create init_text8 255 allot
drop \ iterator
\ Optionally add a reboot option to the menu
- s" menu_reboot" getenv -1 <> if
- drop \ no need for the value
- s" Reboot" \ menu caption (required by printmenuitem)
+ menurebootadded @ true <> if
+ s" menu_reboot" getenv -1 <> if
+ drop \ no need for the value
+ s" Reboot" \ menu caption (required by printmenuitem)
- printmenuitem
- menureboot !
- else
- 0 menureboot !
+ printmenuitem
+ menureboot !
+ else
+ 0 menureboot !
+ then
then
;
@@ -787,7 +825,7 @@ create init_text8 255 allot
evaluate rot tuck = if
\ Adjust for missing ACPI menuitem on non-i386
- arch-i386? negate 1- menuacpi @ 0<> and if
+ arch-i386? true <> menuacpi @ 0<> and if
menuacpi @ over 2dup < -rot = or
over 58 < and if
( key >= menuacpi && key < 58: N -- N )
@@ -821,7 +859,7 @@ create init_text8 255 allot
then
\ Re-adjust for missing ACPI menuitem
- arch-i386? negate 1- menuacpi @ 0<> and if
+ arch-i386? true <> menuacpi @ 0<> and if
swap
menuacpi @ 1+ over 2dup < -rot = or
over 59 < and if
diff -rNup loader_menu-1.4/menu.rc loader_menu-1.5/menu.rc
--- loader_menu-1.4/menu.rc 2011-05-04 22:53:26.000000000 -0700
+++ loader_menu-1.5/menu.rc 2011-05-12 13:45:00.000000000 -0700
@@ -23,43 +23,50 @@ set menu_command[1]="boot"
set ansi_caption[1]="[1mB[37moot [1m[ENTER][37m"
set menu_keycode[1]="98"
-set menu_caption[2]="[A]CPI Support: Disabled"
-set toggled_text[2]="[A]CPI Support: Enabled"
-set menu_command[2]="toggle_acpi"
-set menu_keycode[2]="97"
-set menu_acpi=2
-set ansi_caption[2]="[1mA[37mCPI Support: [34;1mDisabled[37m"
-set toggled_ansi[2]="[1mA[37mCPI Support: [32mEnabled[37m"
-
-set menu_caption[3]="Boot Safe [M]ode: NO"
-set toggled_text[3]="Boot Safe [M]ode: YES"
-set menu_command[3]="toggle_safemode"
-set menu_keycode[3]="109"
-set ansi_caption[3]="Boot Safe [1mM[37mode: [34;1mNO[37m"
-set toggled_ansi[3]="Boot Safe [1mM[37mode: [32mYES[37m"
-
-set menu_caption[4]="Boot [S]ingle User: NO"
-set toggled_text[4]="Boot [S]ingle User: YES"
-set menu_command[4]="toggle_singleuser"
-set menu_keycode[4]="115"
-set ansi_caption[4]="Boot [1mS[37mingle User: [34;1mNO[37m"
-set toggled_ansi[4]="Boot [1mS[37mingle User: [32mYES[37m"
-
-set menu_caption[5]="Boot [V]erbose: NO"
-set toggled_text[5]="Boot [V]erbose: YES"
-set menu_command[5]="toggle_verbose"
-set menu_keycode[5]="118"
-set ansi_caption[5]="Boot [1mV[37merbose: [34;1mNO[37m"
-set toggled_ansi[5]="Boot [1mV[37merbose: [32mYES[37m"
-
-set menu_caption[6]="[Esc]ape to loader prompt"
-set menu_command[6]="goto_prompt"
-set menu_keycode[6]="27"
-set ansi_caption[6]="[1mEsc[37mape to loader prompt"
+set menu_caption[2]="[Esc]ape to loader prompt"
+set menu_command[2]="goto_prompt"
+set menu_keycode[2]="27"
+set ansi_caption[2]="[1mEsc[37mape to loader prompt"
\ Enable built-in "Reboot" trailing menuitem
+\ NOTE: appears before menu_options if configured
+\
set menu_reboot
+\ Enable "Options:" separator. When set to a numerical value (1-8), a visual
+\ separator is inserted before that menuitem number.
+\
+set menu_options=4
+
+set menu_caption[4]="[A]CPI Support: Disabled"
+set toggled_text[4]="[A]CPI Support: Enabled"
+set menu_command[4]="toggle_acpi"
+set menu_keycode[4]="97"
+set menu_acpi=4
+set ansi_caption[4]="[1mA[37mCPI Support: [34;1mDisabled[37m"
+set toggled_ansi[4]="[1mA[37mCPI Support: [32mEnabled[37m"
+
+set menu_caption[5]="Boot Safe [M]ode: NO"
+set toggled_text[5]="Boot Safe [M]ode: YES"
+set menu_command[5]="toggle_safemode"
+set menu_keycode[5]="109"
+set ansi_caption[5]="Boot Safe [1mM[37mode: [34;1mNO[37m"
+set toggled_ansi[5]="Boot Safe [1mM[37mode: [32mYES[37m"
+
+set menu_caption[6]="Boot [S]ingle User: NO"
+set toggled_text[6]="Boot [S]ingle User: YES"
+set menu_command[6]="toggle_singleuser"
+set menu_keycode[6]="115"
+set ansi_caption[6]="Boot [1mS[37mingle User: [34;1mNO[37m"
+set toggled_ansi[6]="Boot [1mS[37mingle User: [32mYES[37m"
+
+set menu_caption[7]="Boot [V]erbose: NO"
+set toggled_text[7]="Boot [V]erbose: YES"
+set menu_command[7]="toggle_verbose"
+set menu_keycode[7]="118"
+set ansi_caption[7]="Boot [1mV[37merbose: [34;1mNO[37m"
+set toggled_ansi[7]="Boot [1mV[37merbose: [32mYES[37m"
+
\ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to
\ customize the timeout; default is 10-seconds)
\
--
Devin
_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
_____________
More information about the freebsd-hackers
mailing list