diff mbox series

[3/4] of: add support for bootargs-append chosen property

Message ID 20240512132513.2831-4-ansuelsmth@gmail.com
State Changes Requested
Headers show
Series of: bootargs handling improvement | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied fail build log

Commit Message

Christian Marangi May 12, 2024, 1:25 p.m. UTC
Add support for bootargs-append chosen property.

The bootargs-append can be used to append additional kernel arguments
to the bootargs property. This can be useful in the context of a
bootargs overridden by the bootloader that contains correct that but
the kernel require additional one to be correctly setup.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/of/fdt.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 253315421591..cc99958872e4 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1080,6 +1080,9 @@  int __init early_init_dt_scan_chosen(char *cmdline)
 		p = of_get_flat_dt_prop(node, "bootargs", &l);
 	if (p != NULL && l > 0)
 		strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
+	p = of_get_flat_dt_prop(node, "bootargs-append", &l);
+	if (p != NULL && l > 0)
+		strlcat(cmdline, p, min_t(int, strlen(cmdline) + l, COMMAND_LINE_SIZE));
 
 handle_cmdline:
 	/*