FS#76390 - [memtest86+-efi] cannot boot EFI through systemd-boot
Attached to Project:
Arch Linux
Opened by mattia (nTia89) - Wednesday, 02 November 2022, 17:16 GMT
Last edited by Toolybird (Toolybird) - Friday, 10 February 2023, 20:46 GMT
Opened by mattia (nTia89) - Wednesday, 02 November 2022, 17:16 GMT
Last edited by Toolybird (Toolybird) - Friday, 10 February 2023, 20:46 GMT
|
Details
Description:
even if version 6 of memtest86+ sports an EFI compatibility, I cannot boot it via systemd-boot. Additional info: * memtest86+-efi-6.00-2 * systemd-251.7-1 Steps to reproduce: - install `memtest86+-efi` - create a .conf file under `/boot/loader/entries/` , containing these lines: "title Memory Tester (memtest86+) efi /memtest86+/memtest.efi" - boot this new entry - it results in a blank black screen |
This task depends upon
Closed by Toolybird (Toolybird)
Friday, 10 February 2023, 20:46 GMT
Reason for closing: Fixed
Additional comments about closing: memtest86+-efi 6.10-1
Friday, 10 February 2023, 20:46 GMT
Reason for closing: Fixed
Additional comments about closing: memtest86+-efi 6.10-1
Any ideas about why it does not work with systemd-boot?
Maybe file a github issue to check whether it's a configuration/systemd-boot or memtest issue.
Since I have done my self exactly what they did but with no results, it deserves a deeper analysis.
I'll be back here as soon as I have a good answer to my issue...
The most likely cause it that your firmware is tripping over the PE optional header being too small (sbverify doesn't like this binary because of this). grub might be employing its own PE loader instead of using the firmware LoadImage (that's my best guess).
You can also try creating a fixed binary with objcopy and boot that instead:
$ objcopy /boot/memtest86+/memtest.efi /boot/memtest86+/memtest-fixed.efi
with your command:
$ sudo objcopy memtest.efi memtest-fixed.efi
I can boot the "fixed" binary.
PS: I am not an expert in this field but this can be a proof...
$ file /boot/memtest86+/*
/boot/memtest86+/memtest.efi: Linux kernel x86 boot executable bzImage, version \353fHdrS\014\002, RW-rootFS,
/boot/memtest86+/memtest-fixed.efi: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows
The output of file explains why it works with grub. They use the same trick the kernel efi stub uses: the binary is both a regular bzImage and a efi binary (the necessary info doesn't overlap if done correctly). And grub uses the kernel x86 boot protocol to boot this image, while sd-boot is using the PE loader from the firmware, which trips up on this. (In theory you could load this by wrapping it in a sd-stub image, but the sd-stub bzImage loader expects a relocatable image and the memtest image is not marked as such.)
https://github.com/memtest86plus/memtest86plus/issues/202