[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240512132513.2831-5-ansuelsmth@gmail.com>
Date: Sun, 12 May 2024 15:25:11 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Saravana Kannan <saravanak@...gle.com>,
Arnd Bergmann <arnd@...db.de>,
Helge Deller <deller@....de>,
Javier Martinez Canillas <javierm@...hat.com>,
Baoquan He <bhe@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
David Bauer <mail@...id-bauer.net>,
Liviu Dudau <liviu@...au.co.uk>,
Serge Semin <fancer.lancer@...il.com>,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org
Cc: Christian Marangi <ansuelsmth@...il.com>
Subject: [PATCH 4/4] MIPS: add bootargs-override property
From: David Bauer <mail@...id-bauer.net>
Add support for the bootargs-override and bootargs-append property
to the chosen node similar to the one used on ipq806x or mpc85xx.
This is necessary, as the U-Boot used on some boards, notably the
Ubiquiti UniFi 6 Lite, overwrite the bootargs property of the chosen
node leading to a kernel panic on kernel loading (hardcoded root path or
other not compatible thing).
Signed-off-by: David Bauer <mail@...id-bauer.net>
[ rework and simplify implementation, add support for bootargs-append ]
Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
---
arch/mips/kernel/setup.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 12a1a4ffb602..725e3f19f342 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -538,11 +538,23 @@ static int __init bootcmdline_scan_chosen(unsigned long node, const char *uname,
(strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
return 0;
- p = of_get_flat_dt_prop(node, "bootargs", &l);
+ /*
+ * Retrieve command line
+ * bootargs might be hardcoded and overwrite by bootloader on
+ * kernel load.
+ * Check if alternative bootargs-override is present instead
+ * first.
+ */
+ p = of_get_flat_dt_prop(node, "bootargs-override", &l);
+ if (p == NULL || l == 0)
+ p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0) {
bootcmdline_append(p, min(l, COMMAND_LINE_SIZE));
*dt_bootargs = true;
}
+ p = of_get_flat_dt_prop(node, "bootargs-append", &l);
+ if (p != NULL && l > 0)
+ bootcmdline_append(p, min_t(int, strlen(boot_command_line) + l, COMMAND_LINE_SIZE));
return 1;
}
--
2.43.0
Powered by blists - more mailing lists