[openwrt/openwrt] bcm27xx: base-files: properly detect boot partition

LEDE Commits lede-commits at lists.infradead.org
Thu Feb 1 02:33:36 PST 2024


noltari pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/c82ca6dc743f382533693de4826747ec0ee16ce9

commit c82ca6dc743f382533693de4826747ec0ee16ce9
Author: Álvaro Fernández Rojas <noltari at gmail.com>
AuthorDate: Tue Jan 30 21:41:26 2024 +0100

    bcm27xx: base-files: properly detect boot partition
    
    Automatically detect boot partition instead of forcing /dev/mmcblk0p1.
    This way users can still get /boot mounted when booting from USB.
    
    (cherry picked from commit a39176010299f3ad7d325b03d892fbf65e6dd23b)
    Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
 target/linux/bcm27xx/base-files/lib/preinit/79_move_config | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/target/linux/bcm27xx/base-files/lib/preinit/79_move_config b/target/linux/bcm27xx/base-files/lib/preinit/79_move_config
index c9fb59a64f..db5bf93b62 100644
--- a/target/linux/bcm27xx/base-files/lib/preinit/79_move_config
+++ b/target/linux/bcm27xx/base-files/lib/preinit/79_move_config
@@ -2,16 +2,20 @@
 
 . /lib/upgrade/common.sh
 
-BOOTPART=/dev/mmcblk0p1
-
 move_config() {
-	if [ -b $BOOTPART ]; then
+	local partdev
+
+	export_bootdevice && export_partdevice partdev 1 || {
+		partdev=mmcblk0p1
+	}
+
+	if [ -b "/dev/$partdev" ]; then
 		insmod nls_cp437
 		insmod nls_iso8859-1
 		insmod fat
 		insmod vfat
 		mkdir -p /boot
-		mount -t vfat -o rw,noatime $BOOTPART /boot
+		mount -t vfat -o rw,noatime /dev/$partdev /boot
 		[ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
 	fi
 }




More information about the lede-commits mailing list