506-MIPS-ath79-prom-parse-redboot-args.patch 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --- a/arch/mips/ath79/prom.c
  2. +++ b/arch/mips/ath79/prom.c
  3. @@ -22,10 +22,39 @@
  4. #include "common.h"
  5. +static char ath79_cmdline_buf[COMMAND_LINE_SIZE] __initdata;
  6. +
  7. +static void __init ath79_prom_append_cmdline(const char *name,
  8. + const char *value)
  9. +{
  10. + snprintf(ath79_cmdline_buf, sizeof(ath79_cmdline_buf),
  11. + " %s=%s", name, value);
  12. + strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline));
  13. +}
  14. +
  15. void __init prom_init(void)
  16. {
  17. + const char *env;
  18. +
  19. fw_init_cmdline();
  20. + env = fw_getenv("ethaddr");
  21. + if (env)
  22. + ath79_prom_append_cmdline("ethaddr", env);
  23. +
  24. + env = fw_getenv("board");
  25. + if (env) {
  26. + /* Workaround for buggy bootloaders */
  27. + if (strcmp(env, "RouterStation") == 0 ||
  28. + strcmp(env, "Ubiquiti AR71xx-based board") == 0)
  29. + env = "UBNT-RS";
  30. +
  31. + if (strcmp(env, "RouterStation PRO") == 0)
  32. + env = "UBNT-RSPRO";
  33. +
  34. + ath79_prom_append_cmdline("board", env);
  35. + }
  36. +
  37. #ifdef CONFIG_BLK_DEV_INITRD
  38. /* Read the initrd address from the firmware environment */
  39. initrd_start = fw_getenvl("initrd_start");