Skip to content

Commit

Permalink
Merge pull request #3 from smartin-vossloh/sma/sign-key-type
Browse files Browse the repository at this point in the history
MCUboot: Dump config info
  • Loading branch information
smartin-vossloh authored Feb 7, 2024
2 parents 82c5721 + 0bf512a commit 370f168
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
20 changes: 20 additions & 0 deletions boot/zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,26 @@ if(NOT CONFIG_BOOT_SIGNATURE_KEY_FILE STREQUAL "")
endif()
message("MCUBoot bootloader key file: ${KEY_FILE}")

# Check whether the signature key file is tracked in a git repository.
# If so, this is not the production key.
cmake_path(SET sign_key_filepath NORMALIZE "${KEY_FILE}")

cmake_path(GET sign_key_filepath FILENAME sign_key_filename)
cmake_path(REMOVE_FILENAME sign_key_filepath OUTPUT_VARIABLE sign_key_directory)

execute_process(COMMAND git ls-files --error-unmatch -- ${sign_key_filename}
WORKING_DIRECTORY ${sign_key_directory}
RESULT_VARIABLE devel_keyfile
OUTPUT_QUIET
ERROR_QUIET)
if(${devel_keyfile} EQUAL 0)
message(STATUS "Using development signature key: ${sign_key_filepath}")
zephyr_compile_definitions(SIGNATURE_KEY="development")
else()
message(STATUS "Using production signature key")
zephyr_compile_definitions(SIGNATURE_KEY="production")
endif()

set(GENERATED_PUBKEY ${ZEPHYR_BINARY_DIR}/autogen-pubkey.c)
add_custom_command(
OUTPUT ${GENERATED_PUBKEY}
Expand Down
5 changes: 5 additions & 0 deletions boot/zephyr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,11 @@ void main(void)

(void)rc;

BOOT_LOG_INF("HW clock : %dMHz", CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / 1000000);
#ifdef SIGNATURE_KEY
BOOT_LOG_INF("Sign. key: " SIGNATURE_KEY);
#endif

mcuboot_status_change(MCUBOOT_STATUS_STARTUP);

#ifdef CONFIG_MCUBOOT_SERIAL
Expand Down

0 comments on commit 370f168

Please sign in to comment.