1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit mount-boot eutils toolchain-funcs
8 DESCRIPTION="Memory tester based on memtest86"
9 HOMEPAGE="http://www.memtest.org/"
10 SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
14 KEYWORDS="-* amd64 x86"
15 IUSE="+boot floppy iso serial"
17 BOOTDIR="/boot/memtest86plus"
18 QA_PRESTRIPPED="${BOOTDIR}/memtest /usr/share/${PN}/memtest"
19 QA_FLAGS_IGNORED="${BOOTDIR}/memtest /usr/share/${PN}/memtest"
21 RDEPEND="floppy? ( sys-fs/mtools )"
22 DEPEND="iso? ( app-cdr/cdrtools )"
25 use boot && mount-boot_pkg_pretend
29 sed -i -e 's,0x10000,0x100000,' memtest.lds || die
30 epatch "${FILESDIR}/${P}-gcc-473.patch" \
31 "${FILESDIR}/${P}-hardcoded_cc.patch"
32 epatch "${FILESDIR}"/${P}-no-scp.patch
33 epatch "${FILESDIR}"/${P}-io-extern-inline.patch #548312
34 epatch "${FILESDIR}"/${P}-reboot-def.patch #548312
35 epatch "${FILESDIR}"/${P}-no-clean.patch #557890
36 epatch "${FILESDIR}"/${P}-no-C-headers.patch #592638
37 epatch "${FILESDIR}"/${P}-test-random-cflags.patch #590974
39 sed -i 's:genisoimage:mkisofs:' makeiso.sh || die
42 -e '/^#define SERIAL_CONSOLE_DEFAULT/s:0:1:' \
50 tc-ld-disable-gold #580212
66 doins memtest memtest.bin
69 insinto /usr/share/${PN}
70 use iso && newins mt*.iso memtest.iso
71 doins memtest memtest.bin
74 newexe "${FILESDIR}"/39_${PN}-r1 39_${PN}
76 dodoc README README.build-process FAQ changelog
79 dobin "${FILESDIR}"/make-memtest86+-boot-floppy
80 doman "${FILESDIR}"/make-memtest86+-boot-floppy.1
85 use boot && mount-boot_pkg_preinst
90 mount-boot_pkg_postinst
92 elog "memtest86+ has been installed in ${BOOTDIR}/"
93 elog "You may wish to update your bootloader configs by adding these lines:"
94 elog " - For grub2 just run grub-mkconfig, a configuration file is installed"
95 elog " as /etc/grub.d/39_${PN}"
96 elog " - For grub legacy: (replace '?' with correct numbers for your boot partition)"
98 elog " > root (hd?,?)"
99 elog " > kernel ${BOOTDIR}/memtest.bin"
101 elog " > image = ${BOOTDIR}/memtest.bin"
102 elog " > label = ${PN}"
104 elog "Note: For older configs, you might have to change from 'memtest' to 'memtest.bin'."
109 use boot && mount-boot_pkg_prerm
113 use boot && mount-boot_pkg_postrm