Skip to content

Commit

Permalink
cmake: update sign.cmake and debug_keys.cmake to use CMAKE_BINARY_DIR
Browse files Browse the repository at this point in the history
Update sign.cmake and debug_keys.cmake to use CMAKE_BINARY_DIR instead
of PROJECT_BINARY_DIR.

Using CMAKE_BINARY_DIR ensures that the pem files are always placed at
the toplevel in the build directory.

Signed-off-by: Torsten Rasmussen <[email protected]>
  • Loading branch information
tejlmand authored and anangl committed Jun 15, 2024
1 parent 82391a3 commit e01e4cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions cmake/sysbuild/debug_keys.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if(NOT SB_CONFIG_SECURE_BOOT_SIGNING_CUSTOM AND "${SB_CONFIG_SECURE_BOOT_SIGNING
\n"
)

set(DEBUG_SIGN_KEY ${PROJECT_BINARY_DIR}/GENERATED_NON_SECURE_SIGN_KEY_PRIVATE.pem)
set(DEBUG_SIGN_KEY ${CMAKE_BINARY_DIR}/GENERATED_NON_SECURE_SIGN_KEY_PRIVATE.pem)
set(SIGNATURE_PRIVATE_KEY_FILE ${DEBUG_SIGN_KEY})
add_custom_command(
OUTPUT
Expand Down Expand Up @@ -90,10 +90,10 @@ if("${SB_CONFIG_SECURE_BOOT_PUBLIC_KEY_FILES}" STREQUAL "debug")
\n"
)

set(debug_public_key_0 ${PROJECT_BINARY_DIR}/GENERATED_NON_SECURE_PUBLIC_0.pem)
set(debug_private_key_0 ${PROJECT_BINARY_DIR}/GENERATED_NON_SECURE_PRIVATE_0.pem)
set(debug_public_key_1 ${PROJECT_BINARY_DIR}/GENERATED_NON_SECURE_PUBLIC_1.pem)
set(debug_private_key_1 ${PROJECT_BINARY_DIR}/GENERATED_NON_SECURE_PRIVATE_1.pem)
set(debug_public_key_0 ${CMAKE_BINARY_DIR}/GENERATED_NON_SECURE_PUBLIC_0.pem)
set(debug_private_key_0 ${CMAKE_BINARY_DIR}/GENERATED_NON_SECURE_PRIVATE_0.pem)
set(debug_public_key_1 ${CMAKE_BINARY_DIR}/GENERATED_NON_SECURE_PUBLIC_1.pem)
set(debug_private_key_1 ${CMAKE_BINARY_DIR}/GENERATED_NON_SECURE_PRIVATE_1.pem)

list(APPEND PUBLIC_KEY_FILES ${debug_public_key_0} ${debug_public_key_1})

Expand Down
4 changes: 2 additions & 2 deletions cmake/sysbuild/sign.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

function(b0_gen_keys)
set(GENERATED_PATH ${PROJECT_BINARY_DIR}/nrf/subsys/bootloader/generated)
set(GENERATED_PATH ${CMAKE_BINARY_DIR}/nrf/subsys/bootloader/generated)

# This is needed for make, ninja is able to resolve and create the path but make
# is not able to resolve it.
Expand Down Expand Up @@ -67,7 +67,7 @@ function(b0_gen_keys)
endfunction()

function(b0_sign_image slot)
set(GENERATED_PATH ${PROJECT_BINARY_DIR}/nrf/subsys/bootloader/generated)
set(GENERATED_PATH ${CMAKE_BINARY_DIR}/nrf/subsys/bootloader/generated)

# Get variables for secure boot usage
sysbuild_get(${slot}_sb_validation_info_version IMAGE ${slot} VAR CONFIG_SB_VALIDATION_INFO_VERSION KCONFIG)
Expand Down

0 comments on commit e01e4cc

Please sign in to comment.