Skip to content

Commit 73d149a

Browse files
ArekBalysNordicLuDuda
authored andcommitted
suit: Add Multi Image build for SUIT
This feature allows crating dfu_multi_image.bin file that contains the suit envelope stored in the 0 image, and all SUIT cache partitions stored in the following image numbers. To use this feature set the SB_CONFIG_SUIT_MULTI_IMAGE_PACKAGE_BUILD sysbuild kconfig option to `y`. If any application image uses CONFIG_SUIT_DFU_CACHE_EXTRACT_IMAGE then the image 2 will contain the created DFU cache partition. The dfu_multi_image.bin can be used in the dfu_target_suit image processing. Signed-off-by: Arkadiusz Balys <[email protected]>
1 parent 69c9276 commit 73d149a

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

cmake/sysbuild/suit.cmake

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,34 @@ function(suit_create_package)
368368
endif()
369369
endif()
370370

371+
if(SB_CONFIG_SUIT_MULTI_IMAGE_PACKAGE_BUILD)
372+
include(${ZEPHYR_BASE}/../nrf/cmake/fw_zip.cmake)
373+
include(${ZEPHYR_BASE}/../nrf/cmake/dfu_multi_image.cmake)
374+
375+
set(suit_multi_image_ids)
376+
set(suit_multi_image_paths)
377+
set(suit_multi_image_targets)
378+
379+
list(APPEND suit_multi_image_ids 0)
380+
# Include the suit Envelope to the multi image package to store it in dfu_partition
381+
list(APPEND suit_multi_image_paths "${SUIT_ROOT_DIRECTORY}root.suit")
382+
list(APPEND suit_multi_image_targets "${SUIT_ROOT_DIRECTORY}root.suit")
383+
# Include cache partition to the multi image package to store it in cache_partition
384+
foreach(CACHE_PARTITION_NUM ${DFU_CACHE_PARTITIONS_USED})
385+
math(EXPR DFU_IMAGE_ID "${CACHE_PARTITION_NUM} + 1")
386+
list(APPEND suit_multi_image_ids ${DFU_IMAGE_ID})
387+
list(APPEND suit_multi_image_paths "${SUIT_ROOT_DIRECTORY}dfu_cache_partition_${CACHE_PARTITION_NUM}.bin")
388+
endforeach()
389+
390+
dfu_multi_image_package(
391+
dfu_multi_image_pkg
392+
IMAGE_IDS ${suit_multi_image_ids}
393+
IMAGE_PATHS ${suit_multi_image_paths}
394+
OUTPUT ${CMAKE_BINARY_DIR}/dfu_multi_image.bin
395+
DEPENDS ${suit_multi_image_targets}
396+
)
397+
endif() # SB_CONFIG_SUIT_MULTI_IMAGE_PACKAGE_BUILD
398+
371399
suit_get_manifest(${SB_CONFIG_SUIT_ENVELOPE_ROOT_TEMPLATE_FILENAME} INPUT_ROOT_ENVELOPE_JINJA_FILE)
372400
message(STATUS "Found root manifest template: ${INPUT_ROOT_ENVELOPE_JINJA_FILE}")
373401

sysbuild/Kconfig.suit

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ config SUIT_BASE_MANIFEST_VARIANT
6565
help
6666
Base manifest variant used during the build.
6767

68+
config SUIT_MULTI_IMAGE_PACKAGE_BUILD
69+
bool "Create multi-image DFU for SUIT envelope and cache images"
70+
help
71+
Build DFU Multi Image package that contains a manifest file followed by SUIT envelope
72+
and selected cache image files.
73+
6874
endif # SUIT_ENVELOPE
6975

7076
config SUIT_BUILD_RECOVERY

0 commit comments

Comments
 (0)