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

Segher Boessenkool segher at kernel.crashing.org
Wed Apr 5 09:37:36 AEST 2017


On Tue, Apr 04, 2017 at 06:22:57PM +0200, Thomas Huth wrote:
> 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,

Should it?  Should it pass the alias name instead?

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

The problem with this is that you will find _a_ alias (there can be more
than one for the same device); is that the one you want displayed?

> +    s" /aliases" find-node              ( dstr dlen phandle )
> +    dup >r
> +    node>properties @ cell+ @ BEGIN

Is there no better way to walk over aliases?  Maybe you can factor out
some helper?

> +        dup
> +    WHILE
> +        ( dstr dlen lfa  R: phandle )
> +        dup link> >name name>string

Esp. if you really need to look at internals this much.

> +        ( 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

"pick" is a clear sign you need to factor more.  "6 pick"?  Uhhhh...

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

Not new of course, but just
   my-boot-dev 0 u.r ." . "
perhaps?


Hope this is useful and not just nitpicking,


Segher


More information about the SLOF mailing list