tools: mkimage_signed: use the version information that passed by argument
authorJaehoon Chung <jh80.chung@samsung.com>
Fri, 24 Nov 2017 01:17:50 +0000 (10:17 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 21 Jan 2019 07:07:59 +0000 (16:07 +0900)
If version information changed, it needs to modify the script everytime.
It's too difficult that developer should knows the version information.

It's just changed to use the version information that passed by
argument.

Change-Id: I8e87b25557859ad731a3ed667fe52906205ecc5a
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
tools/mkimage_signed.sh

index 651d673bc20d198da79611401a5dab3c2436be03..ac8b425a138ebd43ebc677b961ab03b951933c42 100755 (executable)
 #}
 
 INPUT_ARGS=2
+MAX_ARGS=3
 INPUT_BIN=${1}
 CONFIG=${2}
+VERSION=${3}
 
 OUTPUT_BIN="u-boot-mmc.bin"
 OUTPUT_SIZE=$((1024*1024))
@@ -28,10 +30,11 @@ SIGN_HDR_SIZE=512
 INPUT_SIZE_LIMIT=$((${OUTPUT_SIZE} - ${SIGN_HDR_SIZE}))
 
 # Check arguments count
-if [ $# != $INPUT_ARGS ]; then
+if [ $# -lt $INPUT_ARGS -a $# -gt $MAX_ARGS ]; then
        echo Bad arguments number!
        echo "Usage:"
-       echo "./mkimage_signed.sh <input binary> <config>"
+       echo "./mkimage_signed.sh <input binary> <config> {version}"
+       echo "  - {version} is optional"
        echo "e.g.:"
        echo "./mkimage_signed.sh u-boot-multi.bin tizen_config"
        exit
@@ -61,7 +64,11 @@ fi
 
 echo -n "BoOt" > sig-magic
 echo -n `date +%Y%m%d%H` > sig-date
-echo -n "none" > sig-version
+if [ $VERSION ]; then
+       echo -n $VERSION > sig-version
+else
+       echo -n "none" > sig-version
+fi
 
 if [ $CONFIG == "tizen_defconfig" ]; then
        echo -n "slp_midasq" > sig-board