SmartAudio/ota_pack.sh

48 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
OTA_PKG_NAME_VER=`cat $TINA_BUILD_TOP/lichee/linux-4.9/.version`
OTA_PKG_NAME=../tina_$OTA_PLAT_ota_$OTA_PKG_NAME_VER.tar.gz
OTA_TEMP_DIR=$TINA_BUILD_TOP/out/$TARGET_BOARD/ota
OTA_TOOLS_FILE=$TINA_BUILD_TOP/out/$TARGET_BOARD/tina_r311_tools_*.tar.gz
OTA_PACKAGE_FILE=$TINA_BUILD_TOP/out/$TARGET_BOARD/tina_r311_ota_*.tar.gz
echo "Step 1: Cleanup last resources......"
if [ "$TINA_BUILD_TOP" == "" ]; then
echo "please run lunch command first"
exit
fi
if [ "$TARGET_BOARD" == "" ]; then
echo "please run lunch command first"
exit
fi
[ -f $OTA_TOOLS_FILE ] && rm $OTA_TOOLS_FILE
[ -f $OTA_PACKAGE_FILE ] && rm $OTA_PACKAGE_FILE
echo "Step 2: Create prebuild tools packages......"
cd $TINA_BUILD_TOP/prebuilt/
tar -cvzf $TINA_BUILD_TOP/out/$TARGET_BOARD/tina_r311_tools_$OTA_PKG_NAME_VER.tar.gz ./r311/ > /dev/null
echo "Step 3: Create Work Directory......"
mkdir -p $OTA_TEMP_DIR
cd $OTA_TEMP_DIR
echo "Step 4: Copy Images......"
rm * -rf
cp ../boot.img ./
cp ../rootfs.img ./
echo "Step 5: Create MD5 Checksum File......"
md5sum * > ota.md5
echo "Step 6: Create OTA Packages......"
[ -f $OTA_PKG_NAME ] && rm $OTA_PKG_NAME
tar -cvzf ../tina_r311_ota_$OTA_PKG_NAME_VER.tar.gz ./* > /dev/null
echo "Step 7: Cleanup temp resource......"
rm -rf OTA_TEMP_DIR