File tree Expand file tree Collapse file tree 4 files changed +73
-8
lines changed Expand file tree Collapse file tree 4 files changed +73
-8
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,14 @@ if(NOT CONFIG_BOOT_SIGNATURE_KEY_FILE STREQUAL "")
161161 else ()
162162 set (KEY_FILE ${MCUBOOT_DIR} /${CONFIG_BOOT_SIGNATURE_KEY_FILE} )
163163 endif ()
164+
165+ set_property (
166+ GLOBAL
167+ PROPERTY
168+ KEY_FILE
169+ ${KEY_FILE}
170+ )
171+
164172 set (GENERATED_PUBKEY ${ZEPHYR_BINARY_DIR} /autogen-pubkey.c)
165173 add_custom_command (
166174 OUTPUT ${GENERATED_PUBKEY}
@@ -175,3 +183,13 @@ if(NOT CONFIG_BOOT_SIGNATURE_KEY_FILE STREQUAL "")
175183 )
176184 zephyr_library_sources(${GENERATED_PUBKEY} )
177185endif ()
186+
187+ # TODO: Configurable?
188+ set_property (GLOBAL APPEND PROPERTY
189+ HEX_FILES_TO_MERGE
190+ ${PROJECT_BINARY_DIR} /zephyr/${KERNEL_HEX_NAME}
191+ )
192+ set_property (GLOBAL APPEND PROPERTY
193+ HEX_FILES_TO_MERGE_TARGET
194+ ${logical_target_for_zephyr_elf}
195+ )
Original file line number Diff line number Diff line change @@ -60,14 +60,6 @@ config BOOT_SIGNATURE_TYPE_ECDSA_P256
6060
6161endchoice
6262
63- config BOOT_SIGNATURE_KEY_FILE
64- string "PEM key file"
65- default ""
66- help
67- The key file will be parsed by imgtool's getpub command and a .c source
68- with the public key information will be written in a format expected by
69- MCUboot.
70-
7163config MBEDTLS_CFG_FILE
7264 default "mcuboot-mbedtls-cfg.h"
7365
Original file line number Diff line number Diff line change 1+ if (CONFIG_BOOTLOADER_MCUBOOT)
2+ # Build a second bootloader image
3+
4+ set (MCUBOOT_BASE ${CMAKE_CURRENT_LIST_DIR} /..)
5+
6+ zephyr_add_executable(mcuboot)
7+ add_subdirectory (${MCUBOOT_BASE} /boot/zephyr ${CMAKE_CURRENT_BINARY_DIR} /mcuboot)
8+
9+ # TODO: Assert that the bootloader and image use the same key.
10+
11+ set (SIGNED_IMAGE signed.hex)
12+
13+ set_property (GLOBAL APPEND PROPERTY
14+ extra_post_build_commands
15+ COMMAND
16+ ${PYTHON_EXECUTABLE}
17+ ${MCUBOOT_BASE} /scripts/imgtool.py
18+ sign
19+ --key ${MCUBOOT_BASE} /${CONFIG_BOOT_SIGNATURE_KEY_FILE}
20+ --header-size ${CONFIG_TEXT_SECTION_OFFSET}
21+ --align ${DT_FLASH_WRITE_BLOCK_SIZE}
22+ --version 0.1 # TODO: Configurable?
23+ --slot-size 0x32000 # TODO: Configurable?
24+ ${KERNEL_HEX_NAME} # TODO: Enforce that this will be present through Kconfig
25+ ${SIGNED_IMAGE}
26+ )
27+
28+ set_property (GLOBAL APPEND PROPERTY
29+ HEX_FILES_TO_MERGE
30+ ${SIGNED_IMAGE}
31+ )
32+ set_property (GLOBAL APPEND PROPERTY
33+ HEX_FILES_TO_MERGE_TARGET
34+ ${logical_target_for_zephyr_elf}
35+ )
36+ endif ()
Original file line number Diff line number Diff line change 1+ if BOOTLOADER_MCUBOOT
2+
3+ config MCUBOOT_CMAKELISTS_DIR
4+ string "Path to the directory of the MCUBoot CMakeLists.txt file"
5+ default "$MCUBOOT_BASE/boot/zephyr/"
6+
7+ endif # BOOTLOADER_MCUBOOT
8+
9+ if MCUBOOT || BOOTLOADER_MCUBOOT
10+ # TODO: Support sharing Kconfig configuration between images
11+ config BOOT_SIGNATURE_KEY_FILE
12+ string "PEM key file"
13+ default "root-rsa-2048.pem"
14+ help
15+ The key file will be parsed by imgtool's getpub command and a .c source
16+ with the public key information will be written in a format expected by
17+ MCUboot.
18+
19+ endif # MCUBOOT || BOOTLOADER_MCUBOOT
You can’t perform that action at this time.
0 commit comments