0104-fix_bootargs_handling.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --- a/arch/mips/ralink/of.c
  2. +++ b/arch/mips/ralink/of.c
  3. @@ -3,7 +3,7 @@
  4. * under the terms of the GNU General Public License version 2 as published
  5. * by the Free Software Foundation.
  6. *
  7. - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  8. + * Copyright (C) 2008-2014 Imre Kaloz <kaloz@openwrt.org>
  9. * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
  10. * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
  11. */
  12. @@ -66,6 +66,17 @@ static int __init early_init_dt_find_mem
  13. return 0;
  14. }
  15. +static int chosen_dtb;
  16. +
  17. +static int __init early_init_dt_find_chosen(unsigned long node, const char *uname,
  18. + int depth, void *data)
  19. +{
  20. + if (depth == 1 && !strcmp(uname, "chosen"))
  21. + chosen_dtb = 1;
  22. +
  23. + return 0;
  24. +}
  25. +
  26. extern struct boot_param_header __image_dtb;
  27. void __init plat_mem_setup(void)
  28. @@ -78,7 +89,9 @@ void __init plat_mem_setup(void)
  29. */
  30. __dt_setup_arch(&__image_dtb);
  31. - strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
  32. + of_scan_flat_dt(early_init_dt_find_chosen, NULL);
  33. + if (chosen_dtb)
  34. + strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
  35. of_scan_flat_dt(early_init_dt_find_memory, NULL);
  36. if (memory_dtb)