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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. +#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. @@ -98,6 +127,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. @@ -105,6 +136,9 @@ static __init void ath79_prom_init_cmdli
  45. {
  46. int i;
  47. + if (ath79_use_image_cmdline())
  48. + return;
  49. +
  50. if (!is_valid_ram_addr(argv))
  51. return;