device trees.

Michael Ellerman michael at ellerman.id.au
Tue May 12 12:37:50 EST 2009


On Tue, 2009-05-12 at 08:56 +1000, David Gibson wrote:
> On Mon, May 11, 2009 at 05:38:16PM -0400, David H. Lynch Jr. wrote:
> > Grant Likely wrote:
> > >>    Anyway, all I was looking for was a leg up on figuring out how to do
> > >> what I want with them. Rather than starting from scratch.
> > >>    I am not looking to be convinced that I am approaching this all wrong.
> > >>    If you are happy with what you have - great. I am not.
> > >>    While I was not looking to restart a great debate over device trees
> > >> - I do not actually think they are a bad idea.
> > >>     
> > >
> > > I still don't understand what you're worried about starting an arguing
> > > about.  Pretty much any of the PowerPC maintainers can point at warts
> > > and problems in the current handling of device trees.  I'm not
> > > particularly happy with simpleImage (and I wrote it), but it takes
> > > time and effort to write something more capable.
> > >   
> >     I was not trying to start an argument, my initial question was
> > 
> >    "Is there an example somewhere that shows building a device tree on the fly ?"
> > 
> >    The responses have questioned why I want to do that rather than how can I do that.
> >    I was not actually seeking a debate over the merit of device trees, or u-boot, or libdft, or .... 
> 
> Probably the closest things to suitable examples here are
> arch/powerpc/kernel/prom_init.c, which builds the dtb from the "live"
> OF device tree.  At the moment that's a bit of a special case, but
> there's no inherent reason that logic couldn't be moved to the
> bootwrapper.
> 
> The other, not in the main tree, is Paul's restodt, which builds a
> device tree from old-style PReP residual information.  I recall it was
> sent to the list as a userspace program (we were gathering information
> on the sorts of PReP out there).  I think Paul made at least a first
> cut at fusing it into the bootwrapper, but I don't know if that ever
> got sent out to the list.


There's also the iseries code, which is not pretty, but shows a very
minimal example of constructing a device tree on the fly, some of it
based on static config and some that's not.

The routines for constructing DT nodes and properties is about 110
lines, and most of that is brackets.

arch/powerpc/platforms/iseries/dt.c

cheers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090512/657a68fb/attachment.pgp>


More information about the Linuxppc-dev mailing list