Log output of upgrade binaries
authorAntoni <a.adaszkiewi@samsung.com>
Fri, 22 Mar 2024 12:02:36 +0000 (13:02 +0100)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 24 Apr 2024 01:50:02 +0000 (10:50 +0900)
Some more logs are also added when calling upgrade binaries.

Change-Id: I4a23d5d994604a112ff4805110749db38ed718dc

scripts/upgrade-support/upgrade-common.inc
scripts/upgrade-support/upgrade-prepare-partitions.sh

index 8d9d95f..9d8f959 100644 (file)
@@ -332,6 +332,12 @@ load_background_copy_list() {
        PARTITION_LIST=$(sed -e '/^#/d' -e '/^$/d' "${HAL_UPGRADE_CFG_DIR}/${HAL_PART_LIST_FILE}")
 }
 
+run_upgrade_binary() {
+       log "[Info] Running $1"
+       $1 2>&1 | tee -a "$LOG_FILE"
+       return ${PIPESTATUS[0]}
+}
+
 upgrade_images() {
        DELTA_TAR="$1"
        log "[Info] Flash images for update..."
@@ -376,35 +382,43 @@ upgrade_images() {
                        CURR_PARTITION="$("$BLKID_PRINT" "$EMMC_DEVICE" "$PART_NAME" "$CURRENT_AB")"
                fi
 
-               log "[Info] Flashing $DELTA_NAME... to $NEXT_PARTITION"
+               log "[Info] Flashing $DELTA_NAME... to $NEXT_PARTITION, Delta type: ${TYPE_S[0]}"
 
                local UP_RES
                untrap
                case "${TYPE_S[0]}" in
                        FULL_IMAGE)
-                               "$FOTA_DIR/upgrade-apply" --archive "$DELTA_TAR" \
-                                                         --dest "$NEXT_PARTITION" \
-                                                         --dest-size "$NEW_SIZE" \
-                                                         --archive-file "$DELTA_NAME" \
-                                                         --kind raw \
-                                                         --dest-sha1 "$NEW_SHA" && UP_RES=$? || UP_RES=$?
+                               run_upgrade_binary "$FOTA_DIR/upgrade-apply "`
+                                                                       `"--archive $DELTA_TAR "`
+                                                                       `"--dest $NEXT_PARTITION "`
+                                                                       `"--dest-size $NEW_SIZE "`
+                                                                       `"--archive-file $DELTA_NAME "`
+                                                                       `"--kind raw "`
+                                                                       `"--dest-sha1 $NEW_SHA"
+                               UP_RES=$?
                                ;;
                        DELTA_IMAGE)
-                               "$FOTA_DIR/upgrade-apply" --archive "$DELTA_TAR" \
-                                                         --dest "$NEXT_PARTITION" \
-                                                         --dest-size "$NEW_SIZE" \
-                                                         --archive-file "$DELTA_NAME" \
-                                                         --kind ss_brotli_patch \
-                                                         --patch-orig "$CURR_PARTITION" \
-                                                         --no-write-all \
-                                                         --dest-sha1 "$NEW_SHA" && UP_RES=$? || UP_RES=$?
+                               run_upgrade_binary "$FOTA_DIR/upgrade-apply "`
+                                                                       `"--archive $DELTA_TAR "`
+                                                                       `"--dest $NEXT_PARTITION "`
+                                                                       `"--dest-size $NEW_SIZE "`
+                                                                       `"--archive-file $DELTA_NAME "`
+                                                                       `"--kind ss_brotli_patch "`
+                                                                       `"--patch-orig $CURR_PARTITION "`
+                                                                       `"--no-write-all "`
+                                                                       `"--dest-sha1 $NEW_SHA"
+                               UP_RES=$?
                                ;;
                        DELTA_FS)
                                mkdir "$FOTA_DIR/partition_mnt"
                                mount "$NEXT_PARTITION" "$FOTA_DIR/partition_mnt"
-                               "$FOTA_DIR/upgrade-apply-deltafs"   --archive "$DELTA_TAR" \
-                                                                   --dest "$FOTA_DIR/partition_mnt" \
-                                                                   --archive-file "${DELTA_NAME}/" && UP_RES=$? || UP_RES=$?
+
+                               run_upgrade_binary "$FOTA_DIR/upgrade-apply-deltafs "`
+                                                                       `"--archive $DELTA_TAR "`
+                                                                       `"--dest $FOTA_DIR/partition_mnt "`
+                                                                       `"--archive-file $DELTA_NAME/"
+                               UP_RES=$?
+
                                umount "$NEXT_PARTITION"
                                rm -rf "$FOTA_DIR/partition_mnt"
                                ;;
index e40ad94..65db1c1 100755 (executable)
@@ -8,7 +8,6 @@ if [ ! -z "${UPGRADE_DEBUG}" ]; then
 fi
 
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
-
 FOTA_DIR="/opt/usr/data/fota"
 
 . "$FOTA_DIR"/upgrade-common.inc