From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH] dtc: Add command line option to force size alignment of blob. Date: Sun, 14 Nov 2010 11:36:48 +1100 Message-ID: <20101114003648.GA2937@yookeroo> References: <1289584920-4703-1-git-send-email-dirk.brandewie@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1289584920-4703-1-git-send-email-dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Cc: Dirk Brandewie , devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org List-Id: devicetree@vger.kernel.org On Fri, Nov 12, 2010 at 10:02:00AM -0800, dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > From: Dirk Brandewie > > This patch adds a command line argument to allow the user to request > the that the blob be padded out to modulo 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