ar71xx: add preliminary support for 3.3
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.3 / 508-MIPS-ath79-prom-image-command-line-hack.patch
1 --- a/arch/mips/ath79/prom.c
2 +++ b/arch/mips/ath79/prom.c
3 @@ -70,6 +70,35 @@ static const char * __init ath79_prom_fi
4 return ret;
5 }
6
7 +#ifdef CONFIG_IMAGE_CMDLINE_HACK
8 +extern char __image_cmdline[];
9 +
10 +static int __init ath79_use_image_cmdline(void)
11 +{
12 + char *p = __image_cmdline;
13 + int replace = 0;
14 +
15 + if (*p == '-') {
16 + replace = 1;
17 + p++;
18 + }
19 +
20 + if (*p == '\0')
21 + return 0;
22 +
23 + if (replace) {
24 + strlcpy(arcs_cmdline, p, sizeof(arcs_cmdline));
25 + } else {
26 + strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
27 + strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
28 + }
29 +
30 + return 1;
31 +}
32 +#else
33 +static inline int ath79_use_image_cmdline(void) { return 0; }
34 +#endif
35 +
36 static int __init ath79_prom_init_myloader(void)
37 {
38 struct myloader_info *mylo;
39 @@ -95,6 +124,8 @@ static int __init ath79_prom_init_myload
40
41 ath79_prom_append_cmdline("ethaddr", mac_buf);
42
43 + ath79_use_image_cmdline();
44 +
45 return 1;
46 }
47
48 @@ -102,6 +133,9 @@ static __init void ath79_prom_init_cmdli
49 {
50 int i;
51
52 + if (ath79_use_image_cmdline())
53 + return;
54 +
55 if (!is_valid_ram_addr(argv))
56 return;
57