kernel: bump 4.9 to 4.9.102 for 18.06
[oweals/openwrt.git] / target / linux / mpc85xx / patches-4.9 / 102-powerpc-add-cmdline-override.patch
1 --- a/arch/powerpc/Kconfig
2 +++ b/arch/powerpc/Kconfig
3 @@ -708,6 +708,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  
7 +config CMDLINE_OVERRIDE
8 +       bool "Use alternative cmdline from device tree"
9 +       help
10 +         Some bootloaders may have uneditable bootargs. While CMDLINE_FORCE can
11 +         be used, this is not a good option for kernels that are shared across
12 +         devices. This setting enables using "chosen/cmdline-override" as the
13 +         cmdline if it exists in the device tree.
14 +
15  config EXTRA_TARGETS
16         string "Additional default image types"
17         help
18 --- a/drivers/of/fdt.c
19 +++ b/drivers/of/fdt.c
20 @@ -1082,6 +1082,17 @@ int __init early_init_dt_scan_chosen(uns
21         if (p != NULL && l > 0)
22                 strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
23  
24 +       /* CONFIG_CMDLINE_OVERRIDE is used to fallback to a different
25 +        * device tree option of chosen/bootargs-override. This is
26 +        * helpful on boards where u-boot sets bootargs, and is unable
27 +        * to be modified.
28 +        */
29 +#ifdef CONFIG_CMDLINE_OVERRIDE
30 +       p = of_get_flat_dt_prop(node, "bootargs-override", &l);
31 +       if (p != NULL && l > 0)
32 +               strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
33 +#endif
34 +
35         /*
36          * CONFIG_CMDLINE is meant to be a default in case nothing else
37          * managed to set the command line, unless CONFIG_CMDLINE_FORCE