openwrt/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch
Rafał Miłecki 11759a5bf3 kernel: backport of changes & helpers
This code is required for upcoming NVMEM changes.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2023-01-07 17:45:17 +01:00

29 lines
1.0 KiB
Diff

From a9968d9cb8cb10030491fa05e24b00bd42f6d3a9 Mon Sep 17 00:00:00 2001
From: John Crispin <john@openwrt.org>
Date: Thu, 30 May 2013 16:00:42 +0000
Subject: fdt: enable retrieving kernel args from bootloader
This patch is a device tree enhancement that IMHO is worthy of mainline.
It allows the bootloader's commandline to be preserved even when the
device tree specifies one.
Submitted-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
SVN-Revision: 36780
---
drivers/of/fdt.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1054,6 +1054,9 @@ int __init early_init_dt_scan_chosen(uns
p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0)
strlcpy(data, p, min(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) + (int)l, COMMAND_LINE_SIZE));
/*
* CONFIG_CMDLINE is meant to be a default in case nothing else