Linaro / meta-qcom

OpenEmbedded/Yocto Project BSP layer for Qualcomm based platforms
MIT License
61 stars 70 forks source link

Efi boot support #548

Closed quic-vkraleti closed 8 months ago

quic-vkraleti commented 9 months ago

To support systemd-boot as a boot manager, need to create an esp.bin with uki, uefi stub and other essential packaged into it. This is achieved in below patches.

  1. Extend systemd-boot recipe through a bbappend to provide Ukify tool.
  2. Add linux-qcom-efiimg bbclass to generate uki and in turn pack this uki into esp.bin
  3. Inherit linux-qcom-efiimg bbclass in linux-yocto & linux-linaro recipes to generate esp.bin
lumag commented 9 months ago

Also, did you consider using the wic's bootimg-efi plugin?

lumag commented 9 months ago

Also see https://lore.kernel.org/all/20230901233231.1109712-1-michelle.linto91@gmail.com/T/.

quic-vkraleti commented 9 months ago

Build error on arm7 is due to a bug in systemd code base. Faced same issue even without any of the above changes. https://github.com/systemd/systemd/commit/cecbb162a3134b43d2ca160e13198c73ff34c3ef fixes it. I'll pull this change a .patch for now to mitigate.

lumag commented 9 months ago

Also see https://lore.kernel.org/all/20230901233231.1109712-1-michelle.linto91@gmail.com/T/.

After internal discussion, I think the uki.bbclass is a way to go.

lumag commented 9 months ago

And by the play, please take a look at resolving the build error reported by the CI (for nodistro builds):

linux-yocto PROVIDES virtual/kernel but was skipped: missing required distro feature 'systemd' (not in DISTRO_FEATURES)

Thank you.

lumag commented 9 months ago

@quic-vkraleti Please send the systemd patches to the oe-core list.

lumag commented 8 months ago

@quic-vkraleti after these refactorings the ESP recipe together with the EFI_* configuration starts to look more and more like a distro feature. Maybe we repurpose it to the distro layer? (Again, maybe later, not now, if you don't have a distro layer yet).

quic-vkraleti commented 8 months ago

The meson fix was merged to oe-core, please drop it.

I think that changes to qcom-common.inc and the esp-image belong to the distro layer. They describe distro-specific solutions, which might change from distro to distro. Consider e.g. Yoe or poky deciding to use grub. This decision will conflict with the qcom-common changes / setup. Please move these chunks to your distro instead.

With these changes done I will merge this PR.

I haven't seen Poky recommending any bootloader as such. As I understand, bootloader is a choice of MACHINE but not DISTRO. I found "efi" in https://docs.yoctoproject.org/ref-manual/features.html#machine-features list.

We expect device to boot even for "nodistro" configurations. This won't be possible if esp is generated as part of distro layer. To draw parallels with the boot.img, today boot.img is in meta-qcom along with kernel recipe, I think esp.bin should also follow the same.

lumag commented 8 months ago

I'm going to merge this now.

quic-vkraleti commented 8 months ago

I'm going to merge this now.

  • Please work with upstream to get systemd-boot-native into the oe-core. I want to get it dropped from this layer before the end of the year. This might require discussions on the mailing list, not the send-and-forget approach.
  • Please follow the upstream developments on the UKI support.
  • I still have impression that ESP image should be moved into the distro layer. The whole set of EFI_* variables look like distro-level decisions. I have asked one of my colleagues for his opinion.

Thanks for the support. I'll continue working with oe-core to upstream systemd-boot-native.

lumag commented 8 months ago

@mikkorapeli-linaro thank you for your comments!