scripts: odroid-xu4: remove non-necessary FUSE struct 56/138056/3
authorJunghoon Kim <jhoon20.kim@samsung.com>
Tue, 11 Jul 2017 02:06:05 +0000 (11:06 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 20 Jul 2017 08:07:45 +0000 (08:07 +0000)
This patch removes non-necessary fusing header struct and also aligns the xu4
downloader with xu3.

Change-Id: If434cece21d38854aa7906e1b85c8d2215a3756b
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
scripts/sd_fusing_xu4.sh

index 36cdaec..d37b9f9 100755 (executable)
@@ -9,7 +9,6 @@ declare -i FUSING_BINARY_NUM=0
 
 declare CONV_ASCII=""
 declare -i FUS_ENTRY_NUM=0
-declare -r FUSING_IMG="fusing.img"
 
 # binary name | part number | offset | bs
 declare -a PART_TABLE=(
@@ -23,18 +22,17 @@ declare -a PART_TABLE=(
        "system-data.img"               3       0       4M
        "user.img"                      5       0       4M
        "modules.img"                   6       0       512
-       $FUSING_IMG                     ""      3072    512
        )
 
-declare -r -i PART_TABLE_ROW=4
-declare -r -i PART_TABLE_COL=${#PART_TABLE[*]}/${PART_TABLE_ROW}
+declare -r -i PART_TABLE_COL=4
+declare -r -i PART_TABLE_ROW=${#PART_TABLE[*]}/${PART_TABLE_COL}
 
 # partition table support
 function get_index_use_name () {
        local -r binary_name=$1
 
-       for ((idx=0;idx<$PART_TABLE_COL;idx++)); do
-               if [ ${PART_TABLE[idx * ${PART_TABLE_ROW} + 0]} == $binary_name ]; then
+       for ((idx=0;idx<$PART_TABLE_ROW;idx++)); do
+               if [ ${PART_TABLE[idx * ${PART_TABLE_COL} + 0]} == $binary_name ]; then
                        return $idx
                fi
        done
@@ -99,32 +97,6 @@ function add_fusing_entry () {
        rm entry_size
 }
 
-function make_fusing_header () {
-       # header magic
-       echo -n "BFUS" > fus_hdr_magic
-       cat fus_hdr_magic | head -c 4 > fus_hdr
-
-       # entry number: 1 byte
-       convert_num_to_ascii $FUS_ENTRY_NUM
-       echo -n $CONV_ASCII > fus_hdr_entry_num
-       cat fus_hdr_entry_num /dev/zero | head -c 4 >> fus_hdr
-
-       rm fus_hdr_magic
-       rm fus_hdr_entry_num
-}
-
-function make_fusing_struct {
-       if [ -f entry ];then
-               make_fusing_header
-               cat fus_hdr entry /dev/zero | head -c 512 > $FUSING_IMG
-               rm fus_hdr entry
-
-               # Write Fusing Magic Number */
-               fusing_image $FUSING_IMG
-               rm $FUSING_IMG
-       fi
-}
-
 function fusing_image () {
        local -r fusing_img=$1
 
@@ -132,10 +104,10 @@ function fusing_image () {
        get_index_use_name $(basename $fusing_img)
        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 seek=${PART_TABLE[${part_idx} * ${PART_TABLE_ROW} + 2]}
-               local -r bs=${PART_TABLE[${part_idx} * ${PART_TABLE_ROW} + 3]}
+       if [ $part_idx -ne $PART_TABLE_ROW ];then
+               local -r device=$DEVICE${PART_TABLE[${part_idx} * ${PART_TABLE_COL} + 1]}
+               local -r seek=${PART_TABLE[${part_idx} * ${PART_TABLE_COL} + 2]}
+               local -r bs=${PART_TABLE[${part_idx} * ${PART_TABLE_COL} + 3]}
        else
                echo "Not supported binary: $fusing_img"
                return
@@ -288,7 +260,7 @@ function mkpart_3 () {
 
 function show_usage () {
        echo "- Usage:"
-       echo "  sudo ./sd_fusing*.sh -d <device> [-b <path> <path> ..] [--format]"
+       echo "  sudo ./sd_fusing_xu4.sh -d <device> [-b <path> <path> ..] [--format]"
 }
 
 function check_partition_format () {
@@ -344,8 +316,7 @@ function check_args () {
 
 function print_logo () {
        echo ""
-       echo "Odroid-XU4 downloader, version 0.5"
-       echo "Authors: Inha Song <ideal.song@samsung.com>"
+       echo "Odroid-XU3/4 downloader"
        echo ""
 }
 
@@ -393,5 +364,3 @@ done
 check_args
 check_partition_format
 fuse_image
-
-make_fusing_struct