102-powerpc-add-cmdline-override.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. --- a/arch/powerpc/Kconfig
  2. +++ b/arch/powerpc/Kconfig
  3. @@ -883,6 +883,14 @@ config CMDLINE_FORCE
  4. This is useful if you cannot or don't want to change the
  5. command-line options your boot loader passes to the kernel.
  6. +config CMDLINE_OVERRIDE
  7. + bool "Use alternative cmdline from device tree"
  8. + help
  9. + Some bootloaders may have uneditable bootargs. While CMDLINE_FORCE can
  10. + be used, this is not a good option for kernels that are shared across
  11. + devices. This setting enables using "chosen/cmdline-override" as the
  12. + cmdline if it exists in the device tree.
  13. +
  14. config EXTRA_TARGETS
  15. string "Additional default image types"
  16. help
  17. --- a/drivers/of/fdt.c
  18. +++ b/drivers/of/fdt.c
  19. @@ -1060,6 +1060,17 @@ int __init early_init_dt_scan_chosen(uns
  20. if (p != NULL && l > 0)
  21. strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
  22. + /* CONFIG_CMDLINE_OVERRIDE is used to fallback to a different
  23. + * device tree option of chosen/bootargs-override. This is
  24. + * helpful on boards where u-boot sets bootargs, and is unable
  25. + * to be modified.
  26. + */
  27. +#ifdef CONFIG_CMDLINE_OVERRIDE
  28. + p = of_get_flat_dt_prop(node, "bootargs-override", &l);
  29. + if (p != NULL && l > 0)
  30. + strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
  31. +#endif
  32. +
  33. /*
  34. * CONFIG_CMDLINE is meant to be a default in case nothing else
  35. * managed to set the command line, unless CONFIG_CMDLINE_FORCE