mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2 v3] arm: bootm: zImage allow to use the concataned oftree
Date: Fri, 13 Apr 2012 12:12:26 +0200	[thread overview]
Message-ID: <1334311946-13962-2-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20120413101046.GF11079@game.jcrosoft.org>

This will allow to update it with fixup if the oftree support is builtin.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
v3:

	use the oftree only if oftree is enabled

Best Regards,
J.
 arch/arm/lib/bootm.c |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 813927a..26053dc 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -14,6 +14,7 @@
 #include <sizes.h>
 #include <libbb.h>
 #include <magicvar.h>
+#include <libfdt.h>
 
 #include <asm/byteorder.h>
 #include <asm/setup.h>
@@ -144,13 +145,22 @@ static int do_bootz_linux_fdt(int fd, struct image_data *data)
 
 	end = be32_to_cpu(header->totalsize);
 
-	of_res = request_sdram_region("oftree", r->start + r->size, end);
-	if (!of_res) {
-		perror("zImage: oftree request_sdram_region");
-		return -ENOMEM;
-	}
+	if (IS_BUILTIN(CONFIG_OFTREE)) {
+		oftree = malloc(end + 0x8000);
+		if (!oftree) {
+			perror("zImage: oftree malloc");
+			return -ENOMEM;
+		}
+	} else {
 
-	oftree = (void*)of_res->start;
+		of_res = request_sdram_region("oftree", r->start + r->size, end);
+		if (!of_res) {
+			perror("zImage: oftree request_sdram_region");
+			return -ENOMEM;
+		}
+
+		oftree = (void*)of_res->start;
+	}
 
 	memcpy(oftree, header, sizeof(*header));
 
@@ -164,6 +174,16 @@ static int do_bootz_linux_fdt(int fd, struct image_data *data)
 		return -EIO;
 	}
 
+	if (IS_BUILTIN(CONFIG_OFTREE)) {
+		fdt_open_into(oftree, oftree, end + 0x8000);
+
+		ret = of_fix_tree(oftree);
+		if (ret)
+			return ret;
+
+		data->oftree = oftree;
+	}
+
 	pr_info("zImage: concatenated oftree detected\n");
 
 	return 0;
-- 
1.7.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-04-13 10:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 10:10 [PATCH 0/2] zImage fix Jean-Christophe PLAGNIOL-VILLARD
2012-04-13 10:12 ` [PATCH 1/2 v3] arm: fix zImage support when a oftree is concatenated Jean-Christophe PLAGNIOL-VILLARD
2012-04-13 10:12 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-04-13 12:47 ` [PATCH 0/2] zImage fix Sascha Hauer

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=1334311946-13962-2-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.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