mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] armlinux: pass INIRTD tag to the kernel
@ 2010-11-01 19:46 Eric Bénard
  0 siblings, 0 replies; only message in thread
From: Eric Bénard @ 2010-11-01 19:46 UTC (permalink / raw)
  To: s.hauer; +Cc: barebox

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/lib/armlinux.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index f690fef..0222327 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -135,8 +135,7 @@ static void setup_serial_tag(void)
 	}
 }
 
-#if 0
-static void setup_initrd_tag(ulong initrd_start, ulong initrd_end)
+static void setup_initrd_tag(image_header_t *header)
 {
 	/* an ATAG_INITRD node tells the kernel where the compressed
 	 * ramdisk can be found. ATAG_RDIMG is a better name, actually.
@@ -144,12 +143,11 @@ static void setup_initrd_tag(ulong initrd_start, ulong initrd_end)
 	params->hdr.tag = ATAG_INITRD2;
 	params->hdr.size = tag_size(tag_initrd);
 
-	params->u.initrd.start = initrd_start;
-	params->u.initrd.size = initrd_end - initrd_start;
+	params->u.initrd.start = image_get_load(header);
+	params->u.initrd.size = image_get_data_size(header);
 
 	params = tag_next(params);
 }
-#endif
 
 static void setup_end_tag (void)
 {
@@ -157,17 +155,17 @@ static void setup_end_tag (void)
 	params->hdr.size = 0;
 }
 
-static void setup_tags(void)
+static void setup_tags(struct image_data *data)
 {
 	const char *commandline = getenv("bootargs");
 
 	setup_start_tag();
 	setup_memory_tags();
 	setup_commandline_tag(commandline);
-#if 0
-	if (initrd_start && initrd_end)
-		setup_initrd_tag (initrd_start, initrd_end);
-#endif
+
+	if (data && data->initrd)
+		setup_initrd_tag (&data->initrd->header);
+
 	setup_revision_tag();
 	setup_serial_tag();
 	setup_end_tag();
@@ -232,13 +230,17 @@ int do_bootm_linux(struct image_data *data)
 	debug("## Transferring control to Linux (at address 0x%p) ...\n",
 	       theKernel);
 
-	setup_tags();
+	setup_tags(data);
 
 	if (relocate_image(data->os, (void *)image_get_load(os_header)))
 		return -1;
 
+	if (data->initrd)
+		if (relocate_image(data->initrd, (void *)image_get_load(&data->initrd->header)))
+			return -1;
+
 	/* we assume that the kernel is in place */
-	printf("\nStarting kernel ...\n\n");
+	printf("\nStarting kernel %s...\n\n", data->initrd ? "with initrd " : "");
 
 	shutdown_barebox();
 	theKernel (0, armlinux_architecture, armlinux_bootparams);
@@ -335,7 +337,7 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[])
 
 	printf("loaded zImage from %s with size %d\n", argv[1], header.end);
 
-	setup_tags();
+	setup_tags(NULL);
 
 	shutdown_barebox();
 	theKernel(0, armlinux_architecture, armlinux_bootparams);
@@ -379,7 +381,7 @@ static int do_bootu(struct command *cmdtp, int argc, char *argv[])
 	if (!theKernel)
 		theKernel = (void *)simple_strtoul(argv[1], NULL, 0);
 
-	setup_tags();
+	setup_tags(NULL);
 
 	shutdown_barebox();
 	theKernel(0, armlinux_architecture, armlinux_bootparams);
-- 
1.7.0.4


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-11-01 19:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-01 19:46 [PATCH] armlinux: pass INIRTD tag to the kernel Eric Bénard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox