Skip to content

Commit 5703b6e

Browse files
committed
bootutil: swap-move: Remove check of the image size in swap_run
This check is not useful because it is already done during the validation of the image and was also making sure there was no firmware data in the first trailer sector, which is no more needed. Signed-off-by: Thomas Altenbach <[email protected]>
1 parent 88e80a2 commit 5703b6e

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

boot/bootutil/src/swap_move.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,8 @@ void
689689
swap_run(struct boot_loader_state *state, struct boot_status *bs,
690690
uint32_t copy_size)
691691
{
692-
uint32_t sz;
693692
uint32_t sector_sz;
694693
uint32_t idx;
695-
uint32_t trailer_sz;
696-
uint32_t first_trailer_idx;
697694
uint32_t last_idx;
698695
size_t fallback_trailer_sector;
699696
const struct flash_area *fap_pri;
@@ -704,32 +701,6 @@ swap_run(struct boot_loader_state *state, struct boot_status *bs,
704701
last_idx = find_last_idx(state, copy_size);
705702
sector_sz = boot_img_sector_size(state, BOOT_PRIMARY_SLOT, 0);
706703

707-
/*
708-
* When starting a new swap upgrade, check that there is enough space.
709-
*/
710-
if (boot_status_is_reset(bs)) {
711-
sz = 0;
712-
trailer_sz = boot_trailer_sz(BOOT_WRITE_SZ(state));
713-
first_trailer_idx = boot_img_num_sectors(state, BOOT_PRIMARY_SLOT) - 1;
714-
715-
while (1) {
716-
sz += sector_sz;
717-
if (sz >= trailer_sz) {
718-
break;
719-
}
720-
first_trailer_idx--;
721-
}
722-
723-
if (last_idx >= first_trailer_idx) {
724-
BOOT_LOG_WRN("Not enough free space to run swap upgrade");
725-
BOOT_LOG_WRN("required %d bytes but only %d are available",
726-
(last_idx + 1) * sector_sz,
727-
first_trailer_idx * sector_sz);
728-
bs->swap_type = BOOT_SWAP_TYPE_NONE;
729-
return;
730-
}
731-
}
732-
733704
fap_pri = BOOT_IMG_AREA(state, BOOT_PRIMARY_SLOT);
734705
assert(fap_pri != NULL);
735706

0 commit comments

Comments
 (0)