-
Notifications
You must be signed in to change notification settings - Fork 781
loader: Allow to specify slot number in version comparison #2343
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
base: main
Are you sure you want to change the base?
loader: Allow to specify slot number in version comparison #2343
Conversation
Sorry, accidental approval. |
ab92081
to
a79cd55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some stuff needs moving around and clarification.
Addition to dependency requires update of design documents.
#ifdef CONFIG_BOOT_VERSION_CMP_USE_SLOT_NUMBER | ||
#define MCUBOOT_VERSION_CMP_USE_SLOT_NUMBER | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more verbose description on MCUBOOT_VERSION_CMP_USE_SLOT_NUMBER
please. I know that this, in this case, is translation from Kconfig, but it affects generic code and we are, at this point, very bad at documenting all the crap we add to the mcuboot_config.h files.
@@ -411,6 +411,24 @@ boot_verify_slot_dependency(struct boot_loader_state *state, | |||
uint8_t swap_type = state->swap_type[dep->image_id]; | |||
dep_slot = BOOT_IS_UPGRADE(swap_type) ? BOOT_SECONDARY_SLOT | |||
: BOOT_PRIMARY_SLOT; | |||
#elif defined(MCUBOOT_VERSION_CMP_USE_SLOT_NUMBER) | |||
switch(dep->slot) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boot_verify_slot_dependencies does range check for image number, on the dependency TLV it read, it should do the same with slot number.
scripts/imgtool/main.py
Outdated
@@ -404,7 +424,7 @@ def convert(self, value, param, ctx): | |||
'(for mcuboot <1.5)') | |||
@click.option('-d', '--dependencies', callback=get_dependencies, | |||
required=False, help='''Add dependence on another image, format: | |||
"(<image_ID>,<image_version>), ... "''') | |||
"(<image_ID>,[<slot_ID>],<image_version>), ... "''') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that these
are valid ID I can use here?
Bug there is no user input filter here. I know that MCUboot will reject the image, at least by the logic of boot_verify_slot_dependency
(which should actually be in boot_verify_slot_dependencies
), but it is not even clear what values user should pass here and if 0 is special.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only a slight validation, based on the regular expression.
Since there is close to none justification for using more than those three predefined values, I'll try to use words instead of mysterious integers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the change of placement - this logic must affect the local dep_slot
variable, that's why it is there.
I guess you have some ideas, so we can discuss possible solutions tomorrow.
Allow to depend on a specific slot while specifying the version number. This functionality is useful when the Direct XIP mode is used and the booting process of other images is done by the next stage, not the MCUboot itself. Signed-off-by: Tomasz Chyrowicz <[email protected]>
a79cd55
to
89d1d85
Compare
@robertstypa Please take a look at the snake language code. |
Allow to depend on a specific slot while specifying the version number. This functionality is useful when the Direct XIP mode is used and the booting process of other images is done by the next stage, not the MCUboot itself.