Skip to content
Merged
2 changes: 2 additions & 0 deletions share/sysbuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ ExternalZephyrProject_Add(
MAIN_APP
)

add_subdirectory(bootloader)

# This allows for board and app specific images to be included.
include(${BOARD_DIR}/sysbuild.cmake OPTIONAL)
include(${APP_DIR}/sysbuild.cmake OPTIONAL)
2 changes: 2 additions & 0 deletions share/sysbuild/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ config WARN_DEPRECATED
help
Print a warning when the Kconfig tree is parsed if any deprecated
features are enabled.

rsource "bootloader/Kconfig"
11 changes: 11 additions & 0 deletions share/sysbuild/bootloader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2022 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0

# Include MCUboot if enabled.
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
ExternalZephyrProject_Add(
APPLICATION mcuboot
SOURCE_DIR ${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/
)
endif()
29 changes: 29 additions & 0 deletions share/sysbuild/bootloader/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2022 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0

config SUPPORT_BOOTLOADER
bool
default y

config SUPPORT_BOOTLOADER_MCUBOOT_ZEPHYR
bool
default y

choice BOOTLOADER
prompt "Bootloader support"
default BOOTLOADER_NONE
depends on SUPPORT_BOOTLOADER

config BOOTLOADER_NONE
bool "None"
help
Do not Include a bootloader in the build

config BOOTLOADER_MCUBOOT
Copy link
Contributor

Choose a reason for hiding this comment

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

As I understand there is dedicated namespace for these Kconfig properties (and will never merge to with the application properties).
For instance this property does something else than CONFIG_BOOTLOADER_MCUBOOT of zephyr-rtos app.
I want to avoid confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the help text can definitely be improved.

But whether we should invent two different setting names or have them identical as now depends a lot on how you look at this.

The Zephyr setting states:

zephyr/Kconfig.zephyr

Lines 682 to 686 in 83d73f6

This option signifies that the target uses MCUboot as a bootloader,
or in other words that the image is to be chain-loaded by MCUboot.
This sets several required build system and Device Tree options in
order for the image generated to be bootable using the MCUboot open
source bootloader. Currently this includes:

and my view on this is that this is also true for the sysbuild BOOTLOADER_MCUBOOT because it propagates this setting to the application so that the app is chain loaded by MCUboot, as well as devicetree is setup accordingly.
Not inside sysbuild itself, but in the images built by sysbuild.
Ref:

# Propagate bootloader and signing settings from this system to the MCUboot and
# application image build systems.
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
set(${app_name}_CONFIG_BOOTLOADER_MCUBOOT y CACHE STRING
"MCUBOOT is enabled as bootloader" FORCE

Of course sysbuild itself does one more thing which the application itself cannot do, and that is building and flashing of MCUboot in addition.

I believe having identical name for BOOTLOADER_MCUBOOT makes it easier for users to transition to sysbuild and understand how to build a sample with MCUboot, and that the small addition that sysbuild provides is not sufficient to justify two different names.

bool "MCUboot"
depends on SUPPORT_BOOTLOADER_MCUBOOT_ZEPHYR
help
Include MCUboot (Zephyr port) as the bootloader to use

endchoice