diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2010-06-14 20:02:44 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2010-06-14 20:02:44 +0000 |
commit | 08c2e29018c32bafa4a8370783e29c00644465a9 (patch) | |
tree | fd863c6c0c4be19f2261b2cf3477d8f5db5baff1 /target/linux | |
parent | b7e3430ba5c8f499cff66a86d2b2b7700b49c1c0 (diff) | |
download | master-31e0f0ae-08c2e29018c32bafa4a8370783e29c00644465a9.tar.gz master-31e0f0ae-08c2e29018c32bafa4a8370783e29c00644465a9.tar.bz2 master-31e0f0ae-08c2e29018c32bafa4a8370783e29c00644465a9.zip |
ar71xx: avoid duplicated 'board' parameter in kernel command line
SVN-Revision: 21805
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ar71xx/prom.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c index 87d6da0067..2accbf8f20 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c @@ -1,7 +1,7 @@ /* * Atheros AR71xx SoC specific prom routines * - * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org> + * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> * * This program is free software; you can redistribute it and/or modify it @@ -42,27 +42,31 @@ static void __init ar71xx_prom_append_cmdline(const char *name, strlcat(arcs_cmdline, buf, sizeof(arcs_cmdline)); } -static void __init ar71xx_prom_find_env(char **envp, const char *name) +static const char * __init ar71xx_prom_find_env(char **envp, const char *name) { - int len = strlen(name); + const char *ret = NULL; + int len; char **p; if (!is_valid_ram_addr(envp)) - return; + return NULL; + len = strlen(name); for (p = envp; is_valid_ram_addr(*p); p++) { if (strncmp(name, *p, len) == 0 && (*p)[len] == '=') { - ar71xx_prom_append_cmdline(name, *p + len + 1); + ret = *p + len + 1; break; } /* RedBoot env comes in pointer pairs - key, value */ if (strncmp(name, *p, len) == 0 && (*p)[len] == 0) if (is_valid_ram_addr(*(++p))) { - ar71xx_prom_append_cmdline(name, *p); + ret = *p; break; } } + + return ret; } static int __init ar71xx_prom_init_myloader(void) @@ -142,6 +146,7 @@ static __init void ar71xx_prom_init_cmdline(int argc, char **argv) void __init prom_init(void) { + const char *env; char **envp; printk(KERN_DEBUG "prom: fw_arg0=%08x, fw_arg1=%08x, " @@ -156,8 +161,26 @@ void __init prom_init(void) ar71xx_prom_init_cmdline(fw_arg0, (char **)fw_arg1); envp = (char **)fw_arg2; - ar71xx_prom_find_env(envp, "board"); - ar71xx_prom_find_env(envp, "ethaddr"); + if (!strstr(arcs_cmdline, "ethaddr=")) { + env = ar71xx_prom_find_env(envp, "ethaddr"); + if (env) + ar71xx_prom_append_cmdline("ethaddr", env); + } + + if (!strstr(arcs_cmdline, "board=")) { + env = ar71xx_prom_find_env(envp, "board"); + if (env) { + /* Workaround for buggy bootloaders */ + if (strcmp(env, "RouterStation") == 0 || + strcmp(env, "Ubiquiti AR71xx-based board") == 0) + env = "UBNT-RS"; + + if (strcmp(env, "RouterStation PRO") == 0) + env = "UBNT-RSPRO"; + + ar71xx_prom_append_cmdline("board", env); + } + } } void __init prom_free_prom_memory(void) |