#------------------------------------------------------------------------------- # Copyright (c) 2021-2024, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # #------------------------------------------------------------------------------- find_package(Python3) add_subdirectory(lib) add_subdirectory(shared_lib) add_executable(bl1_1) set_target_properties(bl1_1 PROPERTIES SUFFIX ".axf" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" ) add_convert_to_bin_target(bl1_1) target_link_options(bl1_1 PRIVATE $<$:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/bl1_1.map> $<$:--map> $<$:--map\;${CMAKE_BINARY_DIR}/bin/bl1_1.map> ) target_compile_options(bl1_1 PUBLIC ${BL1_COMPILER_CP_FLAG} ) target_link_options(bl1_1 PUBLIC ${BL1_LINKER_CP_OPTION} ) target_sources(bl1_1 PRIVATE main.c $<$:${CMAKE_SOURCE_DIR}/platform/ext/common/syscalls_stub.c> ) target_link_libraries(bl1_1 PRIVATE bl1_1_lib bl1_1_shared_lib platform_bl1_1 $<$:bl1_1_tests> ) target_compile_definitions(bl1_1 PRIVATE $<$:TEST_BL1_1> $<$,$>>:TFM_MEASURED_BOOT_API> ) target_share_symbols(bl1_1 ${BL1_SHARED_SYMBOLS_PATH}) ################################################################################ add_library(signing_layout_bl1_2 OBJECT signing_layout.c) target_compile_options(signing_layout_bl1_2 PRIVATE $<$:-E\;-xc> $<$:-E\;-xc> $<$:--preprocess=ns\;$> ) target_link_libraries(signing_layout_bl1_2 PRIVATE platform_region_defs ) ################################################################################ get_target_property(bin_dir bl1_2 RUNTIME_OUTPUT_DIRECTORY) add_custom_target(bl1_2_padded_bin ALL SOURCES bl1_2_padded.bin ${bin_dir}/bl1_2_padded.bin SOURCES bl1_2_padded_hash.bin ${bin_dir}/bl1_2_padded_hash.bin ) add_custom_command(OUTPUT bl1_2_padded.bin bl1_2_padded_hash.bin OUTPUT ${bin_dir}/bl1_2_padded.bin ${bin_dir}/bl1_2_padded_hash.bin DEPENDS $/bl1_2.bin bl1_2_bin signing_layout_bl1_2 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/create_bl1_2_img.py COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/create_bl1_2_img.py --input_file $/bl1_2.bin --img_output_file bl1_2_padded.bin --hash_output_file bl1_2_padded_hash.bin --signing_layout_file $ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/bl1_2_padded.bin $ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/bl1_2_padded_hash.bin $ ) ################################################################################ if (TFM_BL1_DEFAULT_PROVISIONING) add_custom_target(bl1_provisioning_bundle ALL SOURCES bl1_provisioning_bundle.bin ) add_custom_command(OUTPUT bl1_provisioning_bundle.bin DEPENDS ${TFM_BL2_ENCRYPTION_KEY_PATH} DEPENDS ${TFM_GUK_PATH} DEPENDS $/bl1_2_padded_hash.bin DEPENDS $/bl2_signed_hash.bin DEPENDS $/bl1_2_padded.bin bl1_2_padded_bin bl2_signed_bin DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/create_provisioning_bundle.py COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/create_provisioning_bundle.py --bl2_encryption_key_input_file ${TFM_BL2_ENCRYPTION_KEY_PATH} --bl2_signing_key_input_file ${TFM_BL2_SIGNING_KEY_PATH} --guk_input_file ${TFM_GUK_PATH} --bl1_2_padded_hash_input_file $/bl1_2_padded_hash.bin --bl2_signed_hash_input_file $/bl2_signed_hash.bin --bl1_2_input_file $/bl1_2_padded.bin --bundle_output_file bl1_provisioning_bundle.bin COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/bl1_provisioning_bundle.bin $ ) endif()