Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Nov 2013 01:12:37 +0000
From:      "Teske, Devin" <Devin.Teske@fisglobal.com>
To:        Nathan Whitehorn <nwhitehorn@freebsd.org>
Cc:        Devin Teske <dteske@freebsd.org>, "Teske, Devin" <Devin.Teske@fisglobal.com>, "<freebsd-current@freebsd.org> Current" <freebsd-current@freebsd.org>, Kurt Lidl <lidl@pix.net>
Subject:   Re: [CFT] Kernel-Selection Enhancemnt to Boot Menu
Message-ID:  <AC00F941-527F-400B-B99F-C521456F7535@fisglobal.com>
In-Reply-To: <0060B581-2639-4B84-A0E1-84B13EAD7ABF@fisglobal.com>
References:  <62E3FA11-E6E1-4072-9226-993FF83EBC0D@fisglobal.com> <5279258F.8030000@pix.net> <52792AD9.2010200@freebsd.org> <0060B581-2639-4B84-A0E1-84B13EAD7ABF@fisglobal.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_36E57C5D-7EA1-4CDE-A72D-73FFF38F0F18
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_F11763CA-E8C2-4944-8DC4-CA9711C2B352"


--Apple-Mail=_F11763CA-E8C2-4944-8DC4-CA9711C2B352
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


On Nov 5, 2013, at 9:53 AM, Teske, Devin wrote:

>=20
> On Nov 5, 2013, at 9:28 AM, Nathan Whitehorn wrote:
>=20
>> On 11/05/13 11:06, Kurt Lidl wrote:
>>>=20
>>>> You can try enabling the beastie menu on sparc64 by editing
>>>> /boot/loader.rc:
>>>>=20
>>>> =3D=3D=3D Change #1 in /boot/loader.rc to enable beastie menu =3D=3D=3D
>>>>=20
>>>> Find:
>>>>   \ Reads and processes loader.conf variables
>>>>   \ NOTE: Change to `initialize' if you enable the below boot menu
>>>>   start
>>>>=20
>>>> 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
>>>>=20
>>>> =3D=3D=3D Change #2 in [same file] to enable beastie menu =3D=3D=3D
>>>>=20
>>>> Find:
>>>>   \ Uncomment to enable boot menu
>>>>   \ include /boot/beastie.4th
>>>>   \ beastie-start
>>>>=20
>>>> Uncomment "beastie-start" as shown below:
>>>>   \ Uncomment to enable boot menu
>>>>   \ include /boot/beastie.4th
>>>>   beastie-start
>>>>=20
>>>> =3D=3D=3D=3D=3D=3D
>>>>=20
>>>> 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.
>>>=20
>>> 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.
>>>=20
>>> (Although I uncommented the "include /boot/beastie.4th" line too.)
>>>=20
>>>> Does anybody else have any thoughts on enabling it for sparc64?
>>>=20
>>> 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.
>>=20
>> 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.
>=20
> Nathan,
>=20
> Can you drop into your /boot/loader.conf:
>=20
> 	loader_delay=3D3
>=20
> And reboot?
>=20
> I'm trying to think how we could use that to our advantage. I'm interested
> in creative applications thereof.
>=20
> 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.
>=20
> 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...
>=20
> 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).
>=20
> Then here's what I would do (as to not have to load separate modules)...
>=20
> set kernel=3Dkernel.old
> boot
>=20
> + The forth code figures out that the kernel is in /boot
> + If loader.conf had opensolaris_load=3DYES and
> + zfs_load=3DYES then the forth code also loads those from kernel.old
>=20
> But let's say loader.conf was bare, you could do:
>=20
> set kernel=3Dkernel.old
> set opensolaris_load=3DYES
> set zfs_load=3DYES
> boot
>=20
> 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_execu=
te"
for "delayed-command execute").



> to fire off "autoboot" in 3
> seconds (with the aforementioned allowed interrupt ability).
>=20
> Is that what you were thinking? Will that work?
>=20
> 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=3D3 in loader.conf(5)):

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

No beastie menu.

Will this work?
--=20
Devin

_____________
The information contained in this message is proprietary and/or confidentia=
l. If you are not the intended recipient, please: (i) delete the message an=
d all copies; (ii) do not disclose, distribute or use the message in any ma=
nner; and (iii) notify the sender immediately. In addition, please be aware=
 that any message addressed to our domain is subject to archiving and revie=
w by persons other than the intended recipient. Thank you.

--Apple-Mail=_F11763CA-E8C2-4944-8DC4-CA9711C2B352
Content-Disposition: attachment;
	filename=patch.txt
Content-Type: text/plain;
	name="patch.txt"
Content-Transfer-Encoding: 7bit

Index: sys/boot/forth/beastie.4th
===================================================================
--- sys/boot/forth/beastie.4th	(revision 257650)
+++ sys/boot/forth/beastie.4th	(working copy)
@@ -28,8 +28,6 @@
 
 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)
@@ -41,6 +41,7 @@ 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
 
@@ -141,8 +142,17 @@ 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
 ;
 

--Apple-Mail=_F11763CA-E8C2-4944-8DC4-CA9711C2B352
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii



--Apple-Mail=_F11763CA-E8C2-4944-8DC4-CA9711C2B352--

--Apple-Mail=_36E57C5D-7EA1-4CDE-A72D-73FFF38F0F18
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="signature.asc"
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQEcBAEBCgAGBQJSeZeEAAoJEKrMn5R9npq5XqwH/AnKJ4TiFPrD021ols3l7/lH
I8sHsX7YP+vMwNiiogARyAK+EvSaQ2QAv1+LekBqh3KuyQM2/NQeJWsm14+FWnpt
r2BX8r27Yc0yGv9A8qA8FVllrOaJ1E+bN3Kd5XLkNq4As+k/g8CcfKOCOaNO4sLk
ry0FtuwkzcD+JGzqN4P9oUdXfyXR4/xNgTfO7cg8XRYDAeivkf+gMF2MJhTriHqY
zH2imaC2JnUsziRDjng23zWh9hppLnu+zNxNZBIuU9ewtr+BmI9KGiit7iy6AunY
yIJoQ9h5c7PA0V3e1mjDIh71vI2xU+ztr5emShq+cSgiD1kyLCfyorVBWZh+EJo=
=EsLr
-----END PGP SIGNATURE-----

--Apple-Mail=_36E57C5D-7EA1-4CDE-A72D-73FFF38F0F18--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AC00F941-527F-400B-B99F-C521456F7535>