Add creating /dev/disk/by-partlabel links 62/317762/3 accepted/tizen_9.0_unified accepted/tizen_unified_toolchain tizen_9.0 accepted/tizen/9.0/unified/20241030.232723 accepted/tizen/unified/20240926.050041 accepted/tizen/unified/toolchain/20241004.101226 accepted/tizen/unified/x/20240926.095709 accepted/tizen/unified/x/asan/20241013.235502 tizen_9.0_m2_release
authorMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 13 Sep 2024 22:45:15 +0000 (00:45 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 24 Sep 2024 00:57:37 +0000 (09:57 +0900)
Such links are useful for Tizen Flash Manager and allows to specify
partition images map using names not hardcoded numbers.

Change-Id: I3cbe53cdd2835461e43771d2eb70fd0d69edfc0e
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
src/initrd-recovery/00-initrd-recovery.list.in
src/initrd-recovery/init

index 9f17f2d639fcdd64a4127625696dd1824876b99c..15c849b34ecf1a3c4f94301f4381efee41511835 100644 (file)
@@ -5,6 +5,7 @@ MVWITHLIBS="
 "
 
 WITHLIBS="
+/bin/ln
 /usr/bin/bash
 /usr/bin/cat
 /usr/bin/cp
@@ -12,6 +13,7 @@ WITHLIBS="
 /usr/bin/mount
 /usr/bin/sleep
 /usr/bin/sync
+/usr/bin/tr
 /usr/bin/umount
 /usr/bin/dirname
 /usr/bin/openssl
index 196e488a11e6a62d3cd5508257989f8b3f351cbe..9c4328c9ea45576702b7744053c17eb40dc3a7e2 100755 (executable)
@@ -4,6 +4,7 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin
 
 INFORM_PATH=/mnt/inform
 HAL_PATH=/mnt/hal
+PARTLABEL_PATH=/dev/disk/by-partlabel
 FS_RETRY_COUNT=10
 
 SYNC="/bin/sync"
@@ -14,6 +15,8 @@ DIRNAME="/bin/dirname"
 REBOOT="/sbin/reboot"
 BLKID="/usr/sbin/blkid"
 CP="/bin/cp"
+LN="/bin/ln"
+TR="/usr/bin/tr"
 BOW_RESTORE="/sbin/bow-restore"
 export SUPERFS=""
 export PART_ROOTFS=""
@@ -34,6 +37,16 @@ mount_partitions() {
     "$MOUNT" -t devpts devpts /dev/pts
 }
 
+#------------------------------------------------
+#       create_disk_links
+#------------------------------------------------
+create_disk_links() {
+    "$MKDIR" -p ${PARTLABEL_PATH}
+    "$BLKID" -s PARTLABEL | "$TR" -s '":=' '   ' | while read dev p name; do
+        "$LN" -s ${dev} ${PARTLABEL_PATH}/${name}
+    done
+}
+
 #------------------------------------------------
 #       mount_inform
 #------------------------------------------------
@@ -260,6 +273,7 @@ echo "You entered into /sbin/init on initrd"
 
 mount_partitions
 wait_find_partitions
+create_disk_links
 mount_inform
 restore_partitions
 copy_hal_data