From: Thibaut VARENE Date: Thu, 23 Feb 2017 11:24:05 +0000 (+0100) Subject: ar71xx: mikrotik: erase firmware partition on SPI NOR devices in pre_upgrade() X-Git-Tag: v18.06.0-rc1~3501 X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=commitdiff_plain;h=ed49d0876;hp=df36b5e1b3d5de419a0c86b7d4bef99e7a8ecbb0 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 --- diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index d48135a6d3..576ff6c06c 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"