[PATCH] dtc: Add command line option to force size alignment of blob.

David Gibson david at gibson.dropbear.id.au
Sun Nov 14 11:36:48 EST 2010


On Fri, Nov 12, 2010 at 10:02:00AM -0800, dirk.brandewie at gmail.com wrote:
> From: Dirk Brandewie <dirk.brandewie at gmail.com>
> 
> This patch adds a command line argument to allow the user to request
> the that the blob be padded out to modulo <bytes> size.

[snip]
> @@ -411,6 +412,20 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version)
>  	}
>  
>  	/*
> +	 * If the user asked for alignment of the end of the blob,
> +	 * adjust the totalsize. 
> +	 */
> +
> +	if (align_size > 0)
> +		align_len = align_size;
> +
> +	if (align_len > 0) {
> +		int tsize = fdt32_to_cpu(fdt.totalsize);
> +		tsize += alignlen;
> +		fdt.totalsize = cpu_to_fdt32(tsize);

Uh.. what?  You just added the alignment to totalsize, rather than
aligning totalsize to the alignment.

Also, rather than introducing a new variable, it would be simpler to
just adjust padlen based on the alignment.

-- 
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 devicetree-discuss mailing list