Skip to content

Commit 2d5afd0

Browse files
michallencxiaoxiang781216
authored andcommitted
nxboot: fix incorrect confirm state for directly flashed image
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 <michallenc@seznam.cz>
1 parent f97304f commit 2d5afd0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

boot/nxboot/loader/boot.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,14 +577,17 @@ int nxboot_get_state(struct nxboot_state *state)
577577
int nxboot_get_confirm(void)
578578
{
579579
int primary;
580+
struct nxboot_img_header primary_header;
580581

581582
primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
582583
if (primary < 0)
583584
{
584585
return ERROR;
585586
}
586587

587-
if (get_image_flag(primary, NXBOOT_CONFIRMED_PAGE_INDEX))
588+
get_image_header(primary, &primary_header);
589+
if (get_image_flag(primary, NXBOOT_CONFIRMED_PAGE_INDEX) ||
590+
primary_header.magic == NXBOOT_HEADER_MAGIC_INV)
588591
{
589592
return 1;
590593
}

0 commit comments

Comments
 (0)