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

Alexey Kardashevskiy aik at ozlabs.ru
Tue Jun 6 19:20:56 AEST 2017


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 :)

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?


> -
> -   boot-dev-no my-boot-dev < IF
> -      s" boot-selected " s" $bootdev" evaluate $cat strdup evaluate
> -   ELSE
> -      ." Invalid choice!" cr
> -   THEN
> -   hex
> -;
>  
>  : boot-menu-start
> -   ." Select boot device:" cr cr
> -   s" boot-start " s" $bootdev" evaluate $cat strdup evaluate
> +    boot-menu ?dup IF
> +       s" boot " 2swap $cat
> +       ['] evaluate catch ?dup IF
> +           ." boot attempt returned: "
> +           abort"-str @ count type cr
> +           throw
> +       THEN
> +       0 0 load-list 2!
> +    THEN
>  ;
>  
>  : boot-menu-enabled? ( -- true|false )
> 


-- 
Alexey


More information about the SLOF mailing list