[PATCH 14/14] bootm: use initrd_address and initrd_size

Sascha Hauer s.hauer at pengutronix.de
Mon Nov 28 03:02:20 EST 2011


Make these fields in struct image_data the reference for image handlers

Signed-off-by: Sascha Hauer <s.hauer at 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




More information about the barebox mailing list