device tree variations

David Gibson david at gibson.dropbear.id.au
Tue Oct 21 12:49:28 EST 2008


On Fri, Oct 17, 2008 at 07:14:05PM -0700, Mike Ditto wrote:
> David Gibson wrote:
> > Deleting the irrelevant parts or picking a device tree to pass to
> > fdt_init() are both reasonable solutions.  libfdt which is included in
> > the bootwrapper has functions for removing unwanted nodes: either
> > fdt_nop_node() or fdt_del_node() will suffice.  There isn't currently
> > a dt_ops hook to call though to those functions though.  You could
> > either add one, or (knowing that your platform always has a flat dt)
> > bypass the dt_ops hooks and call libfdt directly.
> 
> Thanks.  The fdt_del_node approach works pretty nicely.  I added a
> dt_ops hook since fdt is static in libfdt-wrapper.c.
> 
> At first I tried fdt_nop_node, fearing that find_node_by_prop_value()
> and fdt_del_node() would interact badly when deleting in
> mid-traversal,

Ah, yes, it would.

> but it turns out that fdt_nop_node() upsets find_node_by_prop_value()
> anyway.

Oh... it shouldn't, I think that's a bug.  I'll try to look into that
and fix it.

>  Plus, the kernel prints harmless but strange messages when
> there are NOPs in the tree.

We should probably fix that too.

>  So I use fdt_del_node() and rescan from
> the top each time I delete a node and it works fine.

Kind of ugly, but ok.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson



More information about the Linuxppc-dev mailing list