check_ab_partition_scheme
check_used_block_device
unpack_file "$DELTA_TAR" "$CONFIG_FILE"
-if [ "$(device_board_get_partition_ab_cloned)" -eq 0 ]; then
- load_background_copy_list
- background_copy
-else
- echo "[Info] Partitions already cloned"
-fi
-set_upgrade_status 20
upgrade_images "$DOWNLOAD_DELTA"
set_upgrade_status 80
reboot_to_fota
}
do_update() {
- device_board_clear_partition_ab_cloned
-
if is_ab_upgrade; then
+ set_upgrade_status 5
+
+ if [ "$(device_board_get_partition_ab_cloned)" -eq 0 ]; then
+ unpack_file "${DOWNLOAD_DELTA}" "${SCRIPT_UPGRADE_PREPARE_PARTITIONS}"
+ if ! "${FOTA_DIR}/${SCRIPT_UPGRADE_PREPARE_PARTITIONS}"; then
+ exit_error
+ fi
+ else
+ echo "[Info] Partitions already cloned"
+ fi
+
+ set_upgrade_status 20
+
+ # In the next steps the content of the partitions of the second slot will
+ # be modified, so they will not be a clone of the current partitions
+ device_board_clear_partition_ab_cloned
+
if is_full_upgrade; then
# If the update.cfg file contains only PRE_UA type updates, we consider
# it a full upgrade. In this case the provided images will be flashed to
# the appropriate partitions directly from the archive so as not to
# consume additional space on the device.
unpack_file "${DOWNLOAD_DELTA}" "${SCRIPT_UPGRADE_FULL}"
- set_upgrade_status 5
if ! "${FOTA_DIR}/${SCRIPT_UPGRADE_FULL}" "${DOWNLOAD_DELTA}"; then
exit_error
fi
# Regular A/B Upgrade
unpack_file "${DOWNLOAD_DELTA}" "${SCRIPT_UPGRADE_PARTIAL}"
unpack_file "${DOWNLOAD_DELTA}" "${SCRIPT_UPGRADE_FOTA}"
- set_upgrade_status 5
-
- if [ "$(device_board_get_partition_ab_cloned)" -eq 0 ]; then
- unpack_file "${DOWNLOAD_DELTA}" "${SCRIPT_UPGRADE_PREPARE_PARTITIONS}"
- if ! "${FOTA_DIR}/${SCRIPT_UPGRADE_PREPARE_PARTITIONS}"; then
- exit_error
- fi
- else
- echo "[Info] Partitions already cloned"
- fi
-
- set_upgrade_status 20
if ! "${FOTA_DIR}/${SCRIPT_UPGRADE_PARTIAL}" "${DOWNLOAD_DELTA}"; then
exit_error