[source] ar71xx: mikrotik: erase firmware partition on SPI NOR devices in pre_upgrade()

LEDE Commits lede-commits at lists.infradead.org
Sun Feb 26 04:31:55 PST 2017


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/ed49d08762e2eb0a565568a5d48d4d8ffaa6ef30

commit ed49d08762e2eb0a565568a5d48d4d8ffaa6ef30
Author: Thibaut VARENE <hacks at slashdirt.org>
AuthorDate: Thu Feb 23 12:24:05 2017 +0100

    ar71xx: mikrotik: erase firmware partition on SPI NOR devices in pre_upgrade()
    
    On Mikrotik SPI NOR devices, the firmware partition must be erased when flashing
    from stock firmware, otherwise leftover bits (in particular a kernel signature)
    can trigger a boot loop.
    
    When booted from initramfs (the only way to flash LEDE on these devices),
    this patch unconditionally erases the firmware partition in the pre_upgrade()
    stage for all supported SPI NOR devices.
    
    Signed-off-by: Thibaut VARENE <hacks at slashdirt.org>
---
 target/linux/ar71xx/base-files/lib/upgrade/platform.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index d48135a..576ff6c 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -684,6 +684,14 @@ platform_pre_upgrade() {
 	wndr4300)
 		nand_do_upgrade "$1"
 		;;
+	rb-750-r2|\
+	rb-750up-r2|\
+	rb-941-2nd|\
+	rb-951ui-2nd|\
+	rb-mapl-2nd)
+		# erase firmware if booted from initramfs
+		[ -z "$(rootfs_type)" ] && mtd erase firmware
+		;;
 	mr18|\
 	z1)
 		merakinand_do_upgrade "$1"



More information about the lede-commits mailing list