mkarchiso: copy Memtest86+ for uefi-x64.systemd-boot.* boot modes

If the Memtest86+ EFI binary exists, copy it to the EFI system partition
(`efiboot.img`) and also to ISO 9660.

Implements https://gitlab.archlinux.org/archlinux/archiso/-/issues/228
This commit is contained in:
nl6720 2024-04-01 19:23:12 +03:00
parent 7b1d6a7b14
commit 4136bfe085
No known key found for this signature in database
GPG key ID: 6B5387E670A955AD
2 changed files with 27 additions and 1 deletions

View file

@ -8,6 +8,8 @@ Changelog
Added
-----
- Copy Memtest86+ EFI binary to the EFI system partition and ISO 9660 for ``uefi-x86.systemd-boot`` boot modes.
Changed
-------

View file

@ -848,13 +848,16 @@ _make_common_bootmode_systemd-boot() {
# shellcheck disable=SC2076
if [[ " ${bootmodes[*]} " =~ ' uefi-x64.systemd-boot.esp ' || " ${bootmodes[*]} " =~ ' uefi-x64.systemd-boot.eltorito ' ]]; then
efiboot_files+=("${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi"
"${pacstrap_dir}/usr/share/edk2-shell/x64/Shell_Full.efi")
"${pacstrap_dir}/usr/share/edk2-shell/x64/Shell_Full.efi"
"${pacstrap_dir}/boot/memtest86+/memtest.efi"
"${pacstrap_dir}/usr/share/licenses/spdx/GPL-2.0-only.txt")
fi
# shellcheck disable=SC2076
if [[ " ${bootmodes[*]} " =~ ' uefi-ia32.systemd-boot.esp ' || " ${bootmodes[*]} " =~ ' uefi-ia32.systemd-boot.eltorito ' ]]; then
efiboot_files+=("${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootia32.efi"
"${pacstrap_dir}/usr/share/edk2-shell/ia32/Shell_Full.efi")
fi
efiboot_files+=("${work_dir}/loader/"
"${pacstrap_dir}/boot/vmlinuz-"*
"${pacstrap_dir}/boot/initramfs-"*".img"
@ -912,6 +915,15 @@ _make_bootmode_uefi-x64.systemd-boot.esp() {
"${pacstrap_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" ::/shellx64.efi
fi
# Copy Memtest86+
if [[ -e "${pacstrap_dir}/boot/memtest86+/memtest.efi" ]]; then
mmd -i "${efibootimg}" ::/boot ::/boot/memtest86+
mcopy -i "${efibootimg}" \
"${pacstrap_dir}/boot/memtest86+/memtest.efi" ::/boot/memtest86+/
mcopy -i "${efibootimg}" \
"${pacstrap_dir}/usr/share/licenses/spdx/GPL-2.0-only.txt" ::/boot/memtest86+/LICENSE
fi
# Copy kernel and initramfs to FAT image.
# systemd-boot can only access files from the EFI system partition it was launched from.
_run_once _make_boot_on_fat
@ -947,6 +959,13 @@ _make_bootmode_uefi-x64.systemd-boot.eltorito() {
install -m 0644 -- "${pacstrap_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" "${isofs_dir}/shellx64.efi"
fi
# Copy Memtest86+
if [[ -e "${pacstrap_dir}/boot/memtest86+/memtest.efi" ]]; then
install -d -m 0755 -- "${isofs_dir}/boot/memtest86+/"
install -m 0644 -- "${pacstrap_dir}/boot/memtest86+/memtest.efi" "${isofs_dir}/boot/memtest86+/memtest.efi"
install -m 0644 -- "${pacstrap_dir}/usr/share/licenses/spdx/GPL-2.0-only.txt" "${isofs_dir}/boot/memtest86+/LICENSE"
fi
_msg_info "Done!"
}
@ -1098,6 +1117,11 @@ _validate_requirements_bootmode_uefi-x64.systemd-boot.esp() {
_msg_error "Validating '${bootmode}': cannot be used with bootmode uefi-x64.grub.esp!" 0
fi
_validate_requirements_common_systemd-boot
# shellcheck disable=SC2076
if [[ ! " ${pkg_list[*]} " =~ ' memtest86+-efi ' ]]; then
_msg_info "Validating '${bootmode}': 'memtest86+-efi' is not in the package list. Memory testing will not be available from systemd-boot."
fi
}
_validate_requirements_bootmode_uefi-x64.systemd-boot.eltorito() {