mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 14/14] bootm: use initrd_address and initrd_size
Date: Mon, 28 Nov 2011 09:02:20 +0100	[thread overview]
Message-ID: <1322467340-10596-15-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1322467340-10596-1-git-send-email-s.hauer@pengutronix.de>

Make these fields in struct image_data the reference for image handlers

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/lib/armlinux.c |   10 +++++-----
 commands/bootm.c        |   11 ++++++-----
 include/boot.h          |    1 +
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index ebe4137..6c001e7 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -200,7 +200,7 @@ static void setup_serial_tag(void)
 	}
 }
 
-static void setup_initrd_tag(image_header_t *header)
+static void setup_initrd_tag(unsigned long start, unsigned long size)
 {
 	/* an ATAG_INITRD node tells the kernel where the compressed
 	 * ramdisk can be found. ATAG_RDIMG is a better name, actually.
@@ -208,8 +208,8 @@ static void setup_initrd_tag(image_header_t *header)
 	params->hdr.tag = ATAG_INITRD2;
 	params->hdr.size = tag_size(tag_initrd);
 
-	params->u.initrd.start = image_get_load(header);
-	params->u.initrd.size = image_get_data_size(header);
+	params->u.initrd.start = start;
+	params->u.initrd.size = size;
 
 	params = tag_next(params);
 }
@@ -228,8 +228,8 @@ static void setup_tags(struct image_data *data, int swap)
 	setup_memory_tags();
 	setup_commandline_tag(commandline, swap);
 
-	if (data && data->initrd)
-		setup_initrd_tag (&data->initrd->header);
+	if (data && (data->initrd_size > 0))
+		setup_initrd_tag(data->initrd_address, data->initrd_size);
 
 	setup_revision_tag();
 	setup_serial_tag();
diff --git a/commands/bootm.c b/commands/bootm.c
index 027dd37..b9f85a8 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -178,9 +178,6 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
 		}
 	}
 
-	if (data.initrd && data.initrd_address != ~0)
-		data.initrd->header.ih_load = cpu_to_uimage(data.initrd_address);
-
 	if (optind == argc) {
 		ret = COMMAND_ERROR_USAGE;
 		goto err_out;
@@ -218,8 +215,12 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
 		goto err_out;
 
 	if (data.initrd) {
-		ret = relocate_image(data.initrd,
-				(void *)image_get_load(&data.initrd->header));
+		if (data.initrd && data.initrd_address == ~0)
+			data.initrd_address = uimage_to_cpu(data.initrd->header.ih_load);
+
+		data.initrd_size = image_get_data_size(&data.initrd->header);
+
+		ret = relocate_image(data.initrd, (void *)data.initrd_address);
 		if (ret)
 			goto err_out;
 	}
diff --git a/include/boot.h b/include/boot.h
index b22514b..b67e034 100644
--- a/include/boot.h
+++ b/include/boot.h
@@ -10,6 +10,7 @@ struct image_data {
 	const char *oftree;
 	int verify;
 	unsigned long initrd_address;
+	unsigned long initrd_size;
 };
 
 struct image_handler {
-- 
1.7.7.1


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

      parent reply	other threads:[~2011-11-28  8:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-28  8:02 bootm work Sascha Hauer
2011-11-28  8:02 ` [PATCH 01/14] bootm: remove dead code Sascha Hauer
2011-11-28  8:02 ` [PATCH 02/14] factor out iminfo command Sascha Hauer
2011-11-28  8:02 ` [PATCH 03/14] compile in simple_strtoull Sascha Hauer
2011-11-28  8:02 ` [PATCH 04/14] introduce some env helpers Sascha Hauer
2011-11-28  8:02 ` [PATCH 05/14] armlinux: cleanup linux vars Sascha Hauer
2011-11-28 11:03   ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-28 11:12     ` Sascha Hauer
2011-11-29  4:38       ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-29  7:23         ` Robert Schwebel
2011-11-29  8:13           ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 10:09             ` Sascha Hauer
2011-11-28  8:02 ` [PATCH 06/14] ARM bootm: remove now obsolete args Sascha Hauer
2011-11-28  8:02 ` [PATCH 07/14] bootm: handle initrds inline Sascha Hauer
2011-12-06 15:08   ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-07  9:19     ` Sascha Hauer
2011-12-07 13:26       ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-28  8:02 ` [PATCH 08/14] bootm: remove image handler options Sascha Hauer
2011-11-28  8:02 ` [PATCH 09/14] bootm: fix various memory leaks Sascha Hauer
2011-11-28  8:02 ` [PATCH 10/14] bootm: do not require -L after -r Sascha Hauer
2011-11-28  8:02 ` [PATCH 11/14] bootm: fix typo, update help str Sascha Hauer
2011-11-28 11:00   ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-28  8:02 ` [PATCH 12/14] bootm relocate_image: honour load_address Sascha Hauer
2011-11-28  8:02 ` [PATCH 13/14] bootm: push relocate_image up to the generic command Sascha Hauer
2011-11-28  8:02 ` Sascha Hauer [this message]

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=1322467340-10596-15-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --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