Patchwork [U-Boot,08/11] MIPS: bootm: automatically initialise kernel cmdline variable 'mem'

login
register
mail settings
Submitter Daniel Schwierzeck
Date June 8, 2013, 10:42 p.m.
Message ID <1370731370-32767-9-git-send-email-daniel.schwierzeck@gmail.com>
Download mbox | patch
Permalink /patch/249986/
State Superseded
Delegated to: Daniel Schwierzeck
Headers show

Comments

Daniel Schwierzeck - June 8, 2013, 10:42 p.m.
This replaces the passing of memory size via the traditional Linux
environment. This is required for recent Linux kernels.

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

Patch

diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 741e088..796d405 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -102,9 +102,15 @@  static void linux_cmdline_dump(void)
 static void boot_cmdline_linux(bootm_headers_t *images)
 {
 	const char *bootargs, *next, *quote;
+	char buf[12];
+	unsigned int mem = gd->ram_size >> 20;
 
 	linux_cmdline_init();
 
+	/* append mem */
+	sprintf(buf, "mem=%uM", mem);
+	linux_cmdline_set(buf, strlen(buf));
+
 	bootargs = getenv("bootargs");
 	if (!bootargs)
 		return;