tizen: sd_fusing_amlogic: sync with recent script for old tools 71/248271/1
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 25 Nov 2020 02:49:27 +0000 (11:49 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 25 Nov 2020 02:56:27 +0000 (11:56 +0900)
The script was not fully sync with recent sd_fusing script change
and it cayses old sfdisk size issue because not enough EXTEND_SZ
to align block offset in extended partition. Update the parts with
recent rpi fusing script and also remove duplicated data size
variable.

Change-Id: I5bd939f9a29093d9acaf76e2b4cae7b1c8ae2de0
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
scripts/tizen/sd_fusing_amlogic.sh

index aab4aee..2e904fe 100755 (executable)
@@ -2,6 +2,7 @@
 
 declare FORMAT=""
 declare DEVICE=""
+declare -i OLD_DD=0
 
 # Binaires array for fusing
 declare -a FUSING_BINARY_ARRAY
@@ -74,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"
@@ -175,10 +177,9 @@ function mkpart_3 () {
        if [ $sfdisk_new == 1 ]; then
                local -r EXTEND_SZ=8
        else
-               local -r EXTEND_SZ=10
+               local -r EXTEND_SZ=12
        fi
 
-       let "USER_SZ = $SIZE_MB - $BOOT_SZ - $ROOTFS_SZ - $DATA_SZ - $MODULE_SZ - $RAMDISK_SZ - $EXTEND_SZ"
        let "USER_SZ = $SIZE_MB - $BOOT_SZ - $ROOTFS_SZ - $DATA_SZ - $MODULE_SZ - $RAMDISK_SZ - $RAMDISK_RECOVERY_SZ - $RESERVED0_SZ - $EXTEND_SZ - $RESERVED1_SZ - $RESERVED2_SZ"
 
        local -r BOOT=boot
@@ -373,7 +374,7 @@ function check_device () {
 
 function print_logo () {
        echo ""
-       echo "Khadas VIM3 downloader, version 1.0"
+       echo "Khadas VIM3 downloader, version 1.1"
        echo ""
 }