[SLOF] [PATCH slof v5 3/6] fdt: Pass the resulting device tree to QEMU

Segher Boessenkool segher at kernel.crashing.org
Mon Oct 16 18:18:13 AEDT 2017


Hi Alexey,

On Mon, Oct 16, 2017 at 04:16:50PM +1100, Alexey Kardashevskiy wrote:
> +: fdt-skip-string ( cur -- cur )
> +    BEGIN
> +        dup c@
> +    WHILE
> +        1+
> +    REPEAT
> +    4 + -4 and
> +;

You could use ZCOUNT, like:

: fdt-skip-string ( addr -- addr )  zcount + char+  4 #aligned ;


> +: fdt-begin-node ( name namelen -- )
> +    OF_DT_BEGIN_NODE fdt-l,
> +    2dup 1 = swap c@ [char] / = and IF 2drop s" " THEN \ is it '/'?

2dup s" /" str= IF 2drop s" " THEN


But you probably shouldn't test for name "/" at all: the problem is that
the FDT doesn't allow anything in "name" for the root node?  So pass
the phandle (instead of the name string), test for *that*, and do the
node>qname in here.  Like:

: fdt-begin-node ( phandle -- )
    OF_DT_BEGIN_NODE fdt-l,
    dup device-tree @ = IF drop s" " ELSE node>qname THEN
    fdt-ztr,
    fdt-align
;


Here, have a tag :-)

Reviewed-by: Segher Boessenkool <segher at kernel.crashing.org>


Segher


More information about the SLOF mailing list