All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: implement a "bootargs-append" DT property
@ 2017-11-11 17:19 Daniel Gimpelevich
  2017-11-13 11:23   ` James Hogan
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Gimpelevich @ 2017-11-11 17:19 UTC (permalink / raw)
  To: linux-mips

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@gimpelevich.san-francisco.ca.us>
---
 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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-11-16  5:26 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-11 17:19 [PATCH] MIPS: implement a "bootargs-append" DT property Daniel Gimpelevich
2017-11-13 11:23 ` James Hogan
2017-11-13 11:23   ` James Hogan
2017-11-13 11:23   ` James Hogan
2017-11-13 12:31   ` Geert Uytterhoeven
2017-11-13 12:42     ` Daniel Gimpelevich
2017-11-13 13:18       ` Geert Uytterhoeven
2017-11-13 13:18         ` Geert Uytterhoeven
2017-11-13 16:34   ` Rob Herring
2017-11-13 16:34     ` Rob Herring
2017-11-14  3:05     ` Daniel Gimpelevich
2017-11-14  3:05       ` Daniel Gimpelevich
2017-11-14 17:18       ` Rob Herring
2017-11-14 17:18         ` Rob Herring
2017-11-16  1:46         ` Daniel Gimpelevich
2017-11-16  1:46           ` Daniel Gimpelevich
2017-11-16  5:26           ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.