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

H. Peter Anvin hpa at linux.intel.com
Sat Nov 13 06:08:15 EST 2010


On 11/12/2010 08:24 AM, Dirk Brandewie wrote:
> 
> 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.
> 

Not if you know it is aligned mod <whatever> bytes, then you just do:

blob = ALIGN_UP(blob + be32_to_cpu(blob->totalsize), DTB_ALIGNMENT);

This, of course, makes it even more important that DTB_ALIGNMENT is a
common constant across the kernel build.  The nice part is that you can
just add:

	.balign DTB_ALIGNMENT

... into your generated .S files and all is good.

	-hpa



More information about the devicetree-discuss mailing list