-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Zephyr sysbuild / multi image #40555
Zephyr sysbuild / multi image #40555
Conversation
6fb2ea3
to
c9d8d30
Compare
c9d8d30
to
74e08c0
Compare
74e08c0
to
8591509
Compare
The infrastructure in this RFC supports adding extra bootloaders, either Zephyr based or bare-metal.
This is one more PR which should benefit from the multi image build infrastructure in this RFC. |
913fb21
to
ac15f41
Compare
ac15f41
to
afb8bef
Compare
afb8bef
to
477aa06
Compare
be1e96d
to
0fada6a
Compare
This commit introduces image signing by adding the possibility to specify algorithm and signing key for sysbuild images. It introduces Kconfig setting to specify signing algorithm and key file. It will default the signing key to the default key provided by MCUBoot if no key has been specified. When signing is enabling, the signature key will be passed to the application so the build system can sign the image as post build step. Signed-off-by: Torsten Rasmussen <[email protected]>
2f20dfc
to
70e05e2
Compare
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.
The issue with setting up a build and re-configuring it with menuconfig and getting an invalid string for e.g. the mcuboot signing key seems to be an issue with how the cmake cache works.
help | ||
Do not Include a bootloader in the build | ||
|
||
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.
As I understand there is dedicated namespace for these Kconfig properties (and will never merge to with the application properties).
For instance this property does something else than CONFIG_BOOTLOADER_MCUBOOT of zephyr-rtos app.
I want to avoid confusion.
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 believe the help text can definitely be improved.
But whether we should invent two different setting names or have them identical as now depends a lot on how you look at this.
The Zephyr setting states:
Lines 682 to 686 in 83d73f6
This option signifies that the target uses MCUboot as a bootloader, | |
or in other words that the image is to be chain-loaded by MCUboot. | |
This sets several required build system and Device Tree options in | |
order for the image generated to be bootable using the MCUboot open | |
source bootloader. Currently this includes: |
and my view on this is that this is also true for the sysbuild BOOTLOADER_MCUBOOT
because it propagates this setting to the application so that the app is chain loaded by MCUboot, as well as devicetree is setup accordingly.
Not inside sysbuild itself, but in the images built by sysbuild.
Ref:
zephyr/share/sysbuild/CMakeLists.txt
Lines 33 to 37 in 70e05e2
# Propagate bootloader and signing settings from this system to the MCUboot and | |
# application image build systems. | |
if(SB_CONFIG_BOOTLOADER_MCUBOOT) | |
set(${app_name}_CONFIG_BOOTLOADER_MCUBOOT y CACHE STRING | |
"MCUBOOT is enabled as bootloader" FORCE |
Of course sysbuild itself does one more thing which the application itself cannot do, and that is building and flashing of MCUboot in addition.
I believe having identical name for BOOTLOADER_MCUBOOT
makes it easier for users to transition to sysbuild and understand how to build a sample with MCUboot, and that the small addition that sysbuild provides is not sufficient to justify two different names.
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.
OK with the west changes. Please send a follow-up commit adding --domain to the synopsis (not going to -1 so you don't have to get your +1s again)
Done: #48678 |
@ram1kor are you perhaps setting a board root in your sample's CMakeLists.txt file like this:
If you are, then sysbuild will not be able to pick up your board root cause it doesn't parse the CMakeLists.txt file of the sample.
another option is to turn your repo into a Zephyr module and specify the boards root at the |
I've tried to build hello_world for nucleo_f746zg board according to the instruction using the following command: pinctrl.dtsi files comes with stm32-hal. It seems that the build system misses the include path pointing to stm32-hal. In the very same time the traditional build (eg without --sysbuild option) works correctly. |
@gkujawsk Please run |
This is an PR for a direction of multi image support in Zephyr, as discussed in dev-review meeting Nov. 11. 2021.
Fixes: #40309
Documentation PR: #43846
Depends on: #41301With #37872 the issue regarding multi image build system came up again.
This PR takes another direction, as it does not interfere with the existing Zephyr CMake build system infrastructure.
Zephyr build code and samples are not impacted with this PR.
Instead a dedicated west build project has been created in
<zephyr>/sysbuild
(feel free to propose alternative location).This project is capable of building a regular Zephyr sample as well as MCUBoot.
Each sample is seen as a dedicated project.
west build
has been extended to support multi image for building, as well aswest flash
supports flashing of all images in the multi image build.Per default, everything builds as normal, that is a single image build IS Still build as:
which gives:
but the same sample can now also be build and flash with
mcuboot
(or in principle any other multi image setup), simply by enabling MCUboot and build with sysbuild option:where it can be seen that both
hello_world
andmcuboot
were successfully build.Both samples can be flash in a single invocation with
west flash
:Resulting in following output on the terminal.
Running
ninja -Cbuild sysbuild_menuconfig
will provide a sysbuild configuration interface:menuconfig
forhello_world
is started as always so that the user doesn't need to change workflow.west build -bnrf52840dk_nrf52840 samples/hello_world -t menuconfig
menuconfig
for mcuboot can be started by pre-fixing menuconfig with the name of the image.west build -bnrf52840dk_nrf52840 samples/hello_world/ -t mcuboot_menuconfig
If users want to build using sysbuild per default, then a config build option can be set, like:
which will build using sysbuild per default.
A user enabling
sysbuild
per default can still choose to build without sysbuild in specific cases by applying--no-sysbuild
, like:Slides from devreview presentaion:
SYSBuild architectural overview
List of alternative name proposals instead of sysbuild: