On Sat, Nov 11, 2017 at 09:19:48AM -0800, Daniel Gimpelevich wrote: > There are two uses for this: > > 1) It may be useful to split a device-specific kernel command line between > a .dts file and a .dtsi file, with "bootargs" in one and "bootargs-append" > in the other, such as for variations of a reference board. > > 2) There are kernel configuration options for prepending "bootargs" to the > kernel command line that the bootloader has passed, but not for appending. > A new option for this would be a less future-proof solution, since things > like this should be in the dtb. > > This is tested on MIPS, but it can be useful on other architectures also. > > Signed-off-by: Daniel Gimpelevich <daniel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> The device tree maintainers should be on Cc. Adding them now. Cheers James > --- > arch/mips/kernel/setup.c | 3 +++ > drivers/of/fdt.c | 4 ++++ > 2 files changed, 7 insertions(+) > > diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c > index fe39397..95e9bf2 100644 > --- a/arch/mips/kernel/setup.c > +++ b/arch/mips/kernel/setup.c > @@ -826,7 +826,10 @@ static void __init arch_mem_init(char **cmdline_p) > extern void plat_mem_setup(void); > > /* call board setup routine */ > + strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); > plat_mem_setup(); > + if (strncmp(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE) == 0) > + boot_command_line[0] = '\0'; > > /* > * Make sure all kernel memory is in the maps. The "UP" and > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > index ce30c9a..65dbda6 100644 > --- a/drivers/of/fdt.c > +++ b/drivers/of/fdt.c > @@ -1127,6 +1127,10 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, > p = of_get_flat_dt_prop(node, "bootargs", &l); > if (p != NULL && l > 0) > strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); > + p = of_get_flat_dt_prop(node, "bootargs-append", &l); > + if (p != NULL && l > 0) > + strlcat(data, p, min_t(int, strlen(data) + l, > + COMMAND_LINE_SIZE)); > > /* > * CONFIG_CMDLINE is meant to be a default in case nothing else > -- > 1.9.1 > >
Attachment:
signature.asc
Description: Digital signature