File tree Expand file tree Collapse file tree 7 files changed +61
-0
lines changed Expand file tree Collapse file tree 7 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -1314,6 +1314,7 @@ list(APPEND
13141314 ${extra_post_build_commands}
13151315 )
13161316
1317+
13171318add_custom_command (
13181319 TARGET ${logical_target_for_zephyr_elf}
13191320 POST_BUILD
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ add_subdirectory_ifdef(CONFIG_NET_BUF net)
1313add_subdirectory_ifdef(CONFIG_USB usb)
1414add_subdirectory (random)
1515add_subdirectory (storage)
16+ add_subdirectory (boot)
1617add_subdirectory_ifdef(CONFIG_SETTINGS settings)
1718add_subdirectory (fb)
1819add_subdirectory (power)
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ source "subsys/mgmt/Kconfig"
2323
2424source "subsys/net/Kconfig"
2525
26+ source "subsys/boot/Kconfig"
27+
2628source "subsys/shell/Kconfig"
2729
2830source "subsys/usb/Kconfig"
Original file line number Diff line number Diff line change 1+ add_subdirectory_ifdef(CONFIG_BOOTLOADER_MCUBOOT mcuboot)
Original file line number Diff line number Diff line change 1+ rsource "mcuboot/Kconfig"
Original file line number Diff line number Diff line change 1+ # Build a second bootloader image
2+
3+ # TODO: Make configurable like OT until west is supported.
4+ set (MCUBOOT_BASE "${ZEPHYR_BASE} /../mcuboot" )
5+ assert_exists(MCUBOOT_BASE)
6+
7+ zephyr_add_executable(mcuboot)
8+ add_subdirectory ("${MCUBOOT_BASE} /boot/zephyr" ${CMAKE_CURRENT_BINARY_DIR} /mcuboot)
9+
10+ # TODO: Assert that the bootloader and image use the same key.
11+
12+ set (SIGNED_IMAGE signed.hex)
13+
14+ set_property (GLOBAL APPEND PROPERTY
15+ extra_post_build_commands
16+ COMMAND
17+ ${PYTHON_EXECUTABLE}
18+ ${MCUBOOT_BASE} /scripts/imgtool.py
19+ sign
20+ --key ${MCUBOOT_BASE} /${CONFIG_BOOT_SIGNATURE_KEY_FILE}
21+ --header-size ${CONFIG_TEXT_SECTION_OFFSET}
22+ --align 8 # TODO: Configurable?
23+ --version 1.0 # TODO: Configurable?
24+ --slot-size 0x32000 # TODO: Configurable?
25+ ${KERNEL_HEX_NAME} # TODO: Enforce that this will be present through Kconfig
26+ ${SIGNED_IMAGE}
27+ )
28+
29+ set_property (GLOBAL APPEND PROPERTY
30+ HEX_FILES_TO_MERGE
31+ ${SIGNED_IMAGE}
32+ )
33+ set_property (GLOBAL APPEND PROPERTY
34+ HEX_FILES_TO_MERGE_TARGET
35+ ${logical_target_for_zephyr_elf}
36+ )
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