Commit graph zephyr/share
Author SHA1 Message Date
JP Hutchins
e8c5edf405 mcuboot: support multiple signing keys
SB_CONFIG_BOOT_SIGNATURE_KEY_FILE now accepts a comma-separated list of
PEM paths in addition to a single path. When a list is given, the MCUboot
bootloader embeds the public half of every key and accepts an image
signed with any of them. The first entry is also the key the application
is signed with; every entry past the first must be a public-only PEM of
the same signature type (MCUboot enforces this at build time with
'imgtool keyinfo --require public'). A common use is a development
bootloader that boots both development- and production-signed images
while never holding the production private key.

The keys the bootloader embeds and the single key the application is
signed with are both derived from this one list through the sysbuild
helpers sysbuild_mcuboot_resolve_signature_key_files() and
sysbuild_mcuboot_application_signature_key_file(). Entries are forwarded
verbatim for each image to resolve, so a single-key value behaves exactly
as before and no previously working configuration breaks.

The feature is exercised at runtime by tests/boot/mcuboot_multiple_keys,
which builds a two-key bootloader on the mps2/an385 QEMU machine and
boots an application signed with either embedded key, asserting MCUboot
validates it against the matching key (key_id 0 and key_id 1). The two
keys are MCUboot's own ed25519 test keys: a development key (key_id 0)
and a production key embedded by its public half only (key_id 1). The
application is signed at build time with the development key; the second
scenario re-signs the built image with the production key afterwards,
the way a production custodian signs a release binary out-of-band, so
the production private key never enters the build configuration.

Signed-off-by: JP Hutchins <jp@intercreate.io>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 14:45:45 -05:00
Torsten Rasmussen
5014a35c51 sysbuild: pass ZEPHYR_BASE to images
Ensure same ZEPHYR_BASE is used by sysbuild and Zephyr images.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-06-19 22:40:01 +02:00
Daniel DeGrasse
bd9225dd0f sysbuild: support CONFIG_MCUBOOT_MODE_RAM_LOAD with CONFIG_XIP=y
For some use cases (such as Harvard architectures with code and data
memory), it may be desirable to link an application to SRAM with
CONFIG_XIP=y so that the application will utilize a different SRAM
region for execution than it does for data.

To support this with MCUBoot, add CONFIG_MCUBOOT_RAMLOAD_ALLOW_XIP

Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
2026-06-16 12:55:26 -05:00
Jamie McCrae
08e1d5c2be sysbuild: Fix merged hex output
Fixes some issues with merged hex output, parses images to get the
hex files that are flashed then uses that as the input for the
merged hex output. Also allows sysbuild modules to add custom
dependencies to the merged hex output if they generate the images

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-05-21 06:31:53 -04:00
Guðni Már Gilbert
400411f261 cmake: modules: remove temporary file
Remove the temporary file once its no longer needed.

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-05-12 09:04:53 +02:00
Grzegorz Swiderski
ab9ce931fd cmake: kconfig: Skip creating Kconfig target on a variant image
This replaces a workaround in `ExternalZephyrVariantProject_Add()` -
setting KCONFIG_TARGETS-NOTFOUND - which turned out to be incomplete.
For example, it had no way of accounting for EXTRA_KCONFIG_TARGETS
(which could be set on the command line or through something like
`ZephyrBuildConfig.cmake`).

Instead, the creation of `menuconfig` and friends can be gated on
KCONFIG_VARIANT_SOURCE, which is the variable sysbuild uses to forward
the source configuration to the variant image. This way, both lists of
Kconfig targets are excluded reliably.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2026-05-11 13:41:35 +02:00
Jamie McCrae
730b44f422 sysbuild: Add variant image CMake module file
Adds variant image handling CMake code which re-uses parts of the
original dts CMake module code but applies variant-specific parts

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-27 14:14:35 +02:00
Jamie McCrae
dfa6c9562d share: zephyr-package: cmake: Append zephyr base module dir
Changes prepend to append to allow for things to override modules
e.g. sysbuild

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-27 14:14:35 +02:00
Jamie McCrae
01cf5768a0 sysbuild: cmake: Use supplied image for variant source image
Fixes wrongly using the default image instead of the supplied
user image in the variant image function

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-03-16 19:06:50 -05:00
Torsten Rasmussen
f6aff5b460 cmake: align SNIPPET_ROOT with other Zephyr '<type>_ROOT' lists
Zephyr `<type>_ROOT`s, such as `BOARD_ROOT`, `DTS_ROOT`, `SCA_ROOT`,
are initialed by ROOT settings provided through CMake variable
`<type>_ROOT`, Zephyr base, and root settings specified in Zephyr
module's `zephyr/module.yml` file.

