[sodaville] [PATCH 3/4] of/dtc: force dtb size to modulo 32 bytes

Grant Likely grant.likely at secretlab.ca
Sun Nov 14 15:35:35 EST 2010


On Sun, Nov 14, 2010 at 11:44:09AM +1100, David Gibson wrote:
> On Fri, Nov 12, 2010 at 08:24:53AM -0800, Dirk Brandewie wrote:
[snip]
> > I am trying to solve two issues with this change.
> > 
> > The structure needs to be 32 byte aligned for the code in fdt.c to
> > be able parse the blob.  You are right I can force this alignment in
> > the assembly fragment.
> > 
> > The second issue is being able to parse the section in the kernel
> > image to find each of the blobs that have been concatenated
> > together.  If the DTB size is modulo 32 bytes I can use  blob =
> > blob+be32_to_cpu(blob->totalsize) to find the next blob in the
> > section and use that address directly to have fdt.c parse the blob.
> > Otherwise I would need to search for the signature of the next blob
> > somewhere past the end of the current blob which is knid of messy
> > IMHO.
> 
> As hpa says you can just align your increment too, to find the next
> blob.

+1

I agree, handle the alignment issues entirely within the kernel.  You
don't need to modify dtc to get the behaviour you want.

> 
> > I have two questions,
> > Do you think this acceptable if I made forcing the alignment a
> > command line argument?
> 
> Um, sure.  It's not actually necessary for what you're doing here, but
> it might have some use, I guess, and it's pretty non-invasive.  Your
> posted patch for this, however, is broken, see my comments in reply,

I disagree here.  True it is non-invasive, but I'd rather not be
adding yet another command line option unless there was a real
use-case for doing so.

g.



More information about the devicetree-discuss mailing list