blob: c6f1d39b07ac9b14ef02c3f6731904e14f77d25e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# Copyright 2022-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit mount-boot secureboot toolchain-funcs
MY_PV=${PV/_/-}
DESCRIPTION="Memory tester based on PCMemTest"
HOMEPAGE="https://www.memtest.org/"
SRC_URI="https://github.com/memtest86plus/memtest86plus/archive/refs/tags/v${MY_PV}.tar.gz -> ${P}.tar.gz"
S=${WORKDIR}/memtest86plus-${MY_PV}
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~loong ~x86"
IUSE="bios32 bios64 +boot uefi32 uefi64 iso32 iso64"
ISODEPS="
dev-libs/libisoburn
sys-fs/dosfstools
sys-fs/mtools
"
BDEPEND="
iso32? ( ${ISODEPS} )
iso64? ( ${ISODEPS} )
sys-devel/gcc:*
"
pkg_setup() {
if use uefi32 || use uefi64; then
secureboot_pkg_setup
fi
}
src_prepare() {
sed -i \
-e 's#/sbin/mkdosfs#mkfs.vfat#' \
-e 's/shell size/shell $(SIZE)/' \
build/{i586,x86_64,loongarch64}/Makefile || die
if ! tc-is-gcc; then
ewarn "clang doesn't support indirect goto in function with no address-of-label expressions"
ewarn "Ignoring CC=$(tc-getCC) and forcing ${CHOST}-gcc"
export CC=${CHOST}-gcc AR=${CHOST}-gcc-ar
tc-is-gcc || die "tc-is-gcc failed in spite of CC=${CC}"
fi
default
}
src_compile() {
tc-export OBJCOPY
export SIZE=$(tc-getPROG SIZE size)
if use loong; then
# a different build directory has to be selected for loong, and
# there's no "BIOS" support.
pushd build/loongarch64
if use uefi64; then
emake mt86plus
secureboot_sign_efi_file mt86plus
fi
use iso64 && emake iso
popd
return
fi
pushd build/i586
if use bios32 || use uefi32; then
emake mt86plus
fi
use iso32 && emake iso
popd
pushd build/x86_64
if use bios64 || use uefi64; then
emake mt86plus
fi
use iso64 && emake iso
popd
}
install_memtest_images() {
if use loong; then
use uefi64 && newins build/loongarch64/mt86plus memtest.loongarch64
return
fi
if use bios32 || use uefi32; then
secureboot_sign_efi_file build/i586/mt86plus
newins build/i586/mt86plus memtest.i586
fi
if use bios64 || use uefi64; then
secureboot_sign_efi_file build/x86_64/mt86plus
newins build/x86_64/mt86plus memtest.x86_64
fi
}
src_install() {
default
if use boot; then
exeinto /etc/grub.d/
newexe "${FILESDIR}"/39_memtest86+-r3 39_memtest86+
insinto /boot/memtest86plus
install_memtest_images
fi
insinto /usr/share/${PN}
install_memtest_images
if use loong; then
use iso64 && newins build/loongarch64/memtest.iso memtest64.iso
else
use iso32 && newins build/i586/memtest.iso memtest.i586.iso
use iso64 && newins build/x86_64/memtest.iso memtest.x86_64.iso
fi
}
pkg_pretend() {
use boot && mount-boot_pkg_pretend
}
pkg_preinst() {
use boot && mount-boot_pkg_preinst
}
pkg_prerm() {
use boot && mount-boot_pkg_prerm
}
|