-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Multi image building #430
Conversation
7f25dd0
to
51177e0
Compare
Some of those changes were already merged as part of 048168a, please rebase! |
51177e0
to
8fd86ad
Compare
Done |
640c107
to
c57debc
Compare
@@ -0,0 +1,39 @@ | |||
if(CONFIG_BOOTLOADER_MCUBOOT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to drop a README in this directory or add a comment to this file saying that the zephyr
directory is for use of mcuboot as a zephyr module (https://docs.zephyrproject.org/latest/application/index.html#modules-external-projects), and that boot/zephyr is where the Zephyr-specific application code is, to avoid confusing newcomers who don't know to look for boot/zephyr yet.
I've had to clear up confusion that CONFIG_BOOTLOADER_MCUBOOT should not be enabled when building mcuboot itself, but is rather an option that's enabled by applications using MCUboot; this file muddies that distinction a bit, so a comment would be nice to clear up that what's going on here is kind of complex:
- Application CMakeLists.txt
- Application boilerplate.cmake
- Application zephyr_modules.cmake
- This file
- MCUboot CMakeLists.txt (boot/zephyr/CMakeLists.txt)
- MCUboot boilerplate.cmake
...
if (${require_build}) | ||
add_subdirectory(${MCUBOOT_BASE}/boot/zephyr ${CMAKE_CURRENT_BINARY_DIR}/mcuboot) | ||
|
||
# TODO: Assert that the bootloader and image use the same key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tricky: multiple keys are supported simultaneously.
--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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Configurable?
I think so. One could set it at CMake time; maybe even let the environment override that. That'd be pretty convenient on macOS and Linux at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate the benefits of not simply having this as a Kconfig option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking of things like developer workflows where you want to update this on a build-by-build basis every few minutes, without having to go through the overhead of running menuconfig. An environment variable makes that pretty easy -- not sure if it's possible to have a kconfig option fall back to an env var dynamically, but I believe not. OTOH from a reproducible builds perspective I take your point. Tradeoffs here, your call.
--header-size ${CONFIG_TEXT_SECTION_OFFSET} | ||
--align ${DT_FLASH_WRITE_BLOCK_SIZE} | ||
--version 0.1 # TODO: Configurable? | ||
--slot-size 0x32000 # TODO: Configurable? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not configurable; this is from DT (DT_FLASH_AREA_IMAGE_0_SIZE
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix
|
||
# TODO: Assert that the bootloader and image use the same key. | ||
|
||
set(SIGNED_IMAGE signed.hex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind zephyr.signed.hex, to match the default from west sign
?
|
||
if MCUBOOT_BUILD_STRATEGY_USE_HEX_FILE | ||
|
||
config MCUBOOT_HEX_FILE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you meant this to be a choice option; did you? Shouldn't it be moved after the endchoice
?
endif # BOOTLOADER_MCUBOOT | ||
|
||
if MCUBOOT || BOOTLOADER_MCUBOOT | ||
# TODO: Support sharing Kconfig configuration between images |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a really interesting idea!
@@ -60,14 +60,6 @@ config BOOT_SIGNATURE_TYPE_ECDSA_P256 | |||
|
|||
endchoice | |||
|
|||
config BOOT_SIGNATURE_KEY_FILE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this break the build when MCUboot is built as a single image?
# TODO: Configurable? | ||
set_property(GLOBAL APPEND PROPERTY | ||
HEX_FILES_TO_MERGE | ||
${PROJECT_BINARY_DIR}/zephyr/${KERNEL_HEX_NAME} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't zephyr_add_executable()
taking care of these?
set_property( | ||
GLOBAL | ||
PROPERTY | ||
KEY_FILE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this used?
c57debc
to
b0bedd7
Compare
Unless I'm misreading something, the commit is titled "dump: dump\n\ndump". Perhaps a better description is in order. I'm also wondering if we need a better name for this than "multi image", since we are using multi image to refer to having multiple images that MCUboot knows how to load. I'm not sure what terms are best here. But, "multi-image" from MCUboot's perspective makes sense as MCUboot itself handling multiple images. Maybe "multi build"? I'm not real sure. |
Migrate to support multi-image building. Must be applied simultaneously with zephyrproject-rtos/zephyr#13672 See the Zephyr PR for details. Signed-off-by: Sebastian Bøe <[email protected]>
b0bedd7
to
083b331
Compare
The commit message has been improved. |
Since these are two different domains, I'm hoping it will always be obvious from context what we are talking about. It will be difficult to change this terminology as it is in wide use already. To disambiguate when not obvious from context we can try to be more verbose, e.g. multi-image building. |
Signed-off-by: Håkon Øye Amundsen <[email protected]>
@SebastianBoe Please rebase on latest master! |
Closing, zephyrproject-rtos/zephyr#13672 was not accepted. |
WIP support for multi-image building.
Must be applied simultaneously with zephyrproject-rtos/zephyr#13672
See the Zephyr PR for details.