Select Git revision
0018-ath79-Fix-fallback-to-bootloader-cmdline-on-empty-DT-bootargs.patch
Forked from
firmware / FFS Gluon
Source project has a limited visibility.
0018-ath79-Fix-fallback-to-bootloader-cmdline-on-empty-DT-bootargs.patch 17.33 KiB
From: Sven Eckelmann <sven@narfation.org>
Date: Mon, 23 Nov 2020 16:57:31 +0100
Subject: ath79: Fix fallback to bootloader cmdline on empty DT bootargs
The MIPS code is supposed to fall back to u-boots bootargs whenever the
/chosen/bootargs property is missing. But this feature was accidentally
disabled when the boot_command_line was initialized with an empty space
just to work around problems with early_init_dt_scan_chosen.
But this feature is necessary for some boards which have a dualboot
mechanism and whose u-boot is calculating the correct partition at runtime
without writing this information back to the u-boot-env.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Origin: backport, https://github.com/openwrt/openwrt/commit/727eebbad1b9dea91174ea675cb64ea13484f790
diff --git a/target/linux/ath79/patches-4.14/0038-MIPS-Setup-boot_command_line-before-plat_mem_setup.patch b/target/linux/ath79/patches-4.14/0038-MIPS-Setup-boot_command_line-before-plat_mem_setup.patch
new file mode 100644
index 0000000000000000000000000000000000000000..90d2ca7a0cb16d3f1e71779bfa551f498fd59755
--- /dev/null
+++ b/target/linux/ath79/patches-4.14/0038-MIPS-Setup-boot_command_line-before-plat_mem_setup.patch
@@ -0,0 +1,82 @@
+From: Paul Burton <paul.burton@mips.com>
+Date: Tue, 16 Jan 2018 16:47:57 +0100
+Subject: MIPS: Setup boot_command_line before plat_mem_setup
+
+Platforms using DT will typically call __dt_setup_arch from
+plat_mem_setup. This in turn calls early_init_dt_scan. When
+CONFIG_CMDLINE is set, this leads to its value being copied into
+boot_command_line by early_init_dt_scan_chosen. If this happens before
+the code setting up boot_command_line in arch_mem_init runs, that code
+will go on to append CONFIG_CMDLINE (via builtin_cmdline) to
+boot_command_line again, duplicating it. For some command line
+parameters (eg. earlycon) this can be a problem. Set up
+boot_command_line before early_init_dt_scan_chosen gets called such that
+it will not write CONFIG_CMDLINE in this scenario & the arguments aren't
+duplicated.
+
+Origin: upstream, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8ce355cf2e38afdb364d03d12b23d9cf44c3b7f1
+Signed-off-by: Paul Burton <paul.burton@mips.com>
+Acked-by: Mathieu Malaterre <malat@debian.org>
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: Maarten ter Huurne <maarten@treewalker.org>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/18483/
+Signed-off-by: James Hogan <jhogan@kernel.org>
+
+diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
+index abd7ee9e90ab0dd0d01d970c84d90a2c4edf609b..c0f51fd4e0b3970e4f019094091578504e2f56eb 100644
+--- a/arch/mips/kernel/setup.c
++++ b/arch/mips/kernel/setup.c
+@@ -833,25 +833,6 @@ static void __init arch_mem_init(char **cmdline_p)
+ struct memblock_region *reg;
+ extern void plat_mem_setup(void);
+
+- /* call board setup routine */
+- plat_mem_setup();
+-
+- /*
+- * Make sure all kernel memory is in the maps. The "UP" and
+- * "DOWN" are opposite for initdata since if it crosses over
+- * into another memory section you don't want that to be
+- * freed when the initdata is freed.
+- */
+- arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT,
+- PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT,
+- BOOT_MEM_RAM);
+- arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT,
+- PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT,
+- BOOT_MEM_INIT_RAM);