Skip to content
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

Add support for ISO boot via systemd-boot #2390

Merged
merged 3 commits into from
Nov 8, 2023
Merged

Conversation

schaefi
Copy link
Collaborator

@schaefi schaefi commented Nov 7, 2023

Create proper EFI FAT image via bootctl to be used as alt loader in xorriso. This allows to boot the ISO via EFI e.g kvm -bios /usr/share/qemu/ovmf-x86_64.bin -cdrom file.iso Please note, hybrid boot is done via grub's hybrid MBR and as systemd-boot does not provide one, hybrid boot is out of scope yet. This Fixes #2281

@schaefi schaefi self-assigned this Nov 7, 2023
@schaefi
Copy link
Collaborator Author

schaefi commented Nov 7, 2023

To build a live ISO image that boots via systemd perform the following actions

git checkout systemd_iso_support
tox -e unit_py3_11
. .tox/unit_py3_11/bin/activate
sudo ./.tox/unit_py3_11/bin/kiwi-ng --profile SDBoot system build --description build-tests/x86/tumbleweed/test-image-live --set-repo http://download.opensuse.org/tumbleweed/repo/oss --target-dir /tmp/mytest --allow-existing-root

To boot the resulting image call

kvm -bios /usr/share/qemu/ovmf-x86_64.bin -cdrom /tmp/mytest/kiwi-test-image-live.x86_64-1.42.3.iso

@schaefi
Copy link
Collaborator Author

schaefi commented Nov 7, 2023

So far so good but this PR has a major issue, which is currently documented in the following NOTE:

# NOTE: limitation of El Torito boot,
# if the ESP size is greater than 20MB, the machine
# does no longer boot. I could not find a solution to
# this issue and bootctl install + kernel-install needs
# ~200MB for the ESP. I also noted that kernel-install
# does not fail with an exit code != if there is no
# space left anymore. Thus the image build completes but
# with incomplete data on the ESP

@schaefi
Copy link
Collaborator Author

schaefi commented Nov 7, 2023

due to this issue we cannot merge this pull request and further investigations are needed if it is at all possible to include an embedded EFI partition of this size as El Torito boot. I got the information that systemd-boot will not gain native support for reading from an ISO9660 filesystem like e.g grub can do. Thus I'm hitting a limitation for which I don't have a good solution at the moment.

@schaefi schaefi marked this pull request as draft November 7, 2023 16:09
@schaefi schaefi force-pushed the systemd_iso_support branch 2 times, most recently from d7382d1 to 9578e51 Compare November 7, 2023 16:34
Create proper EFI FAT image via bootctl to be used as
alt loader in xorriso. This allows to boot the ISO
via EFI e.g kvm -bios /usr/share/qemu/ovmf-x86_64.bin -cdrom file.iso
Please note, hybrid boot is done via grub's hybrid MBR and
as systemd-boot does not provide one, hybrid boot is out
of scope yet. This Fixes #2281
@schaefi schaefi force-pushed the systemd_iso_support branch from 9578e51 to d6d57ea Compare November 7, 2023 16:41
Add runtime check for to check that the efifatimagesize
does not exceed the max El Torito load size
kernel-install does a lot more then making the kernel available
to the ESP. It calls dracut, it creates loader entries and all
that is unexpected and also breaks the boot because the way
dracut is called in the image build case where host != target
leads to broken results. This commit refactors the systemd-boot
support in kiwi to prevent the use of kernel-install
@schaefi schaefi marked this pull request as ready for review November 8, 2023 11:50
@schaefi
Copy link
Collaborator Author

schaefi commented Nov 8, 2023

I opened the PR for review as I think it can be merged because it fixes the systemd-boot setup in kiwi and also allows building bootable ISOs with systemd. The limitation of the ESP size is set on El Torito boot-load-size and I added a runtime check to check this condition such that users don't run into issues.

This still leaves the problem that the systemd-boot ESP grows beyond the size limitation of El Torito loader entries but it should not hold us back from merging the changes proposed to kiwi here.

Thanks

@Conan-Kudo Conan-Kudo merged commit 9096672 into master Nov 8, 2023
10 checks passed
@Conan-Kudo Conan-Kudo deleted the systemd_iso_support branch November 8, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OEM ISO fails to build with systemd-boot
2 participants