[Crosstoolchain-logs] [device-tree-compiler] 96/357: Fix the -S to modify the totalsize properly.

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:05:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit 7ea144f4c0b47c6f25cb4862b3299b7e5d7f7813
Author: Jerry Van Baren <gvb.uboot at gmail.com>
Date:   Thu Apr 19 22:22:35 2007 -0400

    Fix the -S to modify the totalsize properly.
    
    With the last improvement to pad out the blob, I broke the blob
    header totalsize adjustment.  The adjustment was moved up in the
    code before the memory image of the blob is created.
    
    Signed-off-by: Gerald Van Baren <vanbaren at cideas.com>
---
 flattree.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/flattree.c b/flattree.c
index 913b02f..b54f7ef 100644
--- a/flattree.c
+++ b/flattree.c
@@ -353,6 +353,7 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
 	struct data dtbuf      = empty_data;
 	struct data strbuf     = empty_data;
 	struct boot_param_header bph;
+	int padlen;
 
 	for (i = 0; i < ARRAY_SIZE(version_table); i++) {
 		if (version_table[i].version == version)
@@ -371,6 +372,19 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
 		 boot_cpuid_phys);
 
 	/*
+	 * If the user asked for more space than is used, adjust the totalsize.
+	 */
+	padlen = minsize - be32_to_cpu(bph.totalsize);
+	if (padlen > 0) {
+		bph.totalsize = cpu_to_be32(minsize);
+	} else {
+		if ((minsize > 0) && (quiet < 1))
+			fprintf(stderr,
+				"Warning: blob size %d >= minimum size %d\n",
+				be32_to_cpu(bph.totalsize), minsize);
+	}
+
+	/*
 	 * Assemble the blob: start with the header, add with alignment
 	 * the reserve buffer, add the reserve map terminating zeroes,
 	 * the device tree itself, and finally the strings.
@@ -385,18 +399,9 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
 	/*
 	 * If the user asked for more space than is used, pad out the blob.
 	 */
-	if (minsize > 0) {
-		int padlen = minsize - be32_to_cpu(bph.totalsize);
-
-		if (padlen > 0) {
-			blob = data_append_zeroes(blob, padlen);
-			bph.totalsize = cpu_to_be32(minsize);
-		} else {
-			if (quiet < 1)
-				fprintf(stderr,
-					"Warning: blob size %d >= minimum size %d\n",
-					be32_to_cpu(bph.totalsize), minsize);
-		}
+	if (padlen > 0) {
+		blob = data_append_zeroes(blob, padlen);
+		bph.totalsize = cpu_to_be32(minsize);
 	}
 
 	fwrite(blob.val, blob.len, 1, f);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list