Add basic change for v1453
Change-Id: I9497a61bbc3717f66413794a4e7dee0347c0bc33
diff --git a/pack.sh b/pack.sh
new file mode 100755
index 0000000..af7dd2e
--- /dev/null
+++ b/pack.sh
@@ -0,0 +1,345 @@
+#!/bin/bash
+
+# Get version.
+versionFile='mbtk/include/mbtk_device_info.h'
+version=`cat $versionFile | grep -w 'MBTK_DEVICES_REVISION' | cut -d '"' -f 2 `
+BUILD_PROJECT=`cat build_version | grep PROJECT | cut -d '=' -f 2`
+# CUSTOM_MODEL=`cat build_version | grep CUSTOM_MODEL | cut -d '=' -f 2`
+BUILD_PARTITION=`cat build_version | grep PARTITION | cut -d '=' -f 2`
+BUILD_CUSTOM=`cat build_version | grep CUSTOM | cut -d '=' -f 2`
+SEC_SUPPORT=`cat build_version | grep SEC_SUPPORT | cut -d '=' -f 2`
+
+if [ -f mbtk/mbtk_version ];then
+ PATCH_INDEX=`cat mbtk/mbtk_version | grep PATCH_INDEX | cut -d '=' -f 2`
+ if [ -z $PATCH_INDEX ];then
+ PATCH_INDEX=0
+ fi
+ if [ $PATCH_INDEX -lt 10 ];then
+ PATCH_INDEX=00"$PATCH_INDEX"
+ else
+ if [ $PATCH_INDEX -lt 100 ];then
+ PATCH_INDEX=0"$PATCH_INDEX"
+ fi
+ fi
+
+ # T108v05.02b01_YX.00
+ MBTK_M1901_VERSION=${version#*:= }
+ MBTK_M1901_VERSION_1=`echo $MBTK_M1901_VERSION | cut -d '.' -f 1`
+ MBTK_M1901_VERSION_2=`echo $MBTK_M1901_VERSION | cut -d '.' -f 2`
+ MBTK_M1901_VERSION_3=`echo $MBTK_M1901_VERSION | cut -d '.' -f 3`
+ if [[ $MBTK_M1901_VERSION_3 == *_* ]];then # 有 '_'
+ MBTK_M1901_VERSION_3_1=`echo $MBTK_M1901_VERSION_3 | cut -d '_' -f 1`
+ MBTK_M1901_VERSION_3_2=`echo $MBTK_M1901_VERSION_3 | cut -d '_' -f 2`
+
+ MBTK_M1901_VERSION=$MBTK_M1901_VERSION_1.$MBTK_M1901_VERSION_2."$PATCH_INDEX"_$MBTK_M1901_VERSION_3_2
+ else
+ MBTK_M1901_VERSION=$MBTK_M1901_VERSION_1.$MBTK_M1901_VERSION_2.$PATCH_INDEX
+ fi
+else
+ MBTK_M1901_VERSION=${version#*:= }
+fi
+
+MBTK_M1901_VERSION_DIR=out/$MBTK_M1901_VERSION
+MBTK_M1901_MDB_DIR=$MBTK_M1901_VERSION_DIR/MDB
+
+# BIN_LIC=-glibc
+
+if [ "$BUILD_PARTITION" == "ab" ];then
+ CUSTOM_MODEL="$BUILD_PROJECT"_AB_V2
+else
+ CUSTOM_MODEL="$BUILD_PROJECT"_A_V2
+fi
+
+if [ ! -z $BUILD_CUSTOM ];then
+ CUSTOM_MODEL="$CUSTOM_MODEL"_$BUILD_CUSTOM
+fi
+
+if [ "$BUILD_PROJECT" == "L901CD-L" ];then
+ BUILD_TARGAT=asr1903
+ BUILD_FLAG=p501
+ if [ "$SEC_SUPPORT" == "Y" ];then
+ OUT_DIR=bin/"$BUILD_TARGAT""$BUILD_FLAG"sec"$BIN_LIC"/swd
+ if [ "$BUILD_PARTITION" == "ab" ];then
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_SDTIM_LPDDR2_AB
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_SDTIM_LPDDR2_AB_OTA_BLF
+ else
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_SDTIM_LPDDR2
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_SDTIM_LPDDR2_OTA_BLF
+ fi
+ else
+ OUT_DIR=bin/"$BUILD_TARGAT""$BUILD_FLAG""$BIN_LIC"/swd
+ if [ "$BUILD_PARTITION" == "ab" ];then
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_SDTIM_LPDDR2_AB
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_SDTIM_LPDDR2_AB_OTA_BLF
+ else
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_SDTIM_LPDDR2
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_SDTIM_LPDDR2_OTA_BLF
+ fi
+ fi
+elif [ "$BUILD_PROJECT" == "T108" -o "$BUILD_PROJECT" == "L508_X6" -o "$BUILD_PROJECT" == "T108-2" ];then
+ BUILD_TARGAT=asr1806
+ BUILD_FLAG=p301
+ if [ "$SEC_SUPPORT" == "Y" ];then
+ OUT_DIR=bin/"$BUILD_TARGAT""$BUILD_FLAG"sec"$BIN_LIC"/swd
+ if [ "$BUILD_PARTITION" == "ab" ];then
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_SDTIM_LPDDR2_AB
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_SDTIM_LPDDR2_AB_OTA_BLF
+ else
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_SDTIM_LPDDR2
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_SDTIM_LPDDR2_OTA_BLF
+ fi
+ else
+ OUT_DIR=bin/"$BUILD_TARGAT""$BUILD_FLAG""$BIN_LIC"/swd
+ if [ "$BUILD_PARTITION" == "ab" ];then
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_SDTIM_LPDDR2_AB
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_SDTIM_LPDDR2_AB_OTA_BLF
+ else
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_SDTIM_LPDDR2
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_SDTIM_LPDDR2_OTA_BLF
+ fi
+ fi
+else
+ BUILD_TARGAT=asr1803
+ BUILD_FLAG=p401
+ if [ "$SEC_SUPPORT" == "Y" ];then
+ OUT_DIR=bin/"$BUILD_TARGAT""$BUILD_FLAG"sec/swd
+ if [ "$BUILD_PARTITION" == "ab" ];then
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_CMCC_LPDDR2_AB
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_CMCC_LPDDR2_AB_OTA_BLF
+ else
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_CMCC_LPDDR2
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_TOS_CMCC_LPDDR2_OTA_BLF
+ fi
+ else
+ OUT_DIR=bin/"$BUILD_TARGAT""$BUILD_FLAG""$BIN_LIC"/swd
+ if [ "$BUILD_PARTITION" == "ab" ];then
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_CMCC_LPDDR2_AB
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_CMCC_LPDDR2_AB_OTA_BLF
+ else
+ BIN_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_CMCC_LPDDR2
+ BIN_OTA_BLF="$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_CMCC_LPDDR2_OTA_BLF
+ fi
+ fi
+fi
+
+
+
+echo "PROJECT = $BUILD_PROJECT"
+echo $MBTK_M1901_VERSION : $BUILD_PARTITION : $1
+echo "CUSTOM_MODEL=$CUSTOM_MODEL"
+
+function excmd()
+{
+ echo -e "\e[32mExcmd:\e[0m $@ " && sleep 0.05
+ $@
+}
+
+function copy()
+{
+ excmd cp $OUT_DIR/$1 $MBTK_M1901_VERSION_DIR
+}
+
+function mk_dir()
+{
+ if [ -d $MBTK_M1901_VERSION_DIR ]; then
+ excmd rm -rf $MBTK_M1901_VERSION_DIR
+ fi
+
+ if [ -f $MBTK_M1901_VERSION_DIR.zip ]; then
+ excmd rm -f $MBTK_M1901_VERSION_DIR.zip
+ fi
+
+ excmd mkdir -p $MBTK_M1901_VERSION_DIR
+ excmd mkdir -p $MBTK_M1901_MDB_DIR
+
+ if [ "$BUILD_TARGAT" == "asr1903" ];then
+ excmd mkdir -p $MBTK_M1901_VERSION_DIR/LAPW
+ elif [ "$BUILD_TARGAT" == "asr1806" ];then
+ excmd mkdir -p $MBTK_M1901_VERSION_DIR/FACT
+ else
+ excmd mkdir -p $MBTK_M1901_VERSION_DIR/FLCN
+ fi
+}
+
+function generate_version_bin()
+{
+ if [ -d $VERSION_STR_CN ];then
+ rm -rf $VERSION_STR_CN
+ fi
+ if [ -d $VERSION_STR_EU ];then
+ rm -rf $VERSION_STR_EU
+ fi
+ if [ -d $VERSION_STR_LA ];then
+ rm -rf $VERSION_STR_LA
+ fi
+
+ cp -r $MBTK_M1901_VERSION $VERSION_STR_CN
+ cd $VERSION_STR_CN
+ rm "DEF(全擦).blf"
+ rm "EU(全擦).blf"
+ rm "LA(全擦).blf"
+ cd ..
+ zip -q -r $VERSION_STR_CN.zip $VERSION_STR_CN
+
+ cp -r $MBTK_M1901_VERSION $VERSION_STR_EU
+ cd $VERSION_STR_EU
+ rm "DEF(全擦).blf"
+ rm "CN(全擦).blf"
+ rm "LA(全擦).blf"
+ cd ..
+ zip -q -r $VERSION_STR_EU.zip $VERSION_STR_EU
+
+ cp -r $MBTK_M1901_VERSION $VERSION_STR_LA
+ cd $VERSION_STR_LA
+ rm "DEF(全擦).blf"
+ rm "EU(全擦).blf"
+ rm "CN(全擦).blf"
+ cd ..
+ zip -q -r $VERSION_STR_LA.zip $VERSION_STR_LA
+}
+
+function copy_bin_1806()
+{
+ excmd cp $OUT_DIR/../fota/$BIN_OTA_BLF $MBTK_M1901_VERSION_DIR/"$BUILD_TARGAT"_"$BUILD_FLAG"_QSPINAND_Trusted_SDTIM_LPDDR2_OTA_BLF
+ if [ -n "$1" -a "$1" == "mobiletek" ] ;then
+ copy $BIN_BLF.blf
+ echo $MBTK_M1901_VERSION | grep DEMO
+ if [ $? -eq 0 ];then
+ copy "$BIN_BLF"_MBTK.blf
+ fi
+ else
+ copy "$BIN_BLF"_MBTK.blf
+ fi
+
+ # 修改版本号
+ # T108v05.02b01_YX.00 or T108v05.02b01_YX.001
+ VERSION_STR_1=`echo $MBTK_M1901_VERSION | cut -d '.' -f 1`
+ VERSION_STR_2=`echo $MBTK_M1901_VERSION | cut -d '.' -f 2`
+ VERSION_STR_3=`echo $MBTK_M1901_VERSION | cut -d '.' -f 3`
+ if [[ $VERSION_STR_2 == *_* ]];then # 有 '_'
+ VERSION_STR_2_1=`echo $VERSION_STR_2 | cut -d '_' -f 1`
+ VERSION_STR_2_2=`echo $VERSION_STR_2 | cut -d '_' -f 2`
+ VERSION_STR_CN=$VERSION_STR_1."$VERSION_STR_2_1"CN_$VERSION_STR_2_2.$VERSION_STR_3
+ VERSION_STR_EU=$VERSION_STR_1."$VERSION_STR_2_1"EU_$VERSION_STR_2_2.$VERSION_STR_3
+ VERSION_STR_LA=$VERSION_STR_1."$VERSION_STR_2_1"LA_$VERSION_STR_2_2.$VERSION_STR_3
+ else
+ VERSION_STR_CN=$VERSION_STR_1."$VERSION_STR_2"CN.$VERSION_STR_3
+ VERSION_STR_EU=$VERSION_STR_1."$VERSION_STR_2"EU.$VERSION_STR_3
+ VERSION_STR_LA=$VERSION_STR_1."$VERSION_STR_2"LA.$VERSION_STR_3
+ fi
+
+# echo "CN : $VERSION_STR_CN"
+# echo "EU : $VERSION_STR_EU"
+# echo "LA : $VERSION_STR_LA"
+# echo "DEF : $MBTK_M1901_VERSION"
+
+ if [ -n "$1" -a "$1" == "mobiletek" ] ;then
+ date_str=`date "+%Y/%m/%d %H:%M:%S"`
+ asr_baseline=`cat $OUT_DIR/mversion`
+ echo $date_str
+ if [ "$BUILD_TARGAT" == "asr1903" ];then
+ # 支持4G、5G
+ [ -f mbtk/device_info_generate ] && mbtk/device_info_generate -a ab -b $VERSION_STR_CN -d $BUILD_PROJECT -e $CUSTOM_MODEL -f cn -g "$date_str" -h 19 -i 12 -j $asr_baseline -o $MBTK_M1901_VERSION_DIR/dev_info_cn.bin
+ [ -f mbtk/device_info_generate ] && mbtk/device_info_generate -a ab -b $VERSION_STR_EU -d $BUILD_PROJECT -e $CUSTOM_MODEL -f eu -g "$date_str" -h 19 -i 12 -j $asr_baseline -o $MBTK_M1901_VERSION_DIR/dev_info_eu.bin
+ [ -f mbtk/device_info_generate ] && mbtk/device_info_generate -a ab -b $VERSION_STR_LA -d $BUILD_PROJECT -e $CUSTOM_MODEL -f sa -g "$date_str" -h 19 -i 12 -j $asr_baseline -o $MBTK_M1901_VERSION_DIR/dev_info_la.bin
+ [ -f mbtk/device_info_generate ] && mbtk/device_info_generate -a ab -b $MBTK_M1901_VERSION -d $BUILD_PROJECT -e $CUSTOM_MODEL -g "$date_str" -h 19 -i 12 -j $asr_baseline -o $MBTK_M1901_VERSION_DIR/dev_info_def.bin
+ else
+ # 支持2G、3G、4G
+ [ -f mbtk/device_info_generate ] && mbtk/device_info_generate -a ab -b $VERSION_STR_CN -d $BUILD_PROJECT -e $CUSTOM_MODEL -f cn -g "$date_str" -h 15 -i 7 -j $asr_baseline -o $MBTK_M1901_VERSION_DIR/dev_info_cn.bin
+ [ -f mbtk/device_info_generate ] && mbtk/device_info_generate -a ab -b $VERSION_STR_EU -d $BUILD_PROJECT -e $CUSTOM_MODEL -f eu -g "$date_str" -h 15 -i 7 -j $asr_baseline -o $MBTK_M1901_VERSION_DIR/dev_info_eu.bin
+ [ -f mbtk/device_info_generate ] && mbtk/device_info_generate -a ab -b $VERSION_STR_LA -d $BUILD_PROJECT -e $CUSTOM_MODEL -f sa -g "$date_str" -h 15 -i 7 -j $asr_baseline -o $MBTK_M1901_VERSION_DIR/dev_info_la.bin
+ [ -f mbtk/device_info_generate ] && mbtk/device_info_generate -a ab -b $MBTK_M1901_VERSION -d $BUILD_PROJECT -e $CUSTOM_MODEL -g "$date_str" -h 15 -i 7 -j $asr_baseline -o $MBTK_M1901_VERSION_DIR/dev_info_def.bin
+ fi
+
+ if [ -f $MBTK_M1901_VERSION_DIR/$BIN_BLF.blf ];then
+ cp $MBTK_M1901_VERSION_DIR/$BIN_BLF.blf $MBTK_M1901_VERSION_DIR/"CN(全擦)".blf
+ cp $MBTK_M1901_VERSION_DIR/$BIN_BLF.blf $MBTK_M1901_VERSION_DIR/"EU(全擦)".blf
+ cp $MBTK_M1901_VERSION_DIR/$BIN_BLF.blf $MBTK_M1901_VERSION_DIR/"LA(全擦)".blf
+ cp $MBTK_M1901_VERSION_DIR/$BIN_BLF.blf $MBTK_M1901_VERSION_DIR/"DEF(全擦)".blf
+ rm $MBTK_M1901_VERSION_DIR/$BIN_BLF.blf
+
+ sed -i "s/dev_info.bin/dev_info_cn.bin/" $MBTK_M1901_VERSION_DIR/"CN(全擦)".blf
+ sed -i "s/dev_info.bin/dev_info_eu.bin/" $MBTK_M1901_VERSION_DIR/"EU(全擦)".blf
+ sed -i "s/dev_info.bin/dev_info_la.bin/" $MBTK_M1901_VERSION_DIR/"LA(全擦)".blf
+ sed -i "s/dev_info.bin/dev_info_def.bin/" $MBTK_M1901_VERSION_DIR/"DEF(全擦)".blf
+ fi
+ if [ -f $MBTK_M1901_VERSION_DIR/"$BIN_BLF"_MBTK.blf ];then
+ cp $MBTK_M1901_VERSION_DIR/"$BIN_BLF"_MBTK.blf $MBTK_M1901_VERSION_DIR/MBTK_CN.blf
+ cp $MBTK_M1901_VERSION_DIR/"$BIN_BLF"_MBTK.blf $MBTK_M1901_VERSION_DIR/MBTK_EU.blf
+ cp $MBTK_M1901_VERSION_DIR/"$BIN_BLF"_MBTK.blf $MBTK_M1901_VERSION_DIR/MBTK_LA.blf
+ cp $MBTK_M1901_VERSION_DIR/"$BIN_BLF"_MBTK.blf $MBTK_M1901_VERSION_DIR/MBTK_DEF.blf
+ rm $MBTK_M1901_VERSION_DIR/"$BIN_BLF"_MBTK.blf
+
+ sed -i "s/dev_info.bin/dev_info_cn.bin/" $MBTK_M1901_VERSION_DIR/MBTK_CN.blf
+ sed -i "s/dev_info.bin/dev_info_eu.bin/" $MBTK_M1901_VERSION_DIR/MBTK_EU.blf
+ sed -i "s/dev_info.bin/dev_info_la.bin/" $MBTK_M1901_VERSION_DIR/MBTK_LA.blf
+ sed -i "s/dev_info.bin/dev_info_def.bin/" $MBTK_M1901_VERSION_DIR/MBTK_DEF.blf
+ fi
+
+ copy "$BUILD_TARGAT"_CP_ReliableData_CMCC.bin
+ fi
+
+ copy "$BUILD_TARGAT"_AP_ReliableData.bin
+ copy "$BUILD_TARGAT"_TLoader_QSPINAND.bin
+ if [ "$BUILD_TARGAT" == "asr1903" ];then
+ excmd cp $OUT_DIR/LAPW/hotfix.bin $MBTK_M1901_VERSION_DIR/LAPW/
+ copy tim_lapw_qspinand.bin
+ copy tim_lapw_qspinand2.bin
+ copy "$BUILD_TARGAT"_TUpdater_QSPINAND.bin
+ copy "$BUILD_TARGAT"_BX2.bin
+ elif [ "$BUILD_TARGAT" == "asr1806" ];then
+ excmd cp $OUT_DIR/FACT/hotfix.bin $MBTK_M1901_VERSION_DIR/FACT/
+ copy tim_fact_qspinand.bin
+ copy tim_fact_qspinand2.bin
+ copy "$BUILD_TARGAT"_TUpdater_QSPINAND.bin
+ copy "$BUILD_TARGAT"_MSA.bin
+ else
+ excmd cp $OUT_DIR/FLCN/hotfix.bin $MBTK_M1901_VERSION_DIR/FLCN/
+ copy "$BUILD_TARGAT"_MSA.bin
+ fi
+ copy "$BUILD_TARGAT"_TLoader_QSPINAND_ProductBuild.bin
+
+ copy "$BUILD_TARGAT"_ARBEL.bin
+ copy "$BUILD_TARGAT"_RFPLUGIN.bin
+ copy openwrt-mmp-"$BUILD_TARGAT"-u-boot.bin
+ copy openwrt-mmp-"$BUILD_TARGAT"-zImage
+ copy openwrt-mmp-"$BUILD_TARGAT"-root.squashfs
+ copy openwrt-mmp-"$BUILD_TARGAT"-oem_data.ubi
+ copy DTim.Primary
+ copy DTim.PPsetting
+ copy DTim.PPsetting2
+ copy DTim.Recovery
+ copy mversion
+ copy SWDownloader.exe
+ if [ "$SEC_SUPPORT" == "Y" ];then
+ copy "$BUILD_TARGAT"_tos.bin
+ copy DDR_*
+ copy DKB_timheader.bin
+ fi
+ if [ -f marvell/swd/FALCON/logo.img ];then
+ cp marvell/swd/FALCON/logo.img $MBTK_M1901_VERSION_DIR
+ fi
+
+ excmd cp $OUT_DIR/Boerne_DIAG.mdb.txt $MBTK_M1901_MDB_DIR/AP_MDB.txt
+ excmd cp $OUT_DIR/MDB.txt $MBTK_M1901_MDB_DIR/CP_MDB.txt
+# excmd cp $OUT_DIR/vmlinux.bin $MBTK_M1901_MDB_DIR/vmlinux.bin
+
+ CUR_PWD=`pwd`
+ cd out
+
+ # 生成各地区的固件
+ if [ -n "$1" -a "$1" == "mobiletek" ] ;then
+ generate_version_bin
+ fi
+
+ zip -q -r $MBTK_M1901_VERSION.zip $MBTK_M1901_VERSION
+ cd $CUR_PWD
+}
+
+mk_dir
+if [ -n "$1" ];then
+ copy_bin_1806 $1
+else
+ copy_bin_1806
+fi
+