Skip to content

Commit 2819d6a

Browse files
committed
Added 'flash_area_get_image_buildnum' to retrieve build #
1 parent 32c4cb7 commit 2819d6a

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

include/flash.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,7 @@ int flash_area_get_sectors(int fa_id, uint32_t *count,
130130
int flash_area_id_from_image_slot(int slot);
131131
int flash_area_id_to_image_slot(int area_id);
132132

133+
/* Get the build number of the image stored at the begining of the given flash area */
134+
uint32_t flash_area_get_image_buildnum(const struct flash_area *fap);
135+
133136
#endif /* H_UTIL_FLASH_MAP_ */

lib/bootutil/src/bootutil_misc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,3 +772,9 @@ uint8_t flash_area_erased_val(const struct flash_area *fap)
772772
(void)fap;
773773
return 0xff;
774774
}
775+
776+
uint32_t flash_area_get_image_buildnum(const struct flash_area *fap)
777+
{
778+
struct image_header *hdr = (struct image_header *)(fap->fa_off);
779+
return hdr->ih_ver.iv_build_num;
780+
}

tools/ed25519/ed25519_sign.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ int main(int argc, char *argv[])
145145
hdr->ih_hdr_size = IMAGE_FIRMWARE_OFFSET;
146146
hdr->ih_img_size = st.st_size;
147147
hdr->ih_ver.iv_major = version;
148+
hdr->ih_ver.iv_build_num = (uint32_t)(st.st_mtime);
148149

149150
/* Sha256 */
150151
wc_Sha256Update(&sha, (uint8_t *)hdr, IMAGE_FIRMWARE_OFFSET);

0 commit comments

Comments
 (0)