summaryrefslogtreecommitdiffstats
path: root/bsp/routerstationpro/508-MIPS-ath79-prom-image-command-line-hack.patch
blob: d4419406534edb1893758c8f04aff2978675372d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
From 0872994e45daaabcc6386438eedbe3c4633774be Mon Sep 17 00:00:00 2001
From: nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Tue, 17 Jul 2012 11:35:34 -0400
Subject: [PATCH 111/123] 508-MIPS-ath79-prom-image-command-line-hack

Import of the above patch from openwrt trunk, as of this commit:

 ----------
commit c1d79f64eed0a7ac36b5b9bca52275b397bec424
Author: nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date:   Mon Jul 16 16:26:51 2012 +0000

    uboot-ar71xx: fix compile on recent mac os x versions

    git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32750 3c298f89-4303-0410-b956-a3cf2f4a3e73
 ----------

Path to patch in the repo is: target/linux/ar71xx/patches-3.3
Repo is: git://nbd.name/openwrt.git

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/mips/ath79/prom.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/mips/ath79/prom.c b/arch/mips/ath79/prom.c
index f455159..8728e0b 100644
--- a/arch/mips/ath79/prom.c
+++ b/arch/mips/ath79/prom.c
@@ -70,6 +70,35 @@ static const char * __init ath79_prom_find_env(char **envp, const char *name)
 	return ret;
 }
 
+#ifdef CONFIG_IMAGE_CMDLINE_HACK
+extern char __image_cmdline[];
+
+static int __init ath79_use_image_cmdline(void)
+{
+	char *p = __image_cmdline;
+	int replace = 0;
+
+	if (*p == '-') {
+		replace = 1;
+		p++;
+	}
+
+	if (*p == '\0')
+		return 0;
+
+	if (replace) {
+		strlcpy(arcs_cmdline, p, sizeof(arcs_cmdline));
+	} else {
+		strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
+		strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
+	}
+
+	return 1;
+}
+#else
+static inline int ath79_use_image_cmdline(void) { return 0; }
+#endif
+
 static int __init ath79_prom_init_myloader(void)
 {
 	struct myloader_info *mylo;
@@ -98,6 +127,8 @@ static int __init ath79_prom_init_myloader(void)
 
 	ath79_prom_append_cmdline("ethaddr", mac_buf);
 
+	ath79_use_image_cmdline();
+
 	return 1;
 }
 
@@ -105,6 +136,9 @@ static __init void ath79_prom_init_cmdline(int argc, char **argv)
 {
 	int i;
 
+	if (ath79_use_image_cmdline())
+		return;
+
 	if (!is_valid_ram_addr(argv))
 		return;
 
-- 
1.7.9.7