mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
boot/nxboot/loader/boot.c: avoid unwanted confirm on double update
Following steps led to incorrect behavior: - upload update image - restart device and perform the update - upload the same update image again without confirming This led to the unwanted confirm of the update image. This change ensures the update image is not confirmed by uploading the same image to the update slot. The correct behavior is to perform revert to the last stable image if this occurs. Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
parent
0e65af606f
commit
7ac03cfcef
1 changed files with 6 additions and 2 deletions
|
|
@ -313,6 +313,8 @@ static enum nxboot_update_type
|
|||
nxboot_progress(nxboot_progress_end);
|
||||
return NXBOOT_UPDATE_TYPE_UPDATE;
|
||||
}
|
||||
|
||||
flash_partition_erase_first_sector(update);
|
||||
}
|
||||
|
||||
nxboot_progress(nxboot_progress_end);
|
||||
|
|
@ -643,12 +645,14 @@ int nxboot_get_state(struct nxboot_state *state)
|
|||
else if (IS_INTERNAL_MAGIC(primary_header.magic))
|
||||
{
|
||||
recovery_pointer = primary_header.magic & NXBOOT_RECOVERY_PTR_MASK;
|
||||
if (recovery_pointer == NXBOOT_SECONDARY_SLOT_NUM)
|
||||
if (recovery_pointer == NXBOOT_SECONDARY_SLOT_NUM &&
|
||||
IS_INTERNAL_MAGIC(secondary_header.magic))
|
||||
{
|
||||
state->primary_confirmed =
|
||||
primary_header.crc == secondary_header.crc;
|
||||
}
|
||||
else if (recovery_pointer == NXBOOT_TERTIARY_SLOT_NUM)
|
||||
else if (recovery_pointer == NXBOOT_TERTIARY_SLOT_NUM &&
|
||||
IS_INTERNAL_MAGIC(tertiary_header.magic))
|
||||
{
|
||||
state->primary_confirmed =
|
||||
primary_header.crc == tertiary_header.crc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue