diff mbox

[U-Boot,09/11] MIPS: bootm: automatically initialise kernel cmdline variables 'rd_start' and 'rd_size'

Message ID 1370731370-32767-10-git-send-email-daniel.schwierzeck@gmail.com
State Superseded
Delegated to: Daniel Schwierzeck
Headers show

Commit Message

Daniel Schwierzeck June 8, 2013, 10:42 p.m. UTC
This replaces the passing of the location and size of an external init ramdisk
via the traditional Linux environment. This is required to supporta again
external init ramdisks with recent Linux kernels.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
 arch/mips/lib/bootm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox

Patch

diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 796d405..68b57d7 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -104,6 +104,7 @@  static void boot_cmdline_linux(bootm_headers_t *images)
 	const char *bootargs, *next, *quote;
 	char buf[12];
 	unsigned int mem = gd->ram_size >> 20;
+	ulong rd_start, rd_size;
 
 	linux_cmdline_init();
 
@@ -111,6 +112,17 @@  static void boot_cmdline_linux(bootm_headers_t *images)
 	sprintf(buf, "mem=%uM", mem);
 	linux_cmdline_set(buf, strlen(buf));
 
+	/* append rd_start and rd_size */
+	rd_start = images->initrd_start;
+	rd_size = images->initrd_end - images->initrd_start;
+
+	if (rd_size) {
+		sprintf(buf, "rd_start=0x%08lX", rd_start);
+		linux_cmdline_set(buf, strlen(buf));
+		sprintf(buf, "rd_size=0x%lX", rd_size);
+		linux_cmdline_set(buf, strlen(buf));
+	}
+
 	bootargs = getenv("bootargs");
 	if (!bootargs)
 		return;