Files
openwrt_mitrastar/target/linux/ramips/patches-6.12/314-MIPS-add-bootargs-override-property.patch
Mieczyslaw Nalewaj 65add58add ramips: 6.12: manually rebuilding patches
Manually rebuilding patches:
 - 001-v6.13-clocksource-drivers-ralink-Add-Ralink-System-Tick-Co.patch
 - 311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch
 - 314-MIPS-add-bootargs-override-property.patch
 - 405-mtd-spi-nor-Add-support-for-BoHong-bh25q128as.patch
 - 810-uvc-add-iPassion-iP2970-support.patch
 - 821-SPI-ralink-add-Ralink-SoC-spi-driver.patch
 - 825-i2c-MIPS-adds-ralink-I2C-driver.patch
 - 845-pwm-add-mediatek-support.patch
 - 860-ramips-add-eip93-driver.patch

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/18654
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-06-11 14:12:26 +02:00

64 lines
1.8 KiB
Diff

From f15d27f9c90ede4b16eb37f9ae573ef81c2b6996 Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Thu, 31 Dec 2020 18:49:12 +0100
Subject: [PATCH] MIPS: add bootargs-override property
Add support for the bootargs-override 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 when loading OpenWrt.
Signed-off-by: David Bauer <mail@david-bauer.net>
---
arch/mips/kernel/setup.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -556,8 +556,28 @@ static int __init bootcmdline_scan_chose
#endif /* CONFIG_OF_EARLY_FLATTREE */
+static int __init bootcmdline_scan_chosen_override(unsigned long node, const char *uname,
+ int depth, void *data)
+{
+ bool *dt_bootargs = data;
+ const char *p;
+ int l;
+
+ if (depth != 1 || !data || strcmp(uname, "chosen") != 0)
+ return 0;
+
+ p = of_get_flat_dt_prop(node, "bootargs-override", &l);
+ if (p != NULL && l > 0) {
+ strscpy(boot_command_line, p, COMMAND_LINE_SIZE);
+ *dt_bootargs = true;
+ }
+
+ return 1;
+}
+
static void __init bootcmdline_init(void)
{
+ bool dt_bootargs_override = false;
bool dt_bootargs = false;
/*
@@ -571,6 +591,14 @@ static void __init bootcmdline_init(void
}
/*
+ * If bootargs-override in the chosen node is set, use this as the
+ * command line
+ */
+ of_scan_flat_dt(bootcmdline_scan_chosen_override, &dt_bootargs_override);
+ if (dt_bootargs_override)
+ return;
+
+ /*
* If the user specified a built-in command line &
* MIPS_CMDLINE_BUILTIN_EXTEND, then the built-in command line is
* prepended to arguments from the bootloader or DT so we'll copy them