aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/patches-5.10/314-MIPS-add-bootargs-override-property.patch
diff options
context:
space:
mode:
authorIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>2021-02-27 16:00:24 -0800
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2021-03-06 11:24:12 +0100
commitef1e6520164e19451bc9cb8275cf293a699e1684 (patch)
treebd6e06143301ff02a4432227671fb0ec3e781d3d /target/linux/ramips/patches-5.10/314-MIPS-add-bootargs-override-property.patch
parent3149d8e7be6539897e9f3873ed9a2b9213a798a9 (diff)
downloadupstream-ef1e6520164e19451bc9cb8275cf293a699e1684.tar.gz
upstream-ef1e6520164e19451bc9cb8275cf293a699e1684.tar.bz2
upstream-ef1e6520164e19451bc9cb8275cf293a699e1684.zip
ramips: 5.10: rename patches to follow guide
Rename patches to follow the 3-digit classification from the OpenWrt Developer Guide. https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem#naming_patches Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Diffstat (limited to 'target/linux/ramips/patches-5.10/314-MIPS-add-bootargs-override-property.patch')
-rw-r--r--target/linux/ramips/patches-5.10/314-MIPS-add-bootargs-override-property.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/target/linux/ramips/patches-5.10/314-MIPS-add-bootargs-override-property.patch b/target/linux/ramips/patches-5.10/314-MIPS-add-bootargs-override-property.patch
new file mode 100644
index 0000000000..c19a0fb480
--- /dev/null
+++ b/target/linux/ramips/patches-5.10/314-MIPS-add-bootargs-override-property.patch
@@ -0,0 +1,63 @@
+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
+@@ -571,8 +571,28 @@ static int __init bootcmdline_scan_chose
+ return 1;
+ }
+
++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) {
++ strlcpy(boot_command_line, p, COMMAND_LINE_SIZE);
++ *dt_bootargs = true;
++ }
++
++ return 1;
++}
++
+ static void __init bootcmdline_init(char **cmdline_p)
+ {
++ bool dt_bootargs_override = false;
+ bool dt_bootargs = false;
+
+ /*
+@@ -586,6 +606,14 @@ static void __init bootcmdline_init(char
+ }
+
+ /*
++ * 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