68 lines
2.0 KiB
Bash
68 lines
2.0 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
COMPA_TXT=compatibility.txt
|
||
|
|
||
|
ORIGIN_UPDATE_ZIP=../../../../oe-core/build/tmp-eglibc/deploy/images/mdm9607/mdm9607-ota-target-image-ubi.zip
|
||
|
NEW_ZIP=ota_target.zip
|
||
|
|
||
|
MODEM_IMAGES_ZIP=modem_images.zip
|
||
|
|
||
|
ORIGIN_MODEM_FIRWARE_IMAGE_DIR=../../../../../common/build/bin/image
|
||
|
MODEM_FIRWARE_IMAGE_DIR=firmware/image
|
||
|
MODEM_FIRWARE_DIR=firmware
|
||
|
|
||
|
SBL1_MBN_IMAGE=sbl1.mbn
|
||
|
ORIGIN_SBL1_MBN=../../../../../boot_images/build/ms/bin/9x45/nand/${SBL1_MBN_IMAGE}
|
||
|
|
||
|
APPSBOOT_MBN_IMAGE=appsboot.mbn
|
||
|
ORIGIN_APPSBOOT_MBN=../../../../oe-core/build/tmp-eglibc/deploy/images/mdm9607/${APPSBOOT_MBN_IMAGE}
|
||
|
|
||
|
ALL_IMAGES_TMP_DIR=all_images
|
||
|
|
||
|
# mkdir all_images
|
||
|
rm -rf ${ALL_IMAGES_TMP_DIR}
|
||
|
mkdir -p ${ALL_IMAGES_TMP_DIR}
|
||
|
|
||
|
# copy mdm9607-ota-target-image-ubi.zip
|
||
|
cp -f ${ORIGIN_UPDATE_ZIP} ${ALL_IMAGES_TMP_DIR}/${NEW_ZIP}
|
||
|
|
||
|
# unzip ota_target.zip for product
|
||
|
PRODUCT_FILE=SYSTEM/etc/default_config/product
|
||
|
unzip -o ${ALL_IMAGES_TMP_DIR}/${NEW_ZIP} ${PRODUCT_FILE} -d ./
|
||
|
FIRMWARE_VER=`cat ${PRODUCT_FILE} | grep -oP '(?<=option firmware_ver ")[\d\.]+'`
|
||
|
PRODUCT_ID=`cat ${PRODUCT_FILE} | grep -oP '(?<=option product_id ")[\d\.]+'`
|
||
|
|
||
|
# zip modem firmware images
|
||
|
if [ ! -d ${ORIGIN_MODEM_FIRWARE_IMAGE_DIR} ]; then
|
||
|
echo "firmware path not exist!"
|
||
|
exit 1
|
||
|
fi
|
||
|
mkdir -p ${ALL_IMAGES_TMP_DIR}/${MODEM_FIRWARE_IMAGE_DIR}
|
||
|
cp ${ORIGIN_MODEM_FIRWARE_IMAGE_DIR}/* ${ALL_IMAGES_TMP_DIR}/${MODEM_FIRWARE_IMAGE_DIR}
|
||
|
|
||
|
# zip sbl1.mbn
|
||
|
if [ ! -f ${ORIGIN_SBL1_MBN} ]; then
|
||
|
echo "sbl1.mbn not exist!"
|
||
|
exit 1
|
||
|
fi
|
||
|
cp ${ORIGIN_SBL1_MBN} ${ALL_IMAGES_TMP_DIR}/${SBL1_MBN_IMAGE}
|
||
|
|
||
|
# zip appsboot.mbn
|
||
|
if [ ! -f ${ORIGIN_APPSBOOT_MBN} ]; then
|
||
|
echo "appsboot.mbn path not exist!"
|
||
|
exit 1
|
||
|
fi
|
||
|
cp ${ORIGIN_APPSBOOT_MBN} ${ALL_IMAGES_TMP_DIR}/${APPSBOOT_MBN_IMAGE}
|
||
|
|
||
|
# produce compatibility.txt
|
||
|
echo ${PRODUCT_ID}:${FIRMWARE_VER} > ${ALL_IMAGES_TMP_DIR}/${COMPA_TXT}
|
||
|
|
||
|
ALL_IMAGES_ZIP=all_images_${FIRMWARE_VER}.zip
|
||
|
rm -rf ${ALL_IMAGES_ZIP}
|
||
|
zip -ry ${ALL_IMAGES_ZIP} ${ALL_IMAGES_TMP_DIR}
|
||
|
rm -rf ${ALL_IMAGES_TMP_DIR}
|
||
|
|
||
|
# rm unuse files
|
||
|
rm -rf SYSTEM
|
||
|
|