Skip to content

Commit

Permalink
dump: dump
Browse files Browse the repository at this point in the history
dump

Signed-off-by: Sebastian Bøe <[email protected]>
  • Loading branch information
SebastianBoe committed Mar 5, 2019
1 parent 048168a commit 8fd86ad
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 8 deletions.
18 changes: 18 additions & 0 deletions boot/zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ if(NOT CONFIG_BOOT_SIGNATURE_KEY_FILE STREQUAL "")
else()
set(KEY_FILE ${MCUBOOT_DIR}/${CONFIG_BOOT_SIGNATURE_KEY_FILE})
endif()

set_property(
GLOBAL
PROPERTY
KEY_FILE
${KEY_FILE}
)

set(GENERATED_PUBKEY ${ZEPHYR_BINARY_DIR}/autogen-pubkey.c)
add_custom_command(
OUTPUT ${GENERATED_PUBKEY}
Expand All @@ -175,3 +183,13 @@ if(NOT CONFIG_BOOT_SIGNATURE_KEY_FILE STREQUAL "")
)
zephyr_library_sources(${GENERATED_PUBKEY})
endif()

# TODO: Configurable?
set_property(GLOBAL APPEND PROPERTY
HEX_FILES_TO_MERGE
${PROJECT_BINARY_DIR}/zephyr/${KERNEL_HEX_NAME}
)
set_property(GLOBAL APPEND PROPERTY
HEX_FILES_TO_MERGE_TARGET
${logical_target_for_zephyr_elf}
)
8 changes: 0 additions & 8 deletions boot/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ config BOOT_SIGNATURE_TYPE_ECDSA_P256

endchoice

config BOOT_SIGNATURE_KEY_FILE
string "PEM key file"
default ""
help
The key file will be parsed by imgtool's getpub command and a .c source
with the public key information will be written in a format expected by
MCUboot.

config MBEDTLS_CFG_FILE
default "mcuboot-mbedtls-cfg.h"

Expand Down
36 changes: 36 additions & 0 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
if(CONFIG_BOOTLOADER_MCUBOOT)
# Build a second bootloader image

set(MCUBOOT_BASE ${CMAKE_CURRENT_LIST_DIR}/..)

zephyr_add_executable(mcuboot)
add_subdirectory(${MCUBOOT_BASE}/boot/zephyr ${CMAKE_CURRENT_BINARY_DIR}/mcuboot)

# TODO: Assert that the bootloader and image use the same key.

set(SIGNED_IMAGE signed.hex)

set_property(GLOBAL APPEND PROPERTY
extra_post_build_commands
COMMAND
${PYTHON_EXECUTABLE}
${MCUBOOT_BASE}/scripts/imgtool.py
sign
--key ${MCUBOOT_BASE}/${CONFIG_BOOT_SIGNATURE_KEY_FILE}
--header-size ${CONFIG_TEXT_SECTION_OFFSET}
--align ${DT_FLASH_WRITE_BLOCK_SIZE}
--version 0.1 # TODO: Configurable?
--slot-size 0x32000 # TODO: Configurable?
${KERNEL_HEX_NAME} # TODO: Enforce that this will be present through Kconfig
${SIGNED_IMAGE}
)

set_property(GLOBAL APPEND PROPERTY
HEX_FILES_TO_MERGE
${SIGNED_IMAGE}
)
set_property(GLOBAL APPEND PROPERTY
HEX_FILES_TO_MERGE_TARGET
${logical_target_for_zephyr_elf}
)
endif()
19 changes: 19 additions & 0 deletions zephyr/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
if BOOTLOADER_MCUBOOT

config MCUBOOT_CMAKELISTS_DIR
string "Path to the directory of the MCUBoot CMakeLists.txt file"
default "$MCUBOOT_BASE/boot/zephyr/"

endif # BOOTLOADER_MCUBOOT

if MCUBOOT || BOOTLOADER_MCUBOOT
# TODO: Support sharing Kconfig configuration between images
config BOOT_SIGNATURE_KEY_FILE
string "PEM key file"
default "root-rsa-2048.pem"
help
The key file will be parsed by imgtool's getpub command and a .c source
with the public key information will be written in a format expected by
MCUboot.

endif # MCUBOOT || BOOTLOADER_MCUBOOT

0 comments on commit 8fd86ad

Please sign in to comment.