1 # Copyright 2022-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit mount-boot secureboot toolchain-funcs
10 DESCRIPTION="Memory tester based on PCMemTest"
11 HOMEPAGE="https://www.memtest.org/"
12 SRC_URI="https://github.com/memtest86plus/memtest86plus/archive/refs/tags/v${MY_PV}.tar.gz -> ${P}.tar.gz"
17 IUSE="bios32 bios64 +boot uefi32 uefi64 iso32 iso64"
29 S=${WORKDIR}/memtest86plus-${MY_PV}
32 if use uefi32 || use uefi64; then
39 -e 's#/sbin/mkdosfs#mkfs.vfat#' \
40 -e 's/^AS = as/AS +=/' \
42 -e 's/objcopy/$(OBJCOPY)/' \
43 -e 's/shell size/shell $(SIZE)/' \
44 build{32,64}/Makefile || die
50 export SIZE=$(tc-getPROG SIZE size)
52 use bios32 && emake memtest.bin
53 use uefi32 && emake memtest.efi
54 use iso32 && emake iso
58 use bios64 && emake memtest.bin
59 use uefi64 && emake memtest.efi
60 use iso64 && emake iso
64 install_memtest_images() {
65 use bios32 && newins build32/memtest.bin memtest32.bios
66 use bios64 && newins build64/memtest.bin memtest64.bios
67 use uefi32 && newins build32/memtest.efi memtest.efi32
68 use uefi64 && newins build64/memtest.efi memtest.efi64
75 newexe "${FILESDIR}"/39_memtest86+-r2 39_memtest86+
76 insinto /boot/memtest86plus
77 install_memtest_images
80 insinto /usr/share/${PN}
81 install_memtest_images
82 use iso32 && newins build32/memtest.iso memtest32.iso
83 use iso64 && newins build64/memtest.iso memtest64.iso
85 if use uefi32 || use uefi64; then
86 secureboot_auto_sign --in-place
91 use boot && mount-boot_pkg_pretend
95 use boot && mount-boot_pkg_preinst
99 use boot && mount-boot_pkg_prerm