Re: [CFT] Kernel-Selection Enhancemnt to Boot Menu

From: Teske, Devin <Devin.Teske_at_fisglobal.com>
Date: Wed, 6 Nov 2013 01:12:37 +0000
On Nov 5, 2013, at 9:53 AM, Teske, Devin wrote:

> 
> On Nov 5, 2013, at 9:28 AM, Nathan Whitehorn wrote:
> 
>> On 11/05/13 11:06, Kurt Lidl wrote:
>>> 
>>>> You can try enabling the beastie menu on sparc64 by editing
>>>> /boot/loader.rc:
>>>> 
>>>> === Change #1 in /boot/loader.rc to enable beastie menu ===
>>>> 
>>>> Find:
>>>>   \ Reads and processes loader.conf variables
>>>>   \ NOTE: Change to `initialize' if you enable the below boot menu
>>>>   start
>>>> 
>>>> Change "start" to "initialize" as shown below:
>>>>   \ Reads and processes loader.conf variables
>>>>   \ NOTE: Change to `initialize' if you enable the below boot menu
>>>>   initialize
>>>> 
>>>> === Change #2 in [same file] to enable beastie menu ===
>>>> 
>>>> Find:
>>>>   \ Uncomment to enable boot menu
>>>>   \ include /boot/beastie.4th
>>>>   \ beastie-start
>>>> 
>>>> Uncomment "beastie-start" as shown below:
>>>>   \ Uncomment to enable boot menu
>>>>   \ include /boot/beastie.4th
>>>>   beastie-start
>>>> 
>>>> ======
>>>> 
>>>> If you find that making those two trivial changes, that you are able
>>>> to load
>>>> the menu... then maybe it's time for us to start thinking about
>>>> enabling the
>>>> beastie menu by-default for the sparc64 architecture.
>>> 
>>> Seems to work just fine.  I tested by booting, toggling through the
>>> different kernel choices (/boot/kernel/kernel /boot/kernel.old/kernel)
>>> and both worked correctly.
>>> 
>>> (Although I uncommented the "include /boot/beastie.4th" line too.)
>>> 
>>>> Does anybody else have any thoughts on enabling it for sparc64?
>>> 
>>> Well, I'd probably be in support of this change - it sure beats having
>>> to interrupt the normal boot sequence and typing:
>>>  unload
>>>  load /boot/kernel.old/kernel
>>>  load /boot/kernel.old/opensolaris.ko
>>>  load /boot/kernel.old/zfs.ko
>>>  boot
>>> When I need to get back to the prior version of the kernel.
>> 
>> Is there a way to make this work even without the beastie menu? A way to
>> interrupt the boot before kernel load (even holding down a key) would be
>> really valuable, even on systems that do not support fancy terminals
>> with colors and such.
> 
> Nathan,
> 
> Can you drop into your /boot/loader.conf:
> 
> 	loader_delay=3
> 
> And reboot?
> 
> I'm trying to think how we could use that to our advantage. I'm interested
> in creative applications thereof.
> 
> For more skinny on what that does... "man delay.4th", it spills the beans
> on a "delayed command execution" module that I added a few years ago.
> 
> For example... Here's my idea of making things easier on the user that
> wants to load a different kernel, but *without* using a menu...
> 
> 1. We have loader_delay default to 3
> 2. Dots are displayed for 3 seconds before we do anything (like load a
> kernel)
> 3. User presses ENTER during those 3 seconds, and the delay is truncated
> 4. User presses Ctrl-C during those 3 seconds (or ESC) and they get a
> prompt (before the kernel has loaded).
> 
> Then here's what I would do (as to not have to load separate modules)...
> 
> set kernel=kernel.old
> boot
> 
> + The forth code figures out that the kernel is in /boot
> + If loader.conf had opensolaris_load=YES and
> + zfs_load=YES then the forth code also loads those from kernel.old
> 
> But let's say loader.conf was bare, you could do:
> 
> set kernel=kernel.old
> set opensolaris_load=YES
> set zfs_load=YES
> boot
> 
> NB: The reason this works is because you would not call "start" in your
> loader.rc (which actually loads things), but instead "initialize" (which only
> loads loader.conf et. al.) followed by dc_execute

Err, dc_execute is what I called it nearly a decade ago when I first wrote it
at $work. I forgot that I renamed it to delay_execute (used to be "dc_execute"
for "delayed-command execute").



> to fire off "autoboot" in 3
> seconds (with the aforementioned allowed interrupt ability).
> 
> Is that what you were thinking? Will that work?
> 
> Bonus: It would be extremely trivial to implement.

I wipped up a patch... (and tested it about 12 different ways)

See attached patch.txt.

It should achieve what you're looking for. I was able to trim down
Kurt's process from 6 steps:

1. Escape 10-second autoboot
2. unload
3. load /boot/kernel.old/kernel
4. load /boot/kernel.old/opensolaris.ko
5. load /boot/kernel.old/zfs.ko
6. boot


To simply 2 (with loader_delay=3 in loader.conf(5)):

1. Escape new 3-second delay
2. boot kernel.old

No beastie menu.

Will this work?
-- 
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.

Index: sys/boot/forth/beastie.4th
===================================================================
--- sys/boot/forth/beastie.4th	(revision 257650)
+++ sys/boot/forth/beastie.4th	(working copy)
_at__at_ -28,8 +28,6 _at__at_
 
 marker task-beastie.4th
 
-include /boot/delay.4th
-
 only forth definitions also support-functions
 
 variable logoX
Index: sys/boot/forth/loader.4th
===================================================================
--- sys/boot/forth/loader.4th	(revision 257650)
+++ sys/boot/forth/loader.4th	(working copy)
_at__at_ -41,6 +41,7 _at__at_ s" arch-i386" environment? [if] [if]
 
 include /boot/support.4th
 include /boot/color.4th
+include /boot/delay.4th
 
 only forth also support-functions also builtins definitions
 
_at__at_ -141,8 +142,17 _at__at_ include /boot/check-password.4th
   \ Will *NOT* try to load kernel and modules if no configuration file
   \ was succesfully loaded!
   any_conf_read? if
-    load_kernel
-    load_modules
+    s" loader_delay" getenv -1 = if
+      load_kernel
+      load_modules
+    else
+      drop
+      ." Loading Kernel and Modules (Ctrl-C to Abort)" cr
+      s" also support-functions" evaluate
+      s" set delay_command='load_kernel load_modules'" evaluate
+      s" set delay_showdots" evaluate
+      delay_execute
+    then
   then
 ;
 



Received on Wed Nov 06 2013 - 00:12:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:44 UTC