Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boot: bootutil: swap_scratch: Fix compressed image sector size check #2085

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nordicjm
Copy link
Collaborator

@nordicjm nordicjm commented Oct 7, 2024

Fixes an issue with compressed update support whereby it would wrong continue to check all sector sizes and error due to the sector sizes of the secondary slot being 0 until overflow

Fixes an issue with compressed update support whereby it would wrong
continue to check all sector sizes and error due to the sector sizes
of the secondary slot being 0 until overflow

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
nordicjm added a commit to nordicjm/sdk-mcuboot that referenced this pull request Oct 7, 2024
…tor size check

Fixes an issue with compressed update support whereby it would wrong
continue to check all sector sizes and error due to the sector sizes
of the secondary slot being 0 until overflow

Upstream PR: mcu-tools/mcuboot#2085

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
@nordicjm
Copy link
Collaborator Author

nordicjm commented Oct 7, 2024

@d3zd3z @utzig TFM looks to be broken again?

Missed this in the log: fatal: unable to access 'https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/': The requested URL returned error: 502 surely the CI scripts should be updated so that they error out if cloning fails rather than blindly continuing?

nordicjm added a commit to nrfconnect/sdk-mcuboot that referenced this pull request Oct 7, 2024
…tor size check

Fixes an issue with compressed update support whereby it would wrong
continue to check all sector sizes and error due to the sector sizes
of the secondary slot being 0 until overflow

Upstream PR: mcu-tools/mcuboot#2085

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Comment on lines +194 to +204
size_t sector_size = boot_img_sector_size(state, BOOT_SECONDARY_SLOT, j);

#ifdef MCUBOOT_DECOMPRESS_IMAGES
if (sector_size == 0) {
/* Since this supports decompressed images, we can safely exit if slot1 is
* smaller than slot0.
*/
break;
}
#endif
sz1 += sector_size;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we even have a full run of the function boot_slots_compatible when decompression is enabled? It seems that we are going to ignore the difference anyway, so we could just skip the check at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slot 0 should still be larger than slot 1, plus it can be possibly enhanced in future if only some slots support compression

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.
Note for the future: for devices that have uniform erase block size and block sizes that equal for partitions, if the are placed on different devices, we should figure out compile time check for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants