[SLOF] [PATCH] Fix ugly boot menu if devices have been specified with bootindex

Thomas Huth thuth at redhat.com
Wed Apr 5 02:22:57 AEST 2017


If the user has started with some devices that have the bootindex
parameter set, these devices show up in a very ugly way in the boot
menu of SLOF. For example, if you start QEMU with:

 qemu-system-ppc64 ... -boot menu=on -device spapr-vscsi,id=scsi0 \
  -drive file=distro.iso,if=none,media=cdrom,readonly=on,id=img0 \
  -device scsi-cd,drive=img0,bootindex=1

and press F12 for the boot menu during boot, the first entry of
the menu looks like this:

 1. /vdevice/v-scsi at 71000003/disk at 8000000000000000: /vdevice/v-scsi at 71000003/disk at 8000000000000000

So the device tree path is printed twice here. Normally, the first
part before the colon should be the short-hand alias of the device
instead. This happens because QEMU passes the full device path to
SLOF here, so SLOF does not add the boot device via an alias in
this case. Fix this issue by looking up the alias for the device
tree node if the boot device in the list starts with a "/" (i.e.
it is not an alias yet).

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1429832
Signed-off-by: Thomas Huth <thuth at redhat.com>
---
 slof/fs/start-up.fs | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/slof/fs/start-up.fs b/slof/fs/start-up.fs
index dc5d1ed..7186482 100644
--- a/slof/fs/start-up.fs
+++ b/slof/fs/start-up.fs
@@ -90,10 +90,42 @@ TRUE VALUE use-load-watchdog?
    (boot)
 ;
 
+\ Try to get the alias for a given device tree node path
+: get-alias  ( dstr dlen -- astr alen )
+    over c@ [char] / <> IF EXIT THEN
+    s" /aliases" find-node              ( dstr dlen phandle )
+    dup >r
+    node>properties @ cell+ @ BEGIN
+        dup
+    WHILE
+        ( dstr dlen lfa  R: phandle )
+        dup link> >name name>string
+        ( dstr dlen lfa astr alen  R: phandle )
+        2dup r@ get-property ABORT" alias not available"
+        ( dstr dlen lfa astr alen propdata proplen  R: phandle )
+        1-
+        6 pick 6 pick
+        str= IF                     ( dstr dlen lfa astr alen  R: phandle )
+            r> drop
+            >r >r 3drop r> r>
+            ( astr alen )
+            EXIT
+        ELSE
+            2drop
+        THEN
+        @
+    REPEAT
+    ( dstr dlen lfa  R: phandle )
+    r>
+    2drop
+;
+
 : boot-start
    decimal
    BEGIN parse-word dup WHILE
-      my-boot-dev (u.) s" . " $cat type 2dup type ." : " de-alias type cr
+      my-boot-dev (u.) s" . " $cat type
+      2dup get-alias type
+      ." : " de-alias type cr
       my-boot-dev 1 + to my-boot-dev
    REPEAT 2drop 0 0 load-list 2!
 
-- 
1.8.3.1



More information about the SLOF mailing list