[SLOF] [PATCH 4/4] bootmenu: Wire up the new boot menu in the Forth code

Thomas Huth thuth at redhat.com
Wed Jun 7 02:21:32 AEST 2017


On 06.06.2017 11:20, Alexey Kardashevskiy wrote:
> On 02/06/17 01:25, Thomas Huth wrote:
>> Remove the old Forth-based boot menu code and use the
>> new libbootmenu module instead.
>>
>> Signed-off-by: Thomas Huth <thuth at redhat.com>
>> ---
>>  slof/fs/start-up.fs | 71 +++++++----------------------------------------------
>>  1 file changed, 9 insertions(+), 62 deletions(-)
>>
>> diff --git a/slof/fs/start-up.fs b/slof/fs/start-up.fs
>> index dc5d1ed..7020f5c 100644
>> --- a/slof/fs/start-up.fs
>> +++ b/slof/fs/start-up.fs
>> @@ -65,70 +65,17 @@
>>  \ Watchdog will be rearmed during load if use-load-watchdog variable is TRUE
>>  TRUE VALUE use-load-watchdog?
>>  
>> -1 value my-boot-dev
>> -1 value digit-val
>> -0 value boot-dev-no
>> -
>> -: boot-selected
>> -   1 to my-boot-dev
>> -   BEGIN parse-word dup WHILE
>> -      boot-dev-no my-boot-dev = IF
>> -         s" boot " 2swap $cat
>> -         ['] evaluate catch ?dup IF     \ and execute it
>> -            ." boot attempt returned: "
>> -            abort"-str @ count type cr
>> -            throw
>> -         THEN
>> -         0 0 load-list 2!
>> -         UNLOOP EXIT
>> -      ELSE
>> -         2drop
>> -      THEN
>> -      my-boot-dev 1 + to my-boot-dev
>> -   REPEAT 2drop 0 0 load-list 2!
>> -
>> -   (boot)
>> -;
>> -
>> -: boot-start
>> -   decimal
>> -   BEGIN parse-word dup WHILE
>> -      my-boot-dev (u.) s" . " $cat type 2dup type ." : " de-alias type cr
>> -      my-boot-dev 1 + to my-boot-dev
> 
> If I read the patchset correctly, what you wanted was to fix this loop to
> walk through all disk*/cdrom*/net* aliases instead of what contributed to
> $bootdev....
> 
> 
>> -   REPEAT 2drop 0 0 load-list 2!
>> -
>> -   \ Clear pending keys (to remove multiple F12 key presses for example)
>> -   BEGIN key? WHILE
>> -      key drop
>> -   REPEAT
>> -
>> -   cr
>> -   BEGIN
>> -      KEY
>> -      dup 1b = IF         \ ESC sequence ... could be yet another F12 key press
>> -         BEGIN key? WHILE
>> -            key drop
> 
>> -         REPEAT
>> -      ELSE
>> -         dup emit
>> -      THEN
>> -      dup isdigit IF
>> -         dup 30 - to digit-val
>> -         boot-dev-no a * digit-val + to boot-dev-no
>> -      THEN
>> -   d = UNTIL
> 
> 
> ... get rid of this 0xd (which I do not see as a huge improvement as now
> you are limiting yourself to 0..9a..zA..Z while you could have billions
> but whatever :) ). Also, there is a tiny chance that some may have test
> scripts relying on SLOF waiting for \r :)

Honestly, every time I use the current boot menu after a while, I am
confused by its current behavior (I never press RETURN in that case
since I expect that one key press is enough to start an entry). I think
I hardly have ever seen another boot menu in the past where you have to
enter a multi-digit number and press RETURN afterwards ...
And if you've got more than 30 boot devices, they likely do not fit on
your screen anymore anyway, so using the boot menu does not make much
sense anymore in that case, too, I think.

But if you really think that the current behavior of the boot menu is
better, please say so, then I'll stop my efforts to improve that thing.

> Would not it be easier to clear $bootdev and simply populate it with all
> discovered aliases? Since we got this far, we do not care about $bootdev
> anymore?

First, I'm not sure whether chaning $bootdev is really a good idea here
now, since the user might exit the boot menu and type "boot" at the SLOF
prompt again instead.

Then I wonder why you apparently prefer now to keep the Forth
implementation of the boot menu?? IMHO the current code is quite hard to
maintain/understand/extend with all this "evaluate" + "parse-word" magic
in there. Last time you said "Either forth or c is ok" for an update
(see https://lists.ozlabs.org/pipermail/slof/2017-April/001511.html), so
I took the chance now to rewrite it in C, but if that's now suddenly not
OK for you anymore, please let me now, then I'll try to disimprove the
Forth code instead...

 Thomas


More information about the SLOF mailing list