Skip to content

MCUboot not confirm image when using 'west flash' #34683

@nandojve

Description

@nandojve

Describe the bug
When an App uses MCUboot as bootloader it needs confirm any "clean/new" image at first boot. This always worked on Zephyr until pre-2.5.0 version. Now, it was detected that an image flashed using OpenOCD is not confirming images anymore. This was detected with frdm-k64f, nrf52840dk_nrf52840 and nucleo-f767zi. One possible consequence is an infinite loop that tries boot the board.

To Reproduce
Steps to reproduce the behavior:

  1. git checkout master

  2. git fetch upstream

  3. git rebase upstream/master

  4. west update

  5. cd ..

  6. ls
    bootloader modules net-tools tools zephyr

  7. west build -b frdm_k64f -d build/mcuboot-frdm_k64f bootloader/mcuboot/boot/zephyr

  8. west flash -d build/mcuboot-frdm_k64f

  9. west build -b frdm_k64f -d build/app zephyr/samples/subsys/mgmt/updatehub

  10. west sign -t imgtool -d build/app --no-hex -- --version 1.0.0 --pad --key bootloader/mcuboot/root-rsa-2048.pem

  11. west flash -d build/app --bin-file build/app/zephyr/zephyr.signed.bin

  12. see error

Expected behavior
The recent flashed Image confirm at first boot.

Impact
At least stop development with newer Zephyr versions.

Logs and console output

*** Booting Zephyr OS build zephyr-v2.5.0-2840-g363af20fc4a6  ***
I: Starting bootloader
I: Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: primary slot
I: Swap type: none
I: Bootloader chainload address offset: 0x20000
I: Jumping to the first image slot
*** Booting Zephyr OS build zephyr-v2.5.0-2840-g363af20fc4a6  ***


[00:00:03.001,000] <inf> eth_mcux: ETH_0 enabled 100M full-duplex mode.
[00:00:03.002,000] <inf> main: UpdateHub sample app started
[00:00:03.002,000] <inf> main: Confirming the boot image
[00:00:03.002,000] <err> main: Error to confirm the image
[00:00:03.002,000] <inf> main: Network disconnected
uart:~$ 
[00:00:11.006,000] <inf> main: Network connected
[00:00:11.006,000] <inf> main: Starting UpdateHub polling mode
[00:00:11.006,000] <inf> updatehub: SHA-256 verification on download and from flash
[00:00:11.006,000] <err> updatehub: The current image is not confirmed
[00:00:11.006,000] <err> updatehub: Image is unconfirmed. Rebooting to revert back to previousconfirmed image.*** Booting Zephyr OS build zephyr-v2.5.0-2840-g363af20fc4a6  ***
I: Starting bootloader
I: Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: primary slot
I: Swap type: none
I: Bootloader chainload address offset: 0x20000
I: Jumping to the first image slot
*** Booting Zephyr OS build zephyr-v2.5.0-2840-g363af20fc4a6  ***


[00:00:03.001,000] <inf> eth_mcux: ETH_0 enabled 100M full-duplex mode.
[00:00:03.002,000] <inf> main: UpdateHub sample app started
[00:00:03.002,000] <inf> main: Confirming the boot image
[00:00:03.002,000] <err> main: Error to confirm the image
[00:00:03.002,000] <inf> main: Network disconnected
uart:~$ 

Environment (please complete the following information):

  • OS: Linux
  • Toolchain Zephyr SDK 0.12.3
  • Zephyr version: 2.5.99 (mainline)

Additional context
All variants that UpdateHub uses are working at b0bd14b. This includes proper boot, network and upgrades. I hope we can find a solution or a possible missing config to re-enable the feature.

Metadata

Metadata

Assignees

Labels

RegressionSomething, which was working, does not anymorebugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions