Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Raef Coles | 09dcd16 | 2024-12-09 15:40:53 +0000 | [diff] [blame] | 2 | # SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
David Hu | 1249f0d | 2023-12-04 22:57:56 +0800 | [diff] [blame] | 7 | cmake_minimum_required(VERSION 3.21) |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 8 | |
| 9 | # This CMake script is prepard by TF-M for building the non-secure side |
| 10 | # application and not used in secure build a tree being for export only. |
| 11 | # This file is renamed to spe/CMakeList.txt during installation phase |
| 12 | |
| 13 | include(spe_config) |
| 14 | include(spe_export) |
| 15 | |
Antonio de Angelis | 8bb9851 | 2024-01-16 14:13:36 +0000 | [diff] [blame] | 16 | set_target_properties(tfm_config psa_interface psa_crypto_config PROPERTIES IMPORTED_GLOBAL True) |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 17 | target_link_libraries(tfm_config INTERFACE psa_interface) |
| 18 | |
David Hu | b27a663 | 2023-10-23 22:38:39 +0800 | [diff] [blame] | 19 | # In actual NS integration, NS side build should include the source files |
| 20 | # exported by TF-M build. |
| 21 | set(INTERFACE_SRC_DIR ${CMAKE_CURRENT_LIST_DIR}/interface/src) |
| 22 | set(INTERFACE_INC_DIR ${CMAKE_CURRENT_LIST_DIR}/interface/include) |
Gergely Kovacs | 4d50f25 | 2024-10-07 10:23:36 +0000 | [diff] [blame] | 23 | if (DEFINED NS_TARGET_NAME) |
| 24 | message(STATUS "Using NS_TARGET_NAME: ${NS_TARGET_NAME}") |
| 25 | else() |
| 26 | set(NS_TARGET_NAME "tfm_ns") |
| 27 | endif() |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 28 | |
David Hu | b27a663 | 2023-10-23 22:38:39 +0800 | [diff] [blame] | 29 | add_library(tfm_api_ns STATIC) |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 30 | |
| 31 | target_sources(tfm_api_ns |
David Hu | 0a07b63 | 2023-10-16 15:25:20 +0800 | [diff] [blame] | 32 | PUBLIC |
David Hu | b27a663 | 2023-10-23 22:38:39 +0800 | [diff] [blame] | 33 | $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${INTERFACE_SRC_DIR}/tfm_platform_api.c> |
| 34 | $<$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_ps_api.c> |
| 35 | $<$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>:${INTERFACE_SRC_DIR}/tfm_its_api.c> |
| 36 | $<$<BOOL:${TFM_PARTITION_CRYPTO}>:${INTERFACE_SRC_DIR}/tfm_crypto_api.c> |
| 37 | $<$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>:${INTERFACE_SRC_DIR}/tfm_attest_api.c> |
| 38 | $<$<BOOL:${TFM_PARTITION_FIRMWARE_UPDATE}>:${INTERFACE_SRC_DIR}/tfm_fwu_api.c> |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 39 | ) |
| 40 | |
David Hu | b27a663 | 2023-10-23 22:38:39 +0800 | [diff] [blame] | 41 | # Include interface headers exported by TF-M |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 42 | target_include_directories(tfm_api_ns |
| 43 | PUBLIC |
David Hu | b27a663 | 2023-10-23 22:38:39 +0800 | [diff] [blame] | 44 | ${INTERFACE_INC_DIR} |
| 45 | ${INTERFACE_INC_DIR}/crypto_keys |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 46 | ) |
| 47 | |
Jamie Fox | c0489cc | 2023-11-28 17:55:36 +0000 | [diff] [blame] | 48 | if (CONFIG_TFM_USE_TRUSTZONE) |
| 49 | add_library(tfm_api_ns_tz INTERFACE) |
| 50 | |
| 51 | target_sources(tfm_api_ns_tz |
| 52 | INTERFACE |
| 53 | ${INTERFACE_SRC_DIR}/tfm_tz_psa_ns_api.c |
| 54 | ) |
| 55 | |
| 56 | target_link_libraries(tfm_api_ns_tz |
| 57 | INTERFACE |
| 58 | ${CMAKE_CURRENT_SOURCE_DIR}/interface/lib/s_veneers.o |
| 59 | ) |
| 60 | endif() |
| 61 | |
| 62 | if (TFM_PARTITION_NS_AGENT_MAILBOX) |
| 63 | add_library(tfm_api_ns_mailbox INTERFACE) |
| 64 | |
| 65 | target_sources(tfm_api_ns_mailbox |
| 66 | INTERFACE |
| 67 | ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_ns_api.c |
| 68 | ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_psa_ns_api.c |
| 69 | ) |
| 70 | |
| 71 | target_include_directories(tfm_api_ns_mailbox |
| 72 | INTERFACE |
| 73 | ${INTERFACE_INC_DIR}/multi_core |
| 74 | ) |
| 75 | endif() |
| 76 | |
Antonio de Angelis | 8bb9851 | 2024-01-16 14:13:36 +0000 | [diff] [blame] | 77 | if (TFM_PARTITION_CRYPTO) |
| 78 | target_link_libraries(tfm_api_ns |
| 79 | PUBLIC |
| 80 | psa_crypto_config |
| 81 | ) |
| 82 | endif() |
| 83 | |
David Hu | 35aa1a5 | 2023-10-24 23:04:04 +0800 | [diff] [blame] | 84 | add_library(platform_region_defs INTERFACE) |
| 85 | |
| 86 | target_compile_definitions(platform_region_defs |
| 87 | INTERFACE |
| 88 | $<$<BOOL:${BL1}>:BL1> |
| 89 | $<$<BOOL:${BL2}>:BL2> |
| 90 | BL2_HEADER_SIZE=${BL2_HEADER_SIZE} |
| 91 | BL2_TRAILER_SIZE=${BL2_TRAILER_SIZE} |
David Hu | 35aa1a5 | 2023-10-24 23:04:04 +0800 | [diff] [blame] | 92 | $<$<BOOL:${MCUBOOT_IMAGE_NUMBER}>:MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}> |
Dávid Házi | 7815773 | 2024-07-11 22:18:42 +0200 | [diff] [blame] | 93 | $<$<STREQUAL:${MCUBOOT_EXECUTION_SLOT},2>:LINK_TO_SECONDARY_PARTITION> |
David Hu | 35aa1a5 | 2023-10-24 23:04:04 +0800 | [diff] [blame] | 94 | $<$<BOOL:${TEST_PSA_API}>:PSA_API_TEST_${TEST_PSA_API}> |
| 95 | $<$<OR:$<CONFIG:Debug>,$<CONFIG:relwithdebinfo>>:ENABLE_HEAP> |
| 96 | ) |
| 97 | |
| 98 | target_link_libraries(platform_region_defs |
| 99 | INTERFACE |
| 100 | tfm_config |
| 101 | ) |
| 102 | |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 103 | add_subdirectory(platform) |
| 104 | |
David Hu | b27a663 | 2023-10-23 22:38:39 +0800 | [diff] [blame] | 105 | target_sources(platform_ns |
| 106 | PRIVATE |
| 107 | $<$<BOOL:${PLATFORM_DEFAULT_UART_STDOUT}>:${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/common/uart_stdout.c> |
| 108 | ) |
| 109 | |
Gergely Kovacs | 5206a41 | 2024-10-14 09:49:57 +0000 | [diff] [blame] | 110 | add_library(platform_ns_definitions INTERFACE) |
| 111 | |
| 112 | # these compile definitions must match on the secure and nonsecure side for security |
| 113 | target_compile_definitions(platform_ns_definitions |
| 114 | INTERFACE |
Kevin Peng | 7dc0ebf | 2023-11-14 14:31:31 +0800 | [diff] [blame] | 115 | DOMAIN_NS=1 |
Anton Komlev | 8dc9eb2 | 2023-09-15 15:53:03 +0100 | [diff] [blame] | 116 | $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:PLATFORM_DEFAULT_CRYPTO_KEYS> |
| 117 | $<$<STREQUAL:${CONFIG_TFM_FLOAT_ABI},hard>:CONFIG_TFM_FLOAT_ABI=2> |
| 118 | $<$<STREQUAL:${CONFIG_TFM_FLOAT_ABI},soft>:CONFIG_TFM_FLOAT_ABI=0> |
Roman Mazurak | 0a79e67 | 2024-08-14 16:48:13 +0300 | [diff] [blame] | 119 | $<$<BOOL:${CONFIG_TFM_DISABLE_CP10CP11}>:CONFIG_TFM_DISABLE_CP10CP11> |
Anton Komlev | 8dc9eb2 | 2023-09-15 15:53:03 +0100 | [diff] [blame] | 120 | $<$<BOOL:${CONFIG_TFM_ENABLE_CP10CP11}>:CONFIG_TFM_ENABLE_CP10CP11> |
| 121 | ) |
| 122 | |
Gergely Kovacs | 5206a41 | 2024-10-14 09:49:57 +0000 | [diff] [blame] | 123 | target_link_libraries(platform_ns |
| 124 | PUBLIC |
| 125 | platform_ns_definitions |
| 126 | ) |
| 127 | |
| 128 | if (DEFINED PLATFORM_CUSTOM_NS_FILES) |
| 129 | message(STATUS "Using PLATFORM_CUSTOM_NS_FILES: ${PLATFORM_CUSTOM_NS_FILES}") |
| 130 | else() |
| 131 | set(PLATFORM_CUSTOM_NS_FILES FALSE) |
| 132 | endif() |
| 133 | |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 134 | target_link_libraries(tfm_api_ns |
| 135 | PUBLIC |
David Hu | 35aa1a5 | 2023-10-24 23:04:04 +0800 | [diff] [blame] | 136 | platform_region_defs |
Gergely Kovacs | 5206a41 | 2024-10-14 09:49:57 +0000 | [diff] [blame] | 137 | platform_ns_definitions |
| 138 | $<$<NOT:$<BOOL:${PLATFORM_CUSTOM_NS_FILES}>>:platform_ns> |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 139 | ) |
| 140 | |
Dávid Házi | 34cf9b9 | 2023-10-11 11:10:41 +0200 | [diff] [blame] | 141 | if(BL2 AND PLATFORM_DEFAULT_IMAGE_SIGNING) |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 142 | |
David Hu | a5fefdc | 2023-11-03 13:24:41 +0800 | [diff] [blame] | 143 | find_package(Python3) |
| 144 | |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 145 | add_custom_target(tfm_s_ns_signed_bin |
| 146 | ALL |
Dávid Házi | 1a72fd4 | 2024-03-06 18:33:45 +0100 | [diff] [blame] | 147 | SOURCES ${CMAKE_BINARY_DIR}/tfm_s_ns_signed.bin |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 148 | ) |
| 149 | |
Gergely Kovacs | aae6d78 | 2024-10-11 07:21:30 +0000 | [diff] [blame] | 150 | if (DEFINED S_NS_SIGNED_TARGET_NAME) |
| 151 | message(STATUS "Using S_NS_SIGNED_TARGET_NAME: ${S_NS_SIGNED_TARGET_NAME}") |
| 152 | else() |
| 153 | set(S_NS_SIGNED_TARGET_NAME tfm_s_ns_signed) |
| 154 | endif() |
| 155 | |
| 156 | add_custom_command( |
| 157 | TARGET tfm_s_ns_signed_bin |
| 158 | POST_BUILD |
| 159 | COMMAND ${CMAKE_COMMAND} -E copy |
| 160 | ${CMAKE_BINARY_DIR}/tfm_s_ns_signed.bin |
Gergely Kovacs | 4d50f25 | 2024-10-07 10:23:36 +0000 | [diff] [blame] | 161 | $<TARGET_FILE_DIR:${NS_TARGET_NAME}>/${S_NS_SIGNED_TARGET_NAME}.bin |
Gergely Kovacs | aae6d78 | 2024-10-11 07:21:30 +0000 | [diff] [blame] | 162 | ) |
| 163 | |
Dávid Házi | 34cf9b9 | 2023-10-11 11:10:41 +0200 | [diff] [blame] | 164 | if (MCUBOOT_IMAGE_NUMBER GREATER 1) |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 165 | |
Maulik Patel | d1afad0 | 2025-04-14 13:04:35 +0100 | [diff] [blame] | 166 | set(wrapper_args |
| 167 | --version ${MCUBOOT_IMAGE_VERSION_NS} |
| 168 | --layout ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/layout_files/signing_layout_ns.o |
| 169 | --key ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/keys/image_ns_signing_private_key.pem |
| 170 | --public-key-format $<IF:$<BOOL:${MCUBOOT_HW_KEY}>,full,hash> |
| 171 | --align ${MCUBOOT_ALIGN_VAL} |
| 172 | --pad |
| 173 | --pad-header |
| 174 | -H ${BL2_HEADER_SIZE} |
| 175 | -s ${MCUBOOT_SECURITY_COUNTER_NS} |
| 176 | -L ${MCUBOOT_ENC_KEY_LEN} |
| 177 | -d \"\(0, ${MCUBOOT_S_IMAGE_MIN_VER}\)\" |
| 178 | $<$<STREQUAL:${MCUBOOT_UPGRADE_STRATEGY},OVERWRITE_ONLY>:--overwrite-only> |
| 179 | $<$<BOOL:${MCUBOOT_CONFIRM_IMAGE}>:--confirm> |
| 180 | $<$<BOOL:${MCUBOOT_ENC_IMAGES}>:-E${CMAKE_CURRENT_SOURCE_DIR}/image_signing/keys/image_enc_key.pem> |
| 181 | $<$<BOOL:${MCUBOOT_MEASURED_BOOT}>:--measured-boot-record> |
| 182 | $<TARGET_FILE_DIR:${NS_TARGET_NAME}>/${NS_TARGET_NAME}.bin |
| 183 | ${CMAKE_BINARY_DIR}/bin/${NS_TARGET_NAME}_signed.bin |
| 184 | ) |
| 185 | |
| 186 | if(MCUBOOT_BUILTIN_KEY) |
Maulik Patel | d1afad0 | 2025-04-14 13:04:35 +0100 | [diff] [blame] | 187 | set(wrapper_args ${wrapper_args} --psa-key-ids ${TFM_NS_KEY_ID}) |
| 188 | endif() |
| 189 | |
Gergely Kovacs | 4d50f25 | 2024-10-07 10:23:36 +0000 | [diff] [blame] | 190 | add_custom_target(${NS_TARGET_NAME}_signed_bin |
| 191 | SOURCES ${CMAKE_BINARY_DIR}/bin/${NS_TARGET_NAME}_signed.bin |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 192 | ) |
Gergely Kovacs | 4d50f25 | 2024-10-07 10:23:36 +0000 | [diff] [blame] | 193 | add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/${NS_TARGET_NAME}_signed.bin |
Anton Komlev | c88e2ac | 2024-09-12 16:46:39 +0100 | [diff] [blame] | 194 | DEPENDS ${NS_TARGET_NAME}_bin |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 195 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/layout_files/signing_layout_ns.o |
David Hu | b5f10a5 | 2023-10-26 22:24:10 +0800 | [diff] [blame] | 196 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/scripts |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 197 | |
Dávid Házi | 34cf9b9 | 2023-10-11 11:10:41 +0200 | [diff] [blame] | 198 | #Sign non-secure binary image with provided secret key |
Maulik Patel | d1afad0 | 2025-04-14 13:04:35 +0100 | [diff] [blame] | 199 | COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/scripts/wrapper/wrapper.py ${wrapper_args} |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 200 | ) |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 201 | |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 202 | # Create concatenated binary image from the two independently signed |
| 203 | # binary file. This only uses the local assemble.py script (not from |
| 204 | # upstream mcuboot) because that script is geared towards zephyr |
| 205 | # support |
Dávid Házi | 1a72fd4 | 2024-03-06 18:33:45 +0100 | [diff] [blame] | 206 | add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/tfm_s_ns_signed.bin |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 207 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/tfm_s_signed.bin |
Anton Komlev | c88e2ac | 2024-09-12 16:46:39 +0100 | [diff] [blame] | 208 | DEPENDS ${CMAKE_BINARY_DIR}/bin/${NS_TARGET_NAME}_signed.bin |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 209 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/layout_files/signing_layout_s.o |
David Hu | b5f10a5 | 2023-10-26 22:24:10 +0800 | [diff] [blame] | 210 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/scripts |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 211 | |
Dávid Házi | 34cf9b9 | 2023-10-11 11:10:41 +0200 | [diff] [blame] | 212 | COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/scripts/assemble.py |
| 213 | --layout ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/layout_files/signing_layout_s.o |
| 214 | --secure ${CMAKE_CURRENT_SOURCE_DIR}/bin/tfm_s_signed.bin |
Gergely Kovacs | 4d50f25 | 2024-10-07 10:23:36 +0000 | [diff] [blame] | 215 | --non_secure ${CMAKE_BINARY_DIR}/bin/${NS_TARGET_NAME}_signed.bin |
Dávid Házi | 1a72fd4 | 2024-03-06 18:33:45 +0100 | [diff] [blame] | 216 | --output ${CMAKE_BINARY_DIR}/tfm_s_ns_signed.bin |
Dávid Házi | 34cf9b9 | 2023-10-11 11:10:41 +0200 | [diff] [blame] | 217 | ) |
| 218 | else() |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 219 | add_custom_target(tfm_s_ns_bin |
Dávid Házi | 1a72fd4 | 2024-03-06 18:33:45 +0100 | [diff] [blame] | 220 | SOURCES ${CMAKE_BINARY_DIR}/bin/tfm_s_ns.bin |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 221 | ) |
Dávid Házi | 1a72fd4 | 2024-03-06 18:33:45 +0100 | [diff] [blame] | 222 | add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/tfm_s_ns.bin |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 223 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/tfm_s.bin |
Anton Komlev | 8ab4f04 | 2025-06-03 21:13:07 +0100 | [diff] [blame] | 224 | DEPENDS ${NS_TARGET_NAME}_bin |
David Hu | b5f10a5 | 2023-10-26 22:24:10 +0800 | [diff] [blame] | 225 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/layout_files/signing_layout_s_ns.o |
| 226 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/scripts |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 227 | |
Dávid Házi | 34cf9b9 | 2023-10-11 11:10:41 +0200 | [diff] [blame] | 228 | # concatenate S + NS binaries into tfm_s_ns.bin |
| 229 | COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/scripts/assemble.py |
David Hu | b5f10a5 | 2023-10-26 22:24:10 +0800 | [diff] [blame] | 230 | --layout ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/layout_files/signing_layout_s_ns.o |
Dávid Házi | 34cf9b9 | 2023-10-11 11:10:41 +0200 | [diff] [blame] | 231 | --secure ${CMAKE_CURRENT_SOURCE_DIR}/bin/tfm_s.bin |
Gergely Kovacs | 4d50f25 | 2024-10-07 10:23:36 +0000 | [diff] [blame] | 232 | --non_secure $<TARGET_FILE_DIR:${NS_TARGET_NAME}>/${NS_TARGET_NAME}.bin |
Dávid Házi | 1a72fd4 | 2024-03-06 18:33:45 +0100 | [diff] [blame] | 233 | --output ${CMAKE_BINARY_DIR}/bin/tfm_s_ns.bin |
David Hu | a01be0a | 2023-10-25 23:08:10 +0800 | [diff] [blame] | 234 | ) |
| 235 | |
Maulik Patel | 439be35 | 2025-04-15 14:34:28 +0100 | [diff] [blame^] | 236 | set(wrapper_args |
| 237 | --version ${MCUBOOT_IMAGE_VERSION_S} |
| 238 | --layout ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/layout_files/signing_layout_s_ns.o |
| 239 | --key ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/keys/image_s_signing_private_key.pem |
| 240 | --public-key-format $<IF:$<BOOL:${MCUBOOT_HW_KEY}>,full,hash> |
| 241 | --align ${MCUBOOT_ALIGN_VAL} |
| 242 | --pad |
| 243 | --pad-header |
| 244 | -H ${BL2_HEADER_SIZE} |
| 245 | -s ${MCUBOOT_SECURITY_COUNTER_S} |
| 246 | -L ${MCUBOOT_ENC_KEY_LEN} |
| 247 | $<$<STREQUAL:${MCUBOOT_UPGRADE_STRATEGY},OVERWRITE_ONLY>:--overwrite-only> |
| 248 | $<$<BOOL:${MCUBOOT_CONFIRM_IMAGE}>:--confirm> |
| 249 | $<$<BOOL:${MCUBOOT_ENC_IMAGES}>:-E${CMAKE_CURRENT_SOURCE_DIR}/image_signing/keys/image_enc_key.pem> |
| 250 | $<$<BOOL:${MCUBOOT_MEASURED_BOOT}>:--measured-boot-record> |
| 251 | ${CMAKE_BINARY_DIR}/bin/tfm_s_ns.bin |
| 252 | ${CMAKE_BINARY_DIR}/tfm_s_ns_signed.bin |
| 253 | ) |
| 254 | |
| 255 | if(MCUBOOT_BUILTIN_KEY) |
| 256 | set(wrapper_args ${wrapper_args} --psa-key-ids ${TFM_S_KEY_ID}) |
| 257 | endif() |
| 258 | |
Dávid Házi | 1a72fd4 | 2024-03-06 18:33:45 +0100 | [diff] [blame] | 259 | add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/tfm_s_ns_signed.bin |
| 260 | DEPENDS tfm_s_ns_bin ${CMAKE_BINARY_DIR}/bin/tfm_s_ns.bin |
David Hu | b5f10a5 | 2023-10-26 22:24:10 +0800 | [diff] [blame] | 261 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/layout_files/signing_layout_s_ns.o |
David Hu | b5f10a5 | 2023-10-26 22:24:10 +0800 | [diff] [blame] | 262 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/scripts |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 263 | |
Dávid Házi | 34cf9b9 | 2023-10-11 11:10:41 +0200 | [diff] [blame] | 264 | # sign the combined tfm_s_ns.bin file |
| 265 | COMMAND ${Python3_EXECUTABLE} |
| 266 | ${CMAKE_CURRENT_SOURCE_DIR}/image_signing/scripts/wrapper/wrapper.py |
Maulik Patel | 439be35 | 2025-04-15 14:34:28 +0100 | [diff] [blame^] | 267 | ${wrapper_args} |
Dávid Házi | 34cf9b9 | 2023-10-11 11:10:41 +0200 | [diff] [blame] | 268 | ) |
| 269 | endif() |
Anton Komlev | aee4b61 | 2023-05-14 17:38:36 +0100 | [diff] [blame] | 270 | endif() |