Skip to content

Conversation

@arthur-mmlw
Copy link
Contributor

When image encryption is enabled with sysbuild configuration variable SB_CONFIG_BOOT_ENCRYPTION, we get 4 files in the build directory:

  • build/project/zephyr/zephyr.signed.encrypted.hex
  • build/project/zephyr/zephyr.signed.hex
  • build/project/zephyr/zephyr.slot1.signed.encrypted.hex
  • build/project/zephyr/zephyr.slot1.signed.hex

When running west flash, the runner flashes file zephyr.signed.hex.

When using SB_CONFIG_MCUBOOT_MODE_RAM_LOAD to load the image from external flash to ram and execute from ram, the image is encrypted in the external flash, and MCUBoot decrypts it when loading to ram. west flash writes the un-encrypted image in external flash so it fails when mcuboot tries to decrypt it.

This PR set file zephyr.signed.encrypted.hex to be flashed instead in this situation.

cc @nordicjm as discussed on discord : https://discord.com/channels/720317445772017664/906521547672522752/1431263691055042591

When both `SB_CONFIG_MCUBOOT_MODE_RAM_LOAD` and `SB_CONFIG_BOOT_ENCRYPTION`
are enabled, MCUBoot loads an encrypted image from flash, decrypts it,
and then executes it from RAM.

Previously, the unencrypted image was being flashed. This caused a boot
failure because MCUBoot would attempt to decrypt an unencrypted image.

This commit ensures the encrypted image is flashed when this
configuration is active, allowing the system to boot correctly.

Signed-off-by: Arthur Gay <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 2025

@JarmouniA
Copy link
Contributor

Makes sense. Can you submit an accompanying bug issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants