kernel: bump 6.1 to 6.1.57
[openwrt/staging/stintel.git] / target / linux / mediatek / patches-6.1 / 901-arm-add-cmdline-override.patch
1 --- a/arch/arm/Kconfig
2 +++ b/arch/arm/Kconfig
3 @@ -1589,6 +1589,14 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN
4
5 endchoice
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 CMDLINE
16 string "Default kernel command string"
17 default ""
18 --- a/drivers/of/fdt.c
19 +++ b/drivers/of/fdt.c
20 @@ -1187,6 +1187,17 @@ int __init early_init_dt_scan_chosen(cha
21 if (p != NULL && l > 0)
22 strlcat(cmdline, p, min_t(int, strlen(cmdline) + (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(cmdline, p, min((int)l, COMMAND_LINE_SIZE));
33 +#endif
34 +
35 handle_cmdline:
36 /*
37 * CONFIG_CMDLINE is meant to be a default in case nothing else
38 --- a/arch/arm64/Kconfig
39 +++ b/arch/arm64/Kconfig
40 @@ -2234,6 +2234,14 @@ config CMDLINE_FORCE
41
42 endchoice
43
44 +config CMDLINE_OVERRIDE
45 + bool "Use alternative cmdline from device tree"
46 + help
47 + Some bootloaders may have uneditable bootargs. While CMDLINE_FORCE can
48 + be used, this is not a good option for kernels that are shared across
49 + devices. This setting enables using "chosen/cmdline-override" as the
50 + cmdline if it exists in the device tree.
51 +
52 config EFI_STUB
53 bool
54