linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: Jon Loeliger <jdl@jdl.com>
Cc: linuxppc-dev@ozlabs.org
Subject: [FDT][PATCH] Fix padding options
Date: Tue, 4 Dec 2007 17:36:08 -0600 (CST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0712041734580.1979@blarg.am.freescale.net> (raw)

"Add an option to pad the blob that is generated" broke the padding
support.  We were updating the fdt header after writing it.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---

Better commit message for this, since my commit ID is different.

 flattree.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/flattree.c b/flattree.c
index c860b63..eb9c82c 100644
--- a/flattree.c
+++ b/flattree.c
@@ -399,6 +399,12 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
 	if (padsize > 0)
 		padlen = padsize;

+	if (padlen > 0) {
+		int tsize = be32_to_cpu(fdt.totalsize);
+		tsize += padlen;
+		fdt.totalsize = cpu_to_be32(tsize);
+	}
+
 	/*
 	 * Assemble the blob: start with the header, add with alignment
 	 * the reserve buffer, add the reserve map terminating zeroes,
@@ -414,12 +420,8 @@ 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 (padlen > 0) {
-		int tsize = be32_to_cpu(fdt.totalsize);
-		tsize += padlen;
+	if (padlen > 0)
 		blob = data_append_zeroes(blob, padlen);
-		fdt.totalsize = cpu_to_be32(tsize);
-	}

 	fwrite(blob.val, blob.len, 1, f);

-- 
1.5.3.4

             reply	other threads:[~2007-12-04 23:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-04 23:36 Kumar Gala [this message]
2007-12-05 14:47 ` [FDT][PATCH] Fix padding options Jon Loeliger
  -- strict thread matches above, loose matches on Subject: below --
2007-12-04 16:27 Kumar Gala
2007-12-04 22:04 ` David Gibson
2007-12-04 22:18   ` Kumar Gala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0712041734580.1979@blarg.am.freescale.net \
    --to=galak@kernel.crashing.org \
    --cc=jdl@jdl.com \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).