summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx/patches-3.2/508-MIPS-ath79-prom-image-command-line-hack.patch
blob: 062e513a357781a927de7fc0f982a721157488eb (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
--- a/arch/mips/ath79/prom.c
+++ b/arch/mips/ath79/prom.c
@@ -70,6 +70,35 @@ static const char * __init ath79_prom_fi
 	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;
@@ -95,6 +124,8 @@ static int __init ath79_prom_init_myload
 
 	ath79_prom_append_cmdline("ethaddr", mac_buf);
 
+	ath79_use_image_cmdline();
+
 	return 1;
 }
 
@@ -102,6 +133,9 @@ static __init void ath79_prom_init_cmdli
 {
 	int i;
 
+	if (ath79_use_image_cmdline())
+		return;
+
 	if (!is_valid_ram_addr(argv))
 		return;