Use same format for scratch and slot trailer
Prior to this change, the scratch image trailer had a different format
from a slot image trailer. Specifically:
1. The scratch trailer only contained a single set of status entries
(three bytes); the slot trailer contained `BOOT_STATUS_MAX_ENTRIES`
sets of status entries.
2. The scratch trailer did not contain the `copy_done` field.
This inconsistency required some extra conditional logic in the trailer
handling code. It is simpler to just use the same trailer format
everywhere.
This commit removes this inconsistency. Now, the scratch trailer
structure is identical to that of the slot trailer.
Signed-off-by: Christopher Collins <ccollins@apache.org>
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index ac26bd2..c784c31 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -1026,7 +1026,7 @@
/* delete starting from last sector and moving to beginning */
sector = boot_img_num_sectors(&boot_data, slot) - 1;
- trailer_sz = boot_slots_trailer_sz(BOOT_WRITE_SZ(&boot_data));
+ trailer_sz = boot_trailer_sz(BOOT_WRITE_SZ(&boot_data));
total_sz = 0;
do {
sz = boot_img_sector_size(&boot_data, slot, sector);
@@ -1072,7 +1072,7 @@
img_off = boot_img_sector_off(&boot_data, BOOT_PRIMARY_SLOT, idx);
copy_sz = sz;
- trailer_sz = boot_slots_trailer_sz(BOOT_WRITE_SZ(&boot_data));
+ trailer_sz = boot_trailer_sz(BOOT_WRITE_SZ(&boot_data));
/* sz in this function is always sized on a multiple of the sector size.
* The check against the start offset of the last sector