Patchwork [U-Boot,10/11] MIPS: bootm: add YAMON style Linux preparation/jump code for Qemu Malta

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

Comments

Daniel Schwierzeck - June 8, 2013, 10:42 p.m.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
 arch/mips/lib/bootm.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

Patch

diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 68b57d7..1dc4e73 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -39,6 +39,12 @@  DECLARE_GLOBAL_DATA_PTR;
 #define need_linux_env		1
 #endif
 
+#if defined(CONFIG_QEMU_MALTA)
+#define board_is_qemu_malta	1
+#else
+#define board_is_qemu_malta	0
+#endif
+
 static int linux_argc;
 static char **linux_argv;
 static char *linux_argp;
@@ -174,7 +180,12 @@  static void linux_env_set(const char *env_name, const char *env_val)
 		strcpy(linux_env_p, env_name);
 		linux_env_p += strlen(env_name);
 
-		*linux_env_p++ = '=';
+		if (board_is_qemu_malta) {
+			linux_env_p++;
+			linux_env[++linux_env_idx] = linux_env_p;
+		} else {
+			*linux_env_p++ = '=';
+		}
 
 		strcpy(linux_env_p, env_val);
 		linux_env_p += strlen(env_val);
@@ -225,6 +236,9 @@  static void boot_prep_linux_legacy(bootm_headers_t *images)
 	cp = getenv("eth1addr");
 	if (cp)
 		linux_env_set("eth1addr", cp);
+
+	if (board_is_qemu_malta)
+		linux_env_set("modetty0", "38400n8r");
 }
 
 static void boot_prep_linux(bootm_headers_t *images)
@@ -237,15 +251,19 @@  static void boot_jump_linux(bootm_headers_t *images)
 {
 	typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong);
 	kernel_entry_t kernel = (kernel_entry_t) images->ep;
+	ulong linux_extra = 0;
 
 	debug("## Transferring control to Linux (at address %p) ...\n", kernel);
 
 	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
+	if (board_is_qemu_malta)
+		linux_extra = gd->ram_size;
+
 	/* we assume that the kernel is in place */
 	printf("\nStarting kernel ...\n\n");
 
-	kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, 0);
+	kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, linux_extra);
 }
 
 int do_bootm_linux(int flag, int argc, char * const argv[],