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

dfu: boot: mcuboot: fix boot_is_img_confirmed #82109

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

Conversation

maass-hamburg
Copy link
Collaborator

@maass-hamburg maass-hamburg commented Nov 27, 2024

add boot_request_upgrade_by_id() to request a
update to the provided partition.

Fix image confirmed for Direct XIP.

@@ -255,6 +255,20 @@ int boot_request_upgrade(int permanent);
*/
int boot_request_upgrade_multi(int image_index, int permanent);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function should be used, a new function taking a partition ID should not be introduced

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this one unfortunately does something different, that is for pairs.
it will only use the secondary slots.

image_index = 0 will request on slot1_partition
image_index = 1 will request on slot3_partition
image_index = 2 will request on slot5_partition

and I can't request an update on slot0, which I need.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

look in bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h and /home/[email protected]/zephyr-apps/sw__otem_mcu/bootloader/mcuboot/boot/bootutil/src/bootutil_public.c

Copy link
Collaborator

Choose a reason for hiding this comment

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

MCUboot operates in pairs so I don't understand the problem? Or are you saying you are using directXIP mode and it's marking the wrong slot? If so, then the function I pointed to should be updated to support XIP mode but adding a new function just taking a partition ID is not acceptable

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is marking the wrong slot. Its not just for directXIP, but also for ram load mode (even throw mcuboot currently don't hake use of the trailer, but could be extended the same way that DIRECT_XIP got extended to DIRECT_XIP_REVERT and use the same functionality)

@de-nordic
Copy link
Collaborator

Several reasons we should not follow this path:
0) There is already a function that allows you to select next boot slot without knowledge of partitioning layout, just by pointing to image and setting desired effect boot_request_upgrade_multi, the function orders update of running slot with contents of the alternative slot or in case of DirectXIP it should mark the next slot to boot, without swap.

  1. Need to fix bootutil entanglement with Zephyr; there is significant problem with mixing Flash Map API from Zephyr and Fixed Partition Ids with the definitions in MCUboot/bootutil; we need to figure out a way to remove the entanglement and make bootutil, when used by application to work with definitions provided by Zephyr;
  2. Rather than pointing slot we want to boot we should allow bootutil to just allow app to set whether specific image shoudl continue booting from current slot or change the slot (test/confirm) to the alternative slot assigned to image; this should not involve and knowledge on partitioning or partition identification;
  3. Flash Are ID are going away in a near fature: instantiation of flash area objects at point of usage #81244, if that PR gets in, it will be followed by Issue proposal of changes to Zephyr where every path ditches usage of ID, then adaptation in MCUboot and finally flash_area_open/flash_area_close are going to be deprecated.

Fix image confirmed for Direct XIP.

Signed-off-by: Fin Maaß <[email protected]>
@maass-hamburg maass-hamburg force-pushed the boot_request_update_by_id branch 3 times, most recently from 8466e56 to 789f840 Compare November 27, 2024 13:31
@zephyrbot zephyrbot added the size: XS A PR changing only a single line of code label Nov 27, 2024
@maass-hamburg maass-hamburg changed the title dfu: boot: mcuboot: add boot_request_upgrade_by_id() dfu: boot: mcuboot: fix boot_is_img_confirmed Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: DFU Device Firmware Upgrade area: hawkBit size: XS A PR changing only a single line of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants