Skip to content

Commit 7fd42d5

Browse files
committed
Revert "bootutil: fix swap-move brick with padded image0"
This reverts commit 296949e. Signed-off-by: Fabio Utzig <[email protected]>
1 parent 3c1e4fb commit 7fd42d5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

boot/bootutil/src/swap_move.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,13 @@ boot_move_sector_up(int idx, uint32_t sz, struct boot_loader_state *state,
315315
old_off = boot_img_sector_off(state, BOOT_PRIMARY_SLOT, idx - 1);
316316

317317
if (bs->idx == BOOT_STATUS_IDX_0) {
318-
rc = swap_erase_trailer_sectors(state, fap_pri);
319-
assert(rc == 0);
318+
if (bs->source != BOOT_STATUS_SOURCE_PRIMARY_SLOT) {
319+
rc = swap_erase_trailer_sectors(state, fap_pri);
320+
assert(rc == 0);
320321

321-
rc = swap_status_init(state, fap_pri, bs);
322-
assert(rc == 0);
322+
rc = swap_status_init(state, fap_pri, bs);
323+
assert(rc == 0);
324+
}
323325

324326
rc = swap_erase_trailer_sectors(state, fap_sec);
325327
assert(rc == 0);

0 commit comments

Comments
 (0)