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

Unified Kernel Images failed to boot. (aka EFI stubbed linux kernels) #217

Open
sharpenedblade opened this issue May 8, 2022 · 6 comments

Comments

@sharpenedblade
Copy link

sharpenedblade commented May 8, 2022

Unified kernel images by from following the manual section from https://wiki.archlinux.org/title/Unified_kernel_image do not boot. They get the error Image Failed To Load, but it should work. This occurs on archlinuxarm, and I used the aarch64 stub. I have not tried any other distros. I used systemd-boot as the bootloader, but it is the same if you load it directly or use grub2.

@jlinton
Copy link
Member

jlinton commented Jun 2, 2022

Hmm, what is the error? Can you attach the earlycon/etc output here? Because this should be working (and has in the past) if you just start it from the uefi shell.

@jlinton
Copy link
Member

jlinton commented Jun 3, 2022

Their instructions differ a bit from the way I have been doing it. With arm64 you should generally ignore the bits about appending the kernel image, and either compile with a default 'initrd=someimagefile' appended to the kernel command line, or start it via something that can pass parameters (which generally isn't uefi, but grub can). Then assure that the somefine initrd image is on the ESP along with the kernel. You also need to assure that your image is unzipped because uefi won't do that for you. AKA if file kernel.efi says its a gzip archive then unzip it and use the resulting image.

@jlinton jlinton changed the title Unified Kernel Images failed to boot. Unified Kernel Images failed to boot. (aka EFI stubbed linux kernel's) Jun 3, 2022
@jlinton jlinton changed the title Unified Kernel Images failed to boot. (aka EFI stubbed linux kernel's) Unified Kernel Images failed to boot. (aka EFI stubbed linux kernels) Jun 3, 2022
@sharpenedblade
Copy link
Author

EFI stubbed images do work, the default arch and fedora aarch64 kernel images boot and are EFI-stubbed, only booting with the initramfs and command line bundled fails. Maybe systemd-stub is broken with this build, it works with a x86 tianocore/edk2 uefi. I think it might have to do with the magic 0x30000 and similar numbers used in objcopy.

@jlinton
Copy link
Member

jlinton commented Jun 14, 2022

Ok, couple of comments, what does file combinedvminitrd.efi say?

Also, are you using the systemd-stub command to create the image or that ugly objcopy/etc sequence you linked? I would try systemd-stub, although I don't seem to have it on my fedora install. Instead I just tried using systemd-boot itself, and that all seems to be working fine. So, it does boot with something other than grub and kernel/efi stubbed images.

@sharpenedblade
Copy link
Author

The objcopy command is currently the only way to build the images, everything else uses the same command, it was originally found by a systemd dev I think. systemd-stub is part of an binary, you dont run it, it is included in a efi image to properly load the kernel. All bootloaders I have tried work, but nothing works with an efistubbed kernel image. Fedora does not use systemd-stub or efi images, they sign the kernel so it cannot be combined into a efi image, the signature would fail if it was.

@arenekosreal
Copy link

arenekosreal commented Apr 30, 2023

If you are using Image.gz instead Image to build UKI Image, this cannot be solved currently because systemd-stub cannot decompress Image.gz. The compressed Kernel Image can decompress itself on x86_64 while can't do the same on aarch64, the compressed aarch64 kernel plans to let boot loader to do the decompression job1. So maybe the solution is letting aarch64 version of systemd-stub decompress the compressed Image2.

Footnotes

  1. https://www.kernel.org/doc/html/latest/arm64/booting.html#decompress-the-kernel-image

  2. https://github.com/systemd/systemd/issues/23788

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

No branches or pull requests

3 participants