From 9ad467d774c61c7da56403d422081b74bc488655 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Mon, 8 Jun 2020 10:01:16 +0200 Subject: [PATCH] tizen: sd_fusing_rpi3.sh: Support for non-sdX partition names Properly find partiton device names for the given block device. In case of MMC (or loop) partition names are created in a different way (/dev/mmcblk0p1) than for typical USB pen-drives (/dev/sdb1). Signed-off-by: Marek Szyprowski Change-Id: I4e3e272acd85bcd5a54ff8102a3978d18ea5687e --- scripts/tizen/sd_fusing_rpi3.sh | 40 +++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/scripts/tizen/sd_fusing_rpi3.sh b/scripts/tizen/sd_fusing_rpi3.sh index 2503ed89b5..c72fc63ce4 100755 --- a/scripts/tizen/sd_fusing_rpi3.sh +++ b/scripts/tizen/sd_fusing_rpi3.sh @@ -75,7 +75,8 @@ function fusing_image () { local -r -i part_idx=$? if [ $part_idx -ne $PART_TABLE_COL ];then - local -r device=$DEVICE${PART_TABLE[${part_idx} * ${PART_TABLE_ROW} + 1]} + local -r num=${PART_TABLE[${part_idx} * ${PART_TABLE_ROW} + 1]} + local -r device=/dev/`lsblk ${DEVICE} -o KNAME | grep -G "[a-z]${num}\$"` local -r bs=${PART_TABLE[${part_idx} * ${PART_TABLE_ROW} + 2]} else echo "Not supported binary: $fusing_img" @@ -249,20 +250,35 @@ function mkpart_3 () { __EOF__ fi - mkfs.vfat -F 16 ${DISK}1 -n $BOOT - mkfs.ext4 -q ${DISK}2 -L $ROOTFS -F - mkfs.ext4 -q ${DISK}3 -L $SYSTEMDATA -F - mkfs.ext4 -q ${DISK}5 -L $USER -F - mkfs.ext4 -q ${DISK}6 -L $MODULE -F - mkfs.ext4 -q ${DISK}7 -L $RAMDISK -F - mkfs.ext4 -q ${DISK}8 -L $RAMDISK_RECOVERY -F - mkfs.ext4 -q ${DISK}9 -L $INFORM -F + local -r PART1=/dev/`lsblk ${DISK} -o KNAME | grep -G "[a-z]1\$"` + mkfs.vfat -F 16 ${PART1} -n $BOOT + + local -r PART2=/dev/`lsblk ${DISK} -o KNAME | grep -G "[a-z]2\$"` + mkfs.ext4 -q ${PART2} -L $ROOTFS -F + + local -r PART3=/dev/`lsblk ${DISK} -o KNAME | grep -G "[a-z]3\$"` + mkfs.ext4 -q ${PART3} -L $SYSTEMDATA -F + + local -r PART5=/dev/`lsblk ${DISK} -o KNAME | grep -G "[a-z]5\$"` + mkfs.ext4 -q ${PART5} -L $USER -F + + local -r PART6=/dev/`lsblk ${DISK} -o KNAME | grep -G "[a-z]6\$"` + mkfs.ext4 -q ${PART6} -L $MODULE -F + + local -r PART7=/dev/`lsblk ${DISK} -o KNAME | grep -G "[a-z]7\$"` + mkfs.ext4 -q ${PART7} -L $RAMDISK -F + + local -r PART8=/dev/`lsblk ${DISK} -o KNAME | grep -G "[a-z]8\$"` + mkfs.ext4 -q ${PART8} -L $RAMDISK_RECOVERY -F + + local -r PART9=/dev/`lsblk ${DISK} -o KNAME | grep -G "[a-z]9\$"` + mkfs.ext4 -q ${PART9} -L $INFORM -F # create "reboot-param.bin" file in inform partition for passing reboot parameter # It should be done only once upon partition format. - umount ${DISK}9 + umount ${PART9} mkdir mnt_tmp - mount -t ext4 ${DISK}9 ./mnt_tmp + mount -t ext4 ${PART9} ./mnt_tmp touch ./mnt_tmp/reboot-param.bin sync umount ./mnt_tmp @@ -350,7 +366,7 @@ function check_device () { function print_logo () { echo "" - echo "Raspberry Pi3 downloader, version 1.3.1" + echo "Raspberry Pi3 downloader, version 1.4.0" echo "" } -- 2.34.1