Skip to content

Commit 5f22ef6

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 <thomas.altenbach@legrand.com>
1 parent 4fb7af0 commit 5f22ef6

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
@@ -546,11 +546,8 @@ void
546546
swap_run(struct boot_loader_state *state, struct boot_status *bs,
547547
uint32_t copy_size)
548548
{
549-
uint32_t sz;
550549
uint32_t sector_sz;
551550
uint32_t idx;
552-
uint32_t trailer_sz;
553-
uint32_t first_trailer_idx;
554551
uint32_t last_idx;
555552
const struct flash_area *fap_pri;
556553
const struct flash_area *fap_sec;
@@ -560,32 +557,6 @@ swap_run(struct boot_loader_state *state, struct boot_status *bs,
560557
last_idx = find_last_idx(state, copy_size);
561558
sector_sz = boot_img_sector_size(state, BOOT_PRIMARY_SLOT, 0);
562559

563-
/*
564-
* When starting a new swap upgrade, check that there is enough space.
565-
*/
566-
if (boot_status_is_reset(bs)) {
567-
sz = 0;
568-
trailer_sz = boot_trailer_sz(BOOT_WRITE_SZ(state));
569-
first_trailer_idx = boot_img_num_sectors(state, BOOT_PRIMARY_SLOT) - 1;
570-
571-
while (1) {
572-
sz += sector_sz;
573-
if (sz >= trailer_sz) {
574-
break;
575-
}
576-
first_trailer_idx--;
577-
}
578-
579-
if (last_idx >= first_trailer_idx) {
580-
BOOT_LOG_WRN("Not enough free space to run swap upgrade");
581-
BOOT_LOG_WRN("required %d bytes but only %d are available",
582-
(last_idx + 1) * sector_sz,
583-
first_trailer_idx * sector_sz);
584-
bs->swap_type = BOOT_SWAP_TYPE_NONE;
585-
return;
586-
}
587-
}
588-
589560
fap_pri = BOOT_IMG_AREA(state, BOOT_PRIMARY_SLOT);
590561
assert(fap_pri != NULL);
591562

0 commit comments

Comments
 (0)