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

From: Christian Marangi
Date: Sun May 12 2024 - 09:26:09 EST


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@xxxxxxxxx>
---
drivers/of/fdt.c | 3 +++
1 file changed, 3 insertions(+)

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:
/*
--
2.43.0