`SNIPPET_ROOT` didn't follow the same pattern as it also included
application source dir.

This commit aligns `SNIPPET_ROOT` to follow same principle for
constructing other Zephyr `<type>_ROOT` lists.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-02-03 13:08:20 +01:00
Torsten Rasmussen
3a31002dd7 sysbuild: use ZEPHYR_SHARED_TARGETS instead of hard-coded targets
Remove the hard-coded target knowledge of menuconfig, hardenconfig, and
guiconfig and instead use the ZEPHYR_SHARED_TARGETS provided by the
Zephyr image.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-01-27 08:39:52 -05:00
Torsten Rasmussen
a0983a2f91 cmake: align board qualifiers in CMake with Kconfig
The value os board qualifiers in CMake and Kconfig differs.
CMake has a leading '/', as example:
CMake:   BOARD_QUALIFIERS=/nrf52840
Kconfig: BOARD_QUALIFIERS=nrf52840

This was also discussed in
https://github.com/zephyrproject-rtos/zephyr/pull/69740

This commit aligns the value of the CMake variable BOARD_QUALIFIERS to
the value of BOARD_QUALIFIERS (CONFIG_BOARD_QUALIFIERS) in Kconfig.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-01-27 10:52:37 +00:00
Jamie McCrae
ec19a0d649 sysbuild: Only load Kconfig/dts image files if they exist
If they do not exist, do not load them

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-26 10:15:13 -06:00
Jamie McCrae
5ccfb179f0 sysbuild: Link MCUboot output with main app configuration
Links the output from the default MCUboot build with the estimated
size of the overhead with the main image. This also allowes used
to remove the linkage between them, if they so wish

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-26 14:17:06 +01:00
Jamie McCrae
8312b20ca9 sysbuild: Add ability to generate slot 1 variant image
Adds a new experimental Kconfig option to sysbuild which allows
generating a variant image to use with MCUboot in direct-xip mode.
It also includes base sysbuild infrastructure for creating
additional variant images in future (including out-of-tree),
whereby they use the base configuration of an existing image but
modify it, without creating the default zephyr extra targets for
images (e.g. menuconfig) to prevent changing configuration that
should not be changed.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 15:31:06 +00:00
Wilfried Chauveau
b25ecfd358 cmake: sysbuild: propagate WEST_PYTHON & Python3_EXECUTABLE
Without this, the parent CMake and the sub-processes may use different
Python environment.

Co-authored-by: Torsten Tejlmand Rasmussen <torsten.rasmussen@nordicsemi.no>
Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2026-01-19 12:20:01 +01:00
Jamie McCrae
feadf2e8ef sysbuild: Add optional output merged hex file support
Adds support for generated merged hex file output, one hex file
per unique board target. This feature can be enabled with
SB_CONFIG_MERGED_HEX_FILES

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-12 11:52:58 +01:00
Fabrice DJIATSA
b152f71aaa modules: kconfig: mcuboot: make SWAP_USING_OFFSET the default for STM32
Update MCUboot configuration so that STM32 no longer defaults to
SWAP_USING_MOVE. Instead, SWAP_USING_OFFSET becomes the default mode
for STM32 boards.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-12-15 17:08:14 +00:00
Jamie McCrae
356f992f68 sysbuild: cmake: Only touch empty conf file if it does not exist
Prevents a random occurance whereby sysbuild reconfigures itself
after a reconfiguration for no known discernable reason

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-12-06 11:38:41 -05:00
Josuah Demangeon
0c4ab40921 style: share: apply coding style on CMakeLists.txt files
Apply the CMake style guidelines to CMakeList.txt files in share/.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Torsten Rasmussen
f26d245914 sysbuild: exclude APPLICATION_SOURCE_DIR from sysbuild image cache file
APPLICATION_SOURCE_DIR is image specific and the value inside sysbuild
points to sysbuild itself.

