Avoid touching the swap status area in overwrite-only
The swap status area is used to maintain information that allows
recovery when interrupted in the middle of a swap. This area has no
usefulness when doing a overwrite-only upgrade, which always copies the
entire slot.
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index 8ce56a6..9ddf82d 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -476,6 +476,11 @@
memset(bs, 0, sizeof *bs);
+#ifdef MCUBOOT_OVERWRITE_ONLY
+ /* Overwrite-only doesn't make use of the swap status area. */
+ return 0;
+#endif
+
status_loc = boot_status_source();
switch (status_loc) {
case BOOT_STATUS_SOURCE_NONE:
@@ -502,6 +507,7 @@
rc = boot_read_status_bytes(fap, bs);
flash_area_close(fap);
+
return rc;
}