Skip to content

Commit

Permalink
nxboot: fix incorrect confirm state for directly flashed image
Browse files Browse the repository at this point in the history
API function nxboot_get_confirm was returning incorrect value if
primary image was flashed directly into the embedded flash (this
image does not have a tail, but is automatically considered as valid
and stable based on the header magic value).

Signed-off-by: Michal Lenc <[email protected]>
  • Loading branch information
michallenc committed Nov 5, 2024
1 parent 400a8e3 commit a55288b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion boot/nxboot/loader/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,14 +577,17 @@ int nxboot_get_state(struct nxboot_state *state)
int nxboot_get_confirm(void)
{
int primary;
struct nxboot_img_header primary_header;

primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
if (primary < 0)
{
return ERROR;
}

if (get_image_flag(primary, NXBOOT_CONFIRMED_PAGE_INDEX))
get_image_header(primary, &primary_header);
if (get_image_flag(primary, NXBOOT_CONFIRMED_PAGE_INDEX) ||
primary_header.magic == NXBOOT_HEADER_MAGIC_INV)
{
return 1;
}
Expand Down

0 comments on commit a55288b

Please sign in to comment.