This gives wrong results when a sample uses
`zephyr_get(APPLICATION_SOURCE_DIR)` as it will fetch the sysbuild value
and not its own value.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-11-13 23:15:45 +02:00
Jamie McCrae
e341b0e481 sysbuild: bootloader: Remove deprecated Kconfig
Removes the previously deprecated
SB_CONFIG_MCUBOOT_MODE_SWAP_WITHOUT_SCRATCH sysbuild Kconfig

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-13 23:09:55 +02:00
Anas Nashif
303af992e5 style: fix 'if (' usage in cmake files
Replace with 'if(' and 'else(' per the cmake style guidelines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-29 11:44:13 +02:00
Torsten Rasmussen
b88e615339 sysbuild: support application CMakePresets.json files with sysbuild
This commit provides a CMakePresets.json which includes the sample's
CMakePresets.json file.

`west build` is extended to set `APP_DIR` in environment when sysbuild
is used. This allows sysbuild's CMakePresets.json to include the
sample's presets file.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-10-03 12:51:01 +03:00
Jamie McCrae
f624525f30 kconfig: Load Kconfig env file better
Loads this file in a better way that means samples and modules
should not have to source the file before referencing Kconfig
module path variables

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-09-12 13:19:56 +02:00
Jamie McCrae
72c4af32d3 cmake: Rename option variable
Renames a variable used in a macro to avoid collisions in picolibc

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-09-05 12:27:19 +02:00
Sylvio Alves
0a339a2d7b mcuboot: kconfig: set default MOVE for Espressif SoCs
Make sure default MOVE option is enabled for Espressif SoCs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-09-05 09:31:37 +02:00
Benjamin Cabé
0132ea07fb doc: fix spelling errors tree-wide
fix some spelling errors in code comments and Kconfig helps

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-03 17:04:13 +02:00
Jamie McCrae
4977c5cef9 scripts/kconfig/cmake: Generate/use env file for zephyr module paths
Adds a output env file that lists the paths of zephyr modules
which can be used in Kconfig files and uses this in Kconfig. Also
updates Kconfig doc output to generate and use this

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-09-03 11:03:40 +02:00
Jamie McCrae
db8f991c77 kconfig: Use $(...) instead of ${...} for getting variables
Updates this to comply with the Zephyr Kconfig recommendations

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-08-20 12:05:41 +02:00
Artur Hadasz
b43ce97c6b bootloader: mcuboot: Fix encryption not being selected in bootloader
In some cases this resulted in the device not booting.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2025-08-18 10:54:37 +02:00
Artur Hadasz
9a1fe30199 bootloader: mcuboot: Changes needed to support AES256
This commit adds changes which are necessary to support
the AES256 encryption algorithm in mcuboot.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2025-08-12 12:35:31 +02:00
Daniel DeGrasse
879d4ce7f3 modules: mcuboot: add Kconfigs for RAMLOAD_WITH_REVERT mode
Add Kconfigs for RAMLOAD_WITH_REVERT mode in MCUBoot. This mode works in
a manner similar to DIRECT_XIP_WITH_REVERT- namely, mcuboot will only
boot an image that is either confirmed or marked as pending. If both
images are confirmed, mcuboot will still select the one with the higher
version, so downgrading is not possible using this mode.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-08-05 11:53:58 +01:00
Jamie McCrae
7a76a6238d sysbuild: Default to swap using offset for MCUboot
This swapping method is more efficient than swap using move and
has been available for some time, remove experimental flag and
set it as the default except for stm32 devices which have
partition alignment for swap using move

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-30 06:19:53 -04:00
Flavio Ceolin
674fd094aa build: kconfig: Add support for warning insecure features
Add a new promptless Kconfig symbol (INSECURE). This symbols must
be selected by any setting which is used to enable an insecure
feature.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2025-07-10 16:00:26 -05:00
Jamie McCrae
c8d9f4b701 sysbuild: cmake: kconfig: Fix missing sysbuild Kconfig paths
Fixes an issue where external sysbuild Kconfig path variables
were not provided and meant they could not be overwritten

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-07-07 10:14:14 -05:00
Pisit Sawangvonganan
a163f9db61 kconfig: fix typo in (arch, boards, kernel, modules, samples, share)
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `arch`, `boards`, `kernel`, `modules`,
`samples`, and `share` directory.
Additionally, incorporates a fix recommended by the reviewer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-07-01 10:58:54 -10:00
Tomasz Chyrowicz
13a0f0504c sysbuild: Allow to use file suffix DTS overlays
Allow to add an image-specific DTS overlay, that is applied based on the
FILE_SUFFIX.
Up to this point, it was possible to specify such Kconfig files
(sysbuild/<image>_<file_suffix>.conf),
but it did not work with dts overlays
(sysbuild/<image>_<file_suffix>.overlay).
This commit aligns the logic of finding configuration files for both
scenarios mentioned above.

