From 29217b48a5f67c2a715c3ed19f5ecf77e37fb61e Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 13 Jan 2025 10:53:45 +0000 Subject: [PATCH] sysbuild: mcuboot: Add support for swap using offset mode Adds a new Kconfig to allow selecting this newly introduced MCUboot swapping algorithm Signed-off-by: Jamie McCrae --- .../image_configurations/BOOTLOADER_image_default.cmake | 3 +++ .../image_configurations/MAIN_image_default.cmake | 2 ++ share/sysbuild/images/bootloader/Kconfig | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake index 6f87720cf91..422fdb83030 100644 --- a/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake +++ b/share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake @@ -6,6 +6,7 @@ # on Zephyr MCUboot / bootloader image. set(bootmodes CONFIG_SINGLE_APPLICATION_SLOT + CONFIG_BOOT_SWAP_USING_OFFSET CONFIG_BOOT_SWAP_USING_SCRATCH CONFIG_BOOT_UPGRADE_ONLY CONFIG_BOOT_SWAP_USING_MOVE @@ -15,6 +16,8 @@ set(bootmodes CONFIG_SINGLE_APPLICATION_SLOT if(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP) set(bootmode CONFIG_SINGLE_APPLICATION_SLOT) +elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_USING_OFFSET) + set(bootmode CONFIG_BOOT_SWAP_USING_OFFSET) elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_WITHOUT_SCRATCH OR SB_CONFIG_MCUBOOT_MODE_SWAP_USING_MOVE) set(bootmode CONFIG_BOOT_SWAP_USING_MOVE) elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_SCRATCH) diff --git a/share/sysbuild/image_configurations/MAIN_image_default.cmake b/share/sysbuild/image_configurations/MAIN_image_default.cmake index 6973bf678bd..28dd6d0aacb 100644 --- a/share/sysbuild/image_configurations/MAIN_image_default.cmake +++ b/share/sysbuild/image_configurations/MAIN_image_default.cmake @@ -22,6 +22,8 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) if(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP) set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP y) + elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_USING_OFFSET) + set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_USING_OFFSET y) elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_WITHOUT_SCRATCH OR SB_CONFIG_MCUBOOT_MODE_SWAP_USING_MOVE) set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE y) elseif(SB_CONFIG_MCUBOOT_MODE_SWAP_SCRATCH) diff --git a/share/sysbuild/images/bootloader/Kconfig b/share/sysbuild/images/bootloader/Kconfig index a661103ea64..1b5cdec41ea 100644 --- a/share/sysbuild/images/bootloader/Kconfig +++ b/share/sysbuild/images/bootloader/Kconfig @@ -43,6 +43,14 @@ config MCUBOOT_MODE_SINGLE_APP slots. In this mode application is not able to DFU its own update to secondary slot and all updates need to be performed using MCUboot serial recovery. +config MCUBOOT_MODE_SWAP_USING_OFFSET + bool "Swap using offset" + select EXPERIMENTAL + help + MCUboot expects slot0_partition and slot1_partition to be present in DT and application + will boot from slot0_partition. MCUBOOT_BOOTLOADER_NO_DOWNGRADE should also be selected + in main application if MCUboot has been built with MCUBOOT_DOWNGRADE_PREVENTION. + config MCUBOOT_MODE_SWAP_USING_MOVE bool "Swap using move" help