508-MIPS-ath79-prom-image-command-line-hack.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. --- a/arch/mips/ath79/prom.c
  2. +++ b/arch/mips/ath79/prom.c
  3. @@ -33,6 +33,35 @@ static void __init ath79_prom_append_cmd
  4. strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline));
  5. }
  6. +#ifdef CONFIG_IMAGE_CMDLINE_HACK
  7. +extern char __image_cmdline[];
  8. +
  9. +static int __init ath79_use_image_cmdline(void)
  10. +{
  11. + char *p = __image_cmdline;
  12. + int replace = 0;
  13. +
  14. + if (*p == '-') {
  15. + replace = 1;
  16. + p++;
  17. + }
  18. +
  19. + if (*p == '\0')
  20. + return 0;
  21. +
  22. + if (replace) {
  23. + strlcpy(arcs_cmdline, p, sizeof(arcs_cmdline));
  24. + } else {
  25. + strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
  26. + strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
  27. + }
  28. +
  29. + return 1;
  30. +}
  31. +#else
  32. +static inline int ath79_use_image_cmdline(void) { return 0; }
  33. +#endif
  34. +
  35. static int __init ath79_prom_init_myloader(void)
  36. {
  37. struct myloader_info *mylo;
  38. @@ -61,6 +90,8 @@ static int __init ath79_prom_init_myload
  39. ath79_prom_append_cmdline("ethaddr", mac_buf);
  40. + ath79_use_image_cmdline();
  41. +
  42. return 1;
  43. }
  44. @@ -71,7 +102,8 @@ void __init prom_init(void)
  45. if (ath79_prom_init_myloader())
  46. return;
  47. - fw_init_cmdline();
  48. + if (!ath79_use_image_cmdline())
  49. + fw_init_cmdline();
  50. env = fw_getenv("ethaddr");
  51. if (env)