UBOOT_ENV causes dependency loop
Hello everyone,
I am facing a dependency loop that I'm having trouble understanding how to break. The issue appeared when I tried to move the u-boot boot script into the kernel fitImage as part of improving secure boot. Before this dependency loop I had a working secure boot configuration which looked something like this:
SPL + dtb (signed by NXP tool) -> U-boot + DTB (signed and verified by SPL) -> Linux kernel + DTB + optee (signed and verified by U-boot).
[U-Boot + DTB] and [Linux kernel + DTB + optee] are both stored in fitImages. As far as I can understand u-boot has a dependency on the Linux kernel since it will re-sign the kernel and add the public key to the U-boot DTB-file (this is how I interpret what is going on in uboot-sign.bbclass). I believe what happens next when I try to put the u-boot script inside the kernel fitImage is that I get a dependency from the Linux-kernel (the do_assemble_fitimage task specifically) to the do_populate_sysroot task of u-boot. This is due to the kernel requiring to have access to the boot-script file to put it int he fitImage. This makes bitbake unhappy since there cannot be a mutual dependency between U-boot and Linux kernel. Not sure if I am missing something obvious here, it seems like this must be a fairly common setup when using secure boot?
//Pelle
The information contained in this email is intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential. Please delete and notify the sender if received in error. SKF does not accept liability for any damage arising from this email.
For information on SKF’s processing of your personal data, please visit SKF’s Privacy Policy available via www.skf.com<https://www.skf.com/privacy>.
Hi Pelle
Yes, that's unfortunately broken. The loop looks like this:
[image: image.png]
The problematic line is here:
https://git.yoctoproject.org/poky/tree/meta/classes-recipe/kernel-fitimage.bbclass#n45
There are some discussions ongoing about how the fitimage creation could be improved and simplified. Fixing the recipes and classes in poky is one approach. Another but quite different approach is this class here:
https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/classes/fitimage.bbclass
.
Sorry, I do not have a solution, but at least I confirm that the issue seems to be real.
Regards,
Adrian
Am Di., 10. Dez. 2024 um 20:29 Uhr schrieb Pelle Windestam via lists.yoctoproject.org <[email protected]>:
Quoted 46 lines
Hello everyone,
I am facing a dependency loop that I'm having trouble understanding how to break. The issue appeared when I tried to move the u-boot boot script into the kernel fitImage as part of improving secure boot. Before this dependency loop I had a working secure boot configuration which looked something like this:
SPL + dtb (signed by NXP tool) -> U-boot + DTB (signed and verified by SPL) -> Linux kernel + DTB + optee (signed and verified by U-boot).[U-Boot + DTB] and [Linux kernel + DTB + optee] are both stored in fitImages. As far as I can understand u-boot has a dependency on the Linux kernel since it will re-sign the kernel and add the public key to the U-boot DTB-file (this is how I interpret what is going on in uboot-sign.bbclass). I believe what happens next when I try to put the u-boot script inside the kernel fitImage is that I get a dependency from the Linux-kernel (the
do_assemble_fitimagetask specifically) to thedo_populate_sysroottask of u-boot. This is due to the kernel requiring to have access to the boot-script file to put it int he fitImage. This makes bitbake unhappy since there cannot be a mutual dependency between U-boot and Linux kernel. Not sure if I am missing something obvious here, it seems like this must be a fairly common setup when using secure boot?//Pelle
The information contained in this email is intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential. Please delete and notify the sender if received in error. SKF does not accept liability for any damage arising from this email.For information on SKF’s processing of your personal data, please visit SKF’s Privacy Policy available via www.skf.com<https://www.skf.com/privacy
Quoted 1 line
.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#64427):
https://lists.yoctoproject.org/g/yocto/message/64427
Mute This Topic: https://lists.yoctoproject.org/mt/110031442/4454582
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Thanks for the tips Adrian, I will look into that fitimage.bbclass. I was also thinking about the dependency between u-boot and linux kernel. It seems to be required since uboot-sign.bbclass "re-signs" the fitImage (and puts the public key in the u-boot dtb with the same command) and then does a verification to check that the key works. But is the re-signing really required? As far as I could tell trying to navigate the uboot-sign.bbclass the re-signed image is never used except for doing the verification. If one would skip the verification step, I think it would suffice to to put the public key into the u-boot dtb and thus be able drop the dependency on the kernel recipe? Doing the verification is of course a good idea to make sure you do not end up with a non-bootable fitImage, but it could work as a temporary work-around.
Hi Pelle
That's something where I did not yet look into all the details. But this needs to be considered for new architecture. Would you mind to document this aspect on this
bug https://bugzilla.yoctoproject.org/show_bug.cgi?id=12912? It's what I tried to mention with
"However, signing u-boot and kernel might cause some tricky dependencies which cannot be simplified. But understanding all these details needs a PoC implementation, I guess."
in my comment from
today https://bugzilla.yoctoproject.org/show_bug.cgi?id=12912#c3. It looks like you looked already deeper into this detail.
Adrian
Quoted 13 lines · Pelle Windestam via Lists.Yoctoproject.Org
Thanks for the tips Adrian, I will look into that fitimage.bbclass. I was also thinking about the dependency between u-boot and linux kernel. It seems to be required since uboot-sign.bbclass "re-signs" the fitImage (and puts the public key in the u-boot dtb with the same command) and then does a verification to check that the key works. But is the re-signing really required? As far as I could tell trying to navigate the uboot-sign.bbclass the re-signed image is never used except for doing the verification. If one would skip the verification step, I think it would suffice to to put the public key into the u- boot dtb and thus be able drop the dependency on the kernel recipe? Doing the verification is of course a good idea to make sure you do not end up with a non-bootable fitImage, but it could work as a temporary work-around.