summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorThibaut VARÈNE <hacks@slashdirt.org>2020-08-17 12:44:13 +0200
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-08-18 12:24:12 +0200
commit2cac31223d97fffacb8154f5739c67dfe078106f (patch)
tree11db04eb88e2b06baeb4fc52286e99e04eb2a4bb /target
parentd0498872ff71a79f0676cfc6b6b547c499bff712 (diff)
downloadopenwrt-2cac31223d97fffacb8154f5739c67dfe078106f.tar.gz
openwrt-2cac31223d97fffacb8154f5739c67dfe078106f.tar.bz2
openwrt-2cac31223d97fffacb8154f5739c67dfe078106f.zip
ath79: mikrotik: erase firmware on SPI NOR before install
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 install OpenWRT on these devices), this patch unconditionally erases the firmware partition in the do_upgrade() stage for all supported SPI NOR devices. This is forward-ported from ed49d0876 and 20452a8db Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Diffstat (limited to 'target')
-rw-r--r--target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh
index d79bd03af5..5ee5492369 100644
--- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh
@@ -38,6 +38,9 @@ platform_do_upgrade() {
platform_do_upgrade_mikrotik_nand "$1"
;;
*)
+ # NOR devices: erase firmware if booted from initramfs
+ [ -z "$(rootfs_type)" ] && mtd erase firmware
+
default_do_upgrade "$1"
;;
esac