[openwrt/openwrt] mediatek: allow mounting ubifs by its device and partition name

LEDE Commits lede-commits at lists.infradead.org
Sat Jul 12 11:23:06 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/d8754f38665b723686a9b0de3175af1aa9ca983c

commit d8754f38665b723686a9b0de3175af1aa9ca983c
Author: Yonghyu Ban <yhban at silicon.moe>
AuthorDate: Wed Mar 19 17:11:54 2025 +0900

    mediatek: allow mounting ubifs by its device and partition name
    
    Since not every device sets an ubifs partition name as the same as their
    parent mtd partition, this change allows mount_ubi_part to usable in
    other devices
    
    Signed-off-by: Yonghyu Ban <yhban at silicon.moe>
    Link: https://github.com/openwrt/openwrt/pull/19203
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part b/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part
index 87e51a4429..ddbb1d1293 100644
--- a/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part
+++ b/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part
@@ -1,13 +1,14 @@
 . /lib/functions/system.sh
 
 mount_ubi_part() {
-	local part_name="$1"
-	local mtd_num=$(grep $part_name /proc/mtd | cut -c4)
+	local mtd_name="$1"
+	local part_name="$2"
+	local mtd_num=$(grep \"$mtd_name\" /proc/mtd | cut -d: -f1 | sed 's/mtd//g')
 	local ubi_num=$(ubiattach -m $mtd_num | \
 		awk -F',' '/UBI device number [0-9]{1,}/{print $1}' | \
 		awk '{print $4}')
-	mkdir /tmp/$part_name
-	mount -r -t ubifs ubi$ubi_num:$part_name /tmp/$part_name
+	mkdir /tmp/$mtd_name
+	mount -r -t ubifs ubi$ubi_num:$part_name /tmp/$mtd_name
 }
 
 preinit_mount_cfg_part() {
@@ -16,7 +17,7 @@ preinit_mount_cfg_part() {
 	mercusys,mr90x-v1|\
 	tplink,archer-ax80-v1|\
 	tplink,re6000xd)
-		mount_ubi_part "tp_data"
+		mount_ubi_part "tp_data" "tp_data"
 		;;
 	*)
 		;;




More information about the lede-commits mailing list