forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sysbuild: refactor image_config.cmake handling
Refactor image_config.cmake so that it is no longer sourced unconditionally for all images. Instead image_config.cmake has been split into BOOTLOADER_image_default.cmake and MAIN_image_default.cmake and is set as property on the image. This means the code in image_config.cmake can be split into dedicated files which depends on the image type. Furthermore it allows sysbuild modules to append extra config snippets to process for sysbuild kconfig overwrite, or even remove the default snippet and have full control. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
- Loading branch information
1 parent
5e4710c
commit f380f82
Showing
5 changed files
with
69 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
share/sysbuild/image_configurations/BOOTLOADER_image_default.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (c) 2023 Nordic Semiconductor | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# This sysbuild CMake file sets the sysbuild controlled settings as properties | ||
# on Zephyr MCUboot / bootloader image. | ||
|
||
set(keytypes CONFIG_BOOT_SIGNATURE_TYPE_NONE | ||
CONFIG_BOOT_SIGNATURE_TYPE_RSA | ||
CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 | ||
CONFIG_BOOT_SIGNATURE_TYPE_ED25519) | ||
|
||
if(SB_CONFIG_BOOT_SIGNATURE_TYPE_NONE) | ||
set(keytype CONFIG_BOOT_SIGNATURE_TYPE_NONE) | ||
elseif(SB_CONFIG_BOOT_SIGNATURE_TYPE_RSA) | ||
set(keytype CONFIG_BOOT_SIGNATURE_TYPE_RSA) | ||
elseif(SB_CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256) | ||
set(keytype CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256) | ||
elseif(SB_CONFIG_BOOT_SIGNATURE_TYPE_ED25519) | ||
set(keytype CONFIG_BOOT_SIGNATURE_TYPE_ED25519) | ||
endif() | ||
|
||
foreach(loopkeytype ${keytypes}) | ||
if("${loopkeytype}" STREQUAL "${keytype}") | ||
set_config_bool(${ZCMAKE_APPLICATION} ${loopkeytype} y) | ||
else() | ||
set_config_bool(${ZCMAKE_APPLICATION} ${loopkeytype} n) | ||
endif() | ||
endforeach() | ||
|
||
if(SB_CONFIG_BOOTLOADER_MCUBOOT) | ||
if("${SB_CONFIG_SIGNATURE_TYPE}" STREQUAL "NONE") | ||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE y) | ||
else() | ||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE n) | ||
endif() | ||
endif() |
19 changes: 19 additions & 0 deletions
19
share/sysbuild/image_configurations/MAIN_image_default.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) 2023 Nordic Semiconductor | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# This sysbuild CMake file sets the sysbuild controlled settings as properties | ||
# on the main Zephyr image. | ||
|
||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_BOOTLOADER_MCUBOOT "${SB_CONFIG_BOOTLOADER_MCUBOOT}") | ||
set_config_string(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_SIGNATURE_KEY_FILE | ||
"${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}" | ||
) | ||
|
||
if(SB_CONFIG_BOOTLOADER_MCUBOOT) | ||
if("${SB_CONFIG_SIGNATURE_TYPE}" STREQUAL "NONE") | ||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE y) | ||
else() | ||
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE n) | ||
endif() | ||
endif() |