[openwrt/openwrt] treewide: fix initramfs detection

LEDE Commits lede-commits at lists.infradead.org
Sun Dec 20 12:15:30 EST 2020


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/7a181a65f2e5d19e379cebbb980aa2f2985709e2

commit 7a181a65f2e5d19e379cebbb980aa2f2985709e2
Author: Robert Marko <robimarko at gmail.com>
AuthorDate: Sun Dec 20 18:02:54 2020 +0100

    treewide: fix initramfs detection
    
    Commit "initramfs: switch to tmpfs to fix ujail" switched initramfs to
    now use tmpfs, it causes $(rootfs_type) to now return tmpfs when
    running initramfs image instead of being empty.
    
    This broke initramfs detection which is required so that when installing
    on MikroTik devices firmware partition would first get erased fully
    before writing.
    
    So, lets test for $(rootfs_type) returning "tmpfs" instead.
    
    Fixes: 7fd3c68 ("initramfs: switch to tmpfs to fix ujail)
    
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh | 2 +-
 target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh  | 2 +-
 2 files changed, 2 insertions(+), 2 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 5ee5492369..97d388168f 100644
--- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh
@@ -39,7 +39,7 @@ platform_do_upgrade() {
 		;;
 	*)
 		# NOR devices: erase firmware if booted from initramfs
-		[ -z "$(rootfs_type)" ] && mtd erase firmware
+		[ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware
 
 		default_do_upgrade "$1"
 		;;
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index c68b012d0b..99ed36e429 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -31,7 +31,7 @@ platform_do_upgrade() {
 	mikrotik,routerboard-760igs|\
 	mikrotik,routerboard-m11g|\
 	mikrotik,routerboard-m33g)
-		[ -z "$(rootfs_type)" ] && mtd erase firmware
+		[ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware
 		;;
 	asus,rt-ac65p|\
 	asus,rt-ac85p)



More information about the lede-commits mailing list