From: Jaehoon Chung Date: Thu, 14 Oct 2021 23:11:37 +0000 (+0900) Subject: scripts: tizen: sd_fusing_rpi3: update the rpi3 script X-Git-Tag: accepted/tizen/unified/20221108.163909~67 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7507fc6e4e883ee1c29f990d04f2fb8afa82e0e;p=platform%2Fkernel%2Fu-boot.git scripts: tizen: sd_fusing_rpi3: update the rpi3 script To prevent wrong operation, check the result whether format is succeed or not. If it's failed, exit this script. And if there is already "mnt_tmp" directory, remove it to clear the previous status. It's changed the location to remove a partition table with dd command with count is changed from 16 to 32. Because it seems that partition table doesn't clear. Change-Id: Id3eb739d5add8784d0f41eca8a7e4360a8a0dbfd Signed-off-by: Jaehoon Chung --- diff --git a/scripts/tizen/sd_fusing_rpi3.sh b/scripts/tizen/sd_fusing_rpi3.sh index 0bd2bee..f38f40d 100755 --- a/scripts/tizen/sd_fusing_rpi3.sh +++ b/scripts/tizen/sd_fusing_rpi3.sh @@ -236,13 +236,12 @@ function mkpart_3 () { umount $mnt done + echo "Remove partition table..." + dd if=/dev/zero of=$DISK bs=512 count=32 conv=notrunc if [ $sfdisk_new == 1 ]; then - echo "Remove partition table..." if [ $support_delete == 1 ]; then sfdisk --delete $DISK - else - dd if=/dev/zero of=$DISK bs=512 count=16 conv=notrunc fi sfdisk $DISK <<-__EOF__ @@ -259,9 +258,6 @@ function mkpart_3 () { ,${RESERVED2_SZ}MiB,,- __EOF__ else - echo "Remove partition table..." - dd if=/dev/zero of=$DISK bs=512 count=16 conv=notrunc - # calculate start positions for alignment for extended partitions let "USER_START = 4 + $BOOT_SZ + $ROOTFS_SZ + $DATA_SZ + 1" let "MODULE_START = $USER_START + $USER_SZ + 1" @@ -290,6 +286,10 @@ function mkpart_3 () { local PART=/dev/`lsblk ${DISK} -o TYPE,KNAME | grep part | awk '{ print $2 }' | grep -G "[a-z]${PART_TABLE[$idx * ${PART_TABLE_COL} + 1]}\$"` if [ "${PART_TABLE[$idx * ${PART_TABLE_COL} + 4]}" == "vfat" ]; then mkfs.vfat -F 16 ${PART} -n ${PART_TABLE[$idx * ${PART_TABLE_COL} + 3]} + if [ $? -eq 1 ]; then + echo "Failed to format as FAT filesystem" + exit -1 + fi elif [ "${PART_TABLE[$idx * ${PART_TABLE_COL} + 4]}" == "ext4" ]; then mkfs.ext4 -q ${PART} -L ${PART_TABLE[$idx * ${PART_TABLE_COL} + 3]} -F else @@ -302,6 +302,10 @@ function mkpart_3 () { # create "reboot-param.bin" file in inform partition for passing reboot parameter # It should be done only once upon partition format. + if [ -d mnt_tmp ]; then + echo "Remove the existing mnt_tmp directory!!" + rm -rf mnt_tmp + fi mkdir mnt_tmp mount -t ext4 ${PART9} ./mnt_tmp touch ./mnt_tmp/reboot-param.bin @@ -394,7 +398,7 @@ function check_device () { function print_logo () { echo "" - echo "Raspberry Pi downloader, version 2.1.1" + echo "Raspberry Pi downloader, version 2.2.1" echo "" }