Commit 32afe85d authored by Fabio Utzig's avatar Fabio Utzig Committed by Fabio Utzig
Browse files

bootutil: fix boostrapping in swap-move

Fix boostrapping in swap-move that was being skipped due to the having
an erased header in the primary slot which caused an early return
because of the requirement of having to re-read image headers when
"moving" an image during an upgrade.

Signed-off-by: default avatarFabio Utzig <fabio.utzig@nordicsemi.no>
parent 3d77c959
Loading
Loading
Loading
Loading
+7 −0
Changes for boot/bootutil/src/loader.c: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1566,7 +1566,14 @@ boot_prepare_image_for_update(struct boot_loader_state *state,
         * have been updated in the previous function call.
         */
        rc = boot_read_image_headers(state, !boot_status_is_reset(bs), bs);
#ifdef MCUBOOT_BOOTSTRAP
        /* When bootstrapping it's OK to not have image magic in the primary slot */
        if (rc != 0 && (BOOT_CURR_IMG(state) != BOOT_PRIMARY_SLOT ||
                boot_check_header_erased(state, BOOT_PRIMARY_SLOT) != 0)) {
#else
        if (rc != 0) {
#endif

            /* Continue with next image if there is one. */
            BOOT_LOG_WRN("Failed reading image headers; Image=%u",
                    BOOT_CURR_IMG(state));