Ref: NCSDK-NONE

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-06-10 12:13:10 +02:00
Grzegorz Swiderski
da197fe9ef sysbuild: Import image devicetrees
Make the image devicetrees available to sysbuild for advanced use cases.

This is done by calling `zephyr_dt_import` on each image target. The DT
target properties are all expected to be prefixed with `DT_`, so there
should be no conflicts.

Thus, the DT contents of a given `<image>` can be retrieved using e.g.:

    dt_nodelabel(<var> NODELABEL <label> TARGET <image>)

as noted in `extensions.cmake`.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2025-05-22 13:44:18 +02:00
Jamie McCrae
a1e66b4952 sysbuild: image_configurations: Add firmware loader dtc overlay file
Adds a devicetree overlay file for the firmware loader image which
sets the code partition to slot 1, which is where the firmware loader
image resides

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-16 21:37:01 +02:00
Jamie McCrae
1e73b581c6 sysbuild: Add support for image configuration dtc overlay files
Adds support for using image-specific configuration devicetree
overlay files

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-16 21:37:01 +02:00
Jamie McCrae
8a8b91843d sysbuild: Add firmware loader application type support
Adds support for setting up a firmware loader image in a build,
which can also optionally automatically configure MCUboot and the
application image to be able to boot the firmware loader image
using the retention subsystem

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-04-25 14:03:34 +02:00
Ederson de Souza
e420b21834 share/sysbuild: Support single app slot RAM load mode
Adds a new Kconfig to support MCUboot single application slot RAM load
mode.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-04-08 16:12:33 +02:00
Jamie McCrae
9f12f8afb2 infrastructure: Remove hwmv1 support
Removes support for the deprecated hardware model version 1

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-03-13 16:53:07 +00:00
Jamie McCrae
29217b48a5 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 <jamie.mccrae@nordicsemi.no>
2025-02-10 19:05:25 +01:00
Jamie McCrae
55dba488a4 sysbuild: Update MCUboot swap using move Kconfig name
Deprecates the old Kconfig and adds a new one which lines up with
the name of the Kconfig used by MCUboot

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-10 19:05:25 +01:00
Torsten Rasmussen
642e9484e3 sysbuild: populate build_info with list of images
Populate the build_info.yml created by sysbuild CMake with list of
images and write the build info file afterwards.

This allows users and external tools to examine which images was
included in the build even if one or more of those images fails CMake
configure or generate stage.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-02-10 15:56:52 +00:00
Benjamin Cabé
5b988356ec Revert "sysbuild: populate build_info with list of images"
This reverts commit f67939bf7e.
as it's part of a series of commits causing issues on Windows

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-01-29 09:27:31 +01:00
Torsten Rasmussen
f67939bf7e sysbuild: populate build_info with list of images
Populate the build_info.yml created by sysbuild CMake with list of
images and write the build info file afterwards.

This allows users and external tools to examine which images was
included in the build even if one or more of those images fails CMake
configure or generate stage.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-01-27 13:24:23 +01:00
Grzegorz Swiderski
17ba479585 sysbuild: Fix Kconfig symbol SIGNATURE_TYPE
Add missing quotes around string values, so that they won't be
interpreted as undefined symbol names.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2025-01-17 16:35:53 +01:00