From 71a0365a8ae3522f43b5ee64aa32ffd43d5aa158 Mon Sep 17 00:00:00 2001 From: Sunmin Lee Date: Thu, 9 Nov 2017 21:00:30 +0900 Subject: [PATCH] New update type: PRE_UA Separate update type: FULL_IMG) Generate update package with full image whether the image was in old image or not PRE_UA) Special case of FULL_IMG - this image will be flashed by update -trigger in advance of update agent (UA) Change-Id: I923a7f34adf4516587a2d40c9b8405eb127a77a2 Signed-off-by: Sunmin Lee --- mk_delta/common/bin/mk_delta.sh | 9 +------ mk_delta/common/bin/mk_part_delta.sh | 49 ++++++++++++++++++++++-------------- mk_delta/tw1/cfg/delta.cfg | 6 ++--- mk_delta/tw2/cfg/delta.cfg | 5 ++-- 4 files changed, 37 insertions(+), 32 deletions(-) diff --git a/mk_delta/common/bin/mk_delta.sh b/mk_delta/common/bin/mk_delta.sh index a2ca51d..8966b95 100755 --- a/mk_delta/common/bin/mk_delta.sh +++ b/mk_delta/common/bin/mk_delta.sh @@ -219,8 +219,7 @@ do fn_process_extra_delta else ${MK_PART_DELTA} ${part_name} ${update_type} ${part_bin} ${delta_bin} - RET=$? - if [ "$RET" = "0" ] || [ "$RET" = "2" ]; then + if [ "$?" = "0" ]; then if [ "${update_type}" = "DELTA_FS" ]; then sudo mv data/${PART_OUT} ${RESULT_DIR}/${part_bin} sudo mv ${RESULT_DIR}/${part_bin} ${DELTA_DIR} @@ -228,12 +227,6 @@ do sudo mv data/${PART_OUT} ${RESULT_DIR}/${part_bin} sudo mv ${RESULT_DIR}/${part_bin}/${delta_bin} ${DELTA_DIR} fi - if [ "$RET" = "2" ]; then - echo "Omit ${part_name} from cfg" - sudo cat ${UPDATE_CFG_PATH} | sed /^${part_name}/d \ - > "${UPDATE_CFG_PATH}_tmp" - sudo mv "${UPDATE_CFG_PATH}_tmp" ${UPDATE_CFG_PATH} - fi else sudo rm -rf ${RESULT_DIR}/${part_bin} echo "Error: Abort Delta Generation" diff --git a/mk_delta/common/bin/mk_part_delta.sh b/mk_delta/common/bin/mk_part_delta.sh index 968e067..f8de095 100755 --- a/mk_delta/common/bin/mk_part_delta.sh +++ b/mk_delta/common/bin/mk_part_delta.sh @@ -86,7 +86,7 @@ fn_mk_full_img() PART_IMG_NEW=${PART_IMG_ORG}.new #---- untar partition image and rename for old & new ---- - if [ "z$1" = "z" ]; then + if [ ! "z${OLD_TAR_FILE}" = "z" ]; then echo "untar ${OLD_TAR_FILE}" tar xvf ${OLD_TAR_DIR}/${OLD_TAR_FILE} ${PART_IMG_ORG} if [ "$?" != "0" ]; then @@ -102,8 +102,8 @@ fn_mk_full_img() fi sudo mv ${PART_IMG_ORG} ${PART_IMG_NEW} - #---- check whether the binaries are same ---- - if [ "z$1" = "z" ]; then + if [ ! "z${OLD_TAR_FILE}" = "z" ]; then + #---- check whether the binaries are same ---- sudo diff ${PART_IMG_OLD} ${PART_IMG_NEW} if [ "$?" = "0" ]; then echo "[${PART_NAME}] two binaries are same" @@ -119,17 +119,11 @@ fn_mk_full_img() echo "[${PART_NAME}] Failed to generate DELTA" exit 1 fi - fi sudo mv ${PART_IMG_NEW} ${OUTPUT_DIR}/${PART_IMG_ORG} sudo chown ${MY_ID}:${MY_ID} ${OUTPUT_DIR}/${PART_IMG_ORG} - if [ ! "z$1" = "z" ]; then - # Return 2 informs mk_delta to omit this image - # from update.cfg file - return 2 - fi return 0 } @@ -406,6 +400,29 @@ fn_mk_delta_fs() return 0 } +#------------------------------------------------------------------------------ +# Function : +# fn_mk_flash_img +# + +fn_mk_flash_img() +{ + PART_IMG_NEW=${PART_BIN} + + #---- untar partition image and rename for old & new ---- + echo "untar ${NEW_TAR_FILE}" + tar xvf ${NEW_TAR_DIR}/${NEW_TAR_FILE} ${PART_IMG_NEW} + if [ "$?" != "0" ]; then + return 1; + fi + + sudo mv ${PART_IMG_NEW} ${OUTPUT_DIR}/${PART_BIN} + sudo chown ${MY_ID}:${MY_ID} ${OUTPUT_DIR}/${PART_BIN} + + return 0 +} + + #------------------------------------------------------------------------------ # Function : @@ -552,10 +569,8 @@ elif [ "${PART_NAME}" = "ROOTFS" ]; then fn_extract_from_image ${PART_BIN} /usr/bin/upgrade-trigger.sh fi -OLD_TAR_MISSING= if [ "z${OLD_TAR_FILE}" = "z" ]; then - OLD_TAR_MISSING="TRUE" - if [ ! "${UPDATE_TYPE}" = "FULL_IMG" ]; then + if [ ! "${UPDATE_TYPE}" = "FULL_IMG" ] && [ ! "${UPDATE_TYPE}" = "PRE_UA" ]; then echo "[old] tar file does not exist in ${DATA_DIR}/${OLD_TAR_DIR} which contains ${PART_BIN}" #exit 0, cos this is not an error. exit 0 @@ -567,7 +582,7 @@ if [ "z${NEW_TAR_FILE}" = "z" ]; then exit 0 fi -if [ "z${OLD_TAR_MISSING}" = "z" ]; then +if [ ! "z${OLD_TAR_FILE}" = "z" ]; then echo "[old] ${OLD_TAR_FILE} contains ${PART_BIN}" fi echo "[new] ${NEW_TAR_FILE} contains ${PART_BIN}" @@ -585,12 +600,8 @@ if [ ! -d ${OUTPUT_DIR} ]; then mkdir ${OUTPUT_DIR} fi -if [ "${UPDATE_TYPE}" = "FULL_IMG" ]; then - fn_mk_full_img $OLD_TAR_MISSING - RET=$? - if [ "$RET" != "0" ]; then - exit $RET - fi +if [ "${UPDATE_TYPE}" = "FULL_IMG" ] || [ "${UPDATE_TYPE}" = "PRE_UA" ]; then + fn_mk_full_img elif [ "${UPDATE_TYPE}" = "DELTA_IMG" ]; then fn_mk_delta_img elif [ "${UPDATE_TYPE}" = "DELTA_FS" ]; then diff --git a/mk_delta/tw1/cfg/delta.cfg b/mk_delta/tw1/cfg/delta.cfg index 3883b10..3a38a8e 100755 --- a/mk_delta/tw1/cfg/delta.cfg +++ b/mk_delta/tw1/cfg/delta.cfg @@ -3,6 +3,6 @@ ROOTFS rootfs.img rootfs.img/ DELTA_FS /dev/mmcblk0p13 0 BOOT zImage delta.boot DELTA_IMG /dev/mmcblk0p6 0 -RECOVERY zImage-recovery zImage-recovery FULL_IMG /dev/mmcblk0p7 0 -RAMDISK1 ramdisk.img ramdisk.img FULL_IMG /dev/mmcblk0p8 0 -RAMDISK2 ramdisk-recovery.img ramdisk-recovery.img FULL_IMG /dev/mmcblk0p4 0 +RECOVERY zImage-recovery zImage-recovery PRE_UA /dev/mmcblk0p7 0 +RAMDISK1 ramdisk.img ramdisk.img PRE_UA /dev/mmcblk0p8 0 +RAMDISK2 ramdisk-recovery.img ramdisk-recovery.img PRE_UA /dev/mmcblk0p4 0 diff --git a/mk_delta/tw2/cfg/delta.cfg b/mk_delta/tw2/cfg/delta.cfg index b8d0354..89ac6d4 100755 --- a/mk_delta/tw2/cfg/delta.cfg +++ b/mk_delta/tw2/cfg/delta.cfg @@ -3,5 +3,6 @@ ROOTFS rootfs.img rootfs.img/ DELTA_FS /dev/mmcblk0p15 0 BOOT dzImage delta.boot DELTA_IMG /dev/mmcblk0p8 0 -RAMDISK1 ramdisk.img delta.ramdisk1 DELTA_IMG /dev/mmcblk0p5 0 -RAMDISK2 ramdisk-recovery.img delta.ramdisk2 DELTA_IMG /dev/mmcblk0p4 0 +RECOVERY dzImage-recovery dzImage-recovery PRE_UA /dev/mmcblk0p9 0 +RAMDISK1 ramdisk.img ramdisk.img PRE_UA /dev/mmcblk0p5 0 +RAMDISK2 ramdisk-recovery.img ramdisk-recovery.img PRE_UA /dev/mmcblk0p4 0 -- 2.7.4