summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/memtest86+')
-rw-r--r--sys-apps/memtest86+/Manifest4
-rw-r--r--sys-apps/memtest86+/files/39_memtest86+33
-rw-r--r--sys-apps/memtest86+/files/make-memtest86+-boot-floppy111
-rw-r--r--sys-apps/memtest86+/files/make-memtest86+-boot-floppy.139
-rw-r--r--sys-apps/memtest86+/files/memtest86+-1.70-gnu_hash.patch11
-rw-r--r--sys-apps/memtest86+/files/memtest86+-2.01-hardcoded_cc.patch30
-rw-r--r--sys-apps/memtest86+/files/memtest86+-4.00-hardcoded_cc.patch30
-rw-r--r--sys-apps/memtest86+/files/memtest86+-4.20-hardcoded_cc.patch30
-rw-r--r--sys-apps/memtest86+/files/memtest86+-5.01-gcc-473.patch54
-rw-r--r--sys-apps/memtest86+/files/memtest86+-5.01-hardcoded_cc.patch16
-rw-r--r--sys-apps/memtest86+/memtest86+-2.01.ebuild56
-rw-r--r--sys-apps/memtest86+/memtest86+-4.00.ebuild75
-rw-r--r--sys-apps/memtest86+/memtest86+-4.20-r1.ebuild88
-rw-r--r--sys-apps/memtest86+/memtest86+-4.20-r2.ebuild74
-rw-r--r--sys-apps/memtest86+/memtest86+-5.01-r1.ebuild76
-rw-r--r--sys-apps/memtest86+/memtest86+-5.01.ebuild90
-rw-r--r--sys-apps/memtest86+/metadata.xml9
17 files changed, 826 insertions, 0 deletions
diff --git a/sys-apps/memtest86+/Manifest b/sys-apps/memtest86+/Manifest
new file mode 100644
index 000000000000..ec4eb2992499
--- /dev/null
+++ b/sys-apps/memtest86+/Manifest
@@ -0,0 +1,4 @@
+DIST memtest86+-2.01.tar.gz 165984 SHA256 35ad452f4fd12f07756abccccf1bce70d42596c2c5e9c29247ffc8e0b76bd1ae
+DIST memtest86+-4.00.tar.gz 270327 SHA256 6ec42f549da81b715bfc5c55b93b74774fb5c35f7578c7eecebab3ca37866ca4
+DIST memtest86+-4.20.tar.gz 206044 SHA256 5630ce978d0e6b671891df4253fc5c54659764d0cdfc7515ac0df3d8dd9e8737 SHA512 2213a64cd3036f840dd816dd49b62b0f082e1fbfe64e02f52370f04e39857f042dc8bc0044c1a88ba678e72c1eb8629aa706fabfd3c052e41c29c073f4e8c441 WHIRLPOOL 16b2f0a447516b24e4e29cf526ffc2ba03406105473c1d0cff44d737473b81db0482131385f2a39a5d202b3ccd52300f2c7109adf1b64b8bdb0a5244cb32d2cb
+DIST memtest86+-5.01.tar.gz 214877 SHA256 142127b7953fbd829b1057fb64a78d3340c2b771484230a7347e94530a0d9039 SHA512 d872db35ef733ec8f49094251f2bf6b98cc80eb06d04044be3aecf28d534f24ba293a08b9979b112dbd07cf27368148939a33a32c7010fc9581a3a5b150c94d7 WHIRLPOOL c8e240c8420990c93156fcd407a4b00d350392bbf8e974398b4d51fa219d33012b4e0d60f58cb2dff59c06e36e322467031bc0231d77d4e773d97e30939d3c8f
diff --git a/sys-apps/memtest86+/files/39_memtest86+ b/sys-apps/memtest86+/files/39_memtest86+
new file mode 100644
index 000000000000..14f27a276888
--- /dev/null
+++ b/sys-apps/memtest86+/files/39_memtest86+
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+. /usr/share/grub/grub-mkconfig_lib
+
+memtest=/boot/memtest86plus/memtest
+
+if [ -f "${memtest}" ]; then
+ device="$("${grub_probe}" --target=device "${memtest}")"
+ path="$(make_system_path_relative_to_its_root "${memtest}")"
+ cat <<EOF
+menuentry "Memtest86+" {
+EOF
+ prepare_grub_to_access_device "${device}" | grub_add_tab
+ cat <<EOF
+ linux16 "${path}"
+}
+EOF
+fi
+
+memtest=/boot/memtest86plus/memtest.netbsd
+
+if [ -f "${memtest}" ]; then
+ device="$("${grub_probe}" --target=device "${memtest}")"
+ path="$(make_system_path_relative_to_its_root "${memtest}")"
+ cat <<EOF
+menuentry "Memtest86+ (netbsd)" {
+EOF
+ prepare_grub_to_access_device "${device}" | grub_add_tab
+ cat <<EOF
+ knetbsd "${path}"
+}
+EOF
+fi
diff --git a/sys-apps/memtest86+/files/make-memtest86+-boot-floppy b/sys-apps/memtest86+/files/make-memtest86+-boot-floppy
new file mode 100644
index 000000000000..9c225c740bf4
--- /dev/null
+++ b/sys-apps/memtest86+/files/make-memtest86+-boot-floppy
@@ -0,0 +1,111 @@
+#!/bin/sh
+#
+# Script for making a memtest86 boot floppy using GRUB as bootloader
+#
+
+# (c) 2003 Peter Loje Hansen <pl@2m.dk>
+# - original version
+# (c) 2004 Yann Dirson <dirson@debian.org>
+# - added parameters
+# - ability to work on a floppy image instead of a real floppy
+# - adapted patches from Martin Koeppe <martin@koeppe-net.de>, to use
+# mtools and install full grub
+
+# TODO:
+# - add a flag to generate a default boot entry for (hd0)
+
+set -e
+
+MEMTEST=/boot/memtest86plus/memtest.bin
+FLOPPYIMAGE=/dev/fd0
+GRUBBIN=/sbin/grub
+GRUBLIB=/lib/grub
+MFORMAT=/usr/bin/mformat
+
+arch=$(uname -m)
+
+case "$arch" in
+ i386|i486|i686) GRUBARCH=i386-pc;;
+ x86_64) GRUBARCH=x86_64-pc;;
+ *) error "Unsupported architecture: $arch";;
+esac
+
+error()
+{
+ echo >&2 "$0: $*"
+ exit 1
+}
+
+needsarg()
+{
+ [ $1 -ge 2 ] || error "syntax error"
+}
+
+[ -d $GRUBLIB ] || error "Can't find $GRUBLIB - did you install a recent grub package (0.95+cvs20040624 or later) ?"
+[ -x $MFORMAT ] || error "Can't find mformat - did you install the mtools package ?"
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ --help) echo "$0 [--memtest $MEMTEST] [--floppyimage $FLOPPYIMAGE]"; exit 0 ;;
+ --memtest) needsarg $#; MEMTEST="$2"; shift ;;
+ --floppyimage) needsarg $#; FLOPPYIMAGE="$2"; shift ;;
+ *) error "syntax error" ;;
+ esac
+ shift
+done
+
+MOUNTPOINT=$(mktemp -d)
+
+if [ -b "$FLOPPYIMAGE" ]
+then
+ FINALDEV="$FLOPPYIMAGE"
+ FLOPPYIMAGE="$(mktemp)"
+else
+ FINALDEV=""
+fi
+
+echo "* Creating msdos file system"
+echo
+if [ ! -s "$FLOPPYIMAGE" ]; then
+ # unless a non-empty image exists, create a blank one first
+ dd bs=1024 count=1440 if=/dev/zero of="$FLOPPYIMAGE"
+fi
+# FIXME: "-f 1440" should probably be dropped
+mformat -i $FLOPPYIMAGE -f 1440 ::
+
+mmd -i $FLOPPYIMAGE ::/boot
+mmd -i $FLOPPYIMAGE ::/boot/grub
+
+echo
+echo "* Installing GRUB files"
+mcopy -v -i "$FLOPPYIMAGE" - ::/boot/grub/menu.lst <<EOF
+color green/black light-green/black
+default 0
+timeout 10
+title memtest
+kernel (fd0)/boot/memtest.bin
+EOF
+mcopy -v -i "$FLOPPYIMAGE" $GRUBLIB/$GRUBARCH/* ::/boot/grub
+
+echo
+echo "* Installing $MEMTEST"
+mcopy -v -i "$FLOPPYIMAGE" "$MEMTEST" ::/boot/memtest.bin
+
+echo
+echo -n "* Installing GRUB"
+$GRUBBIN --batch --device-map=/dev/null <<EOF
+device (fd0) $FLOPPYIMAGE
+root (fd0)
+setup (fd0)
+quit
+EOF
+
+if [ -n "$FINALDEV" ]; then
+ echo
+ echo "Insert a writable floppy for $FINALDEV and press enter"
+ read FOO
+
+ dd bs=1024 if="$FLOPPYIMAGE" of="$FINALDEV"
+ rm "$FLOPPYIMAGE"
+fi
diff --git a/sys-apps/memtest86+/files/make-memtest86+-boot-floppy.1 b/sys-apps/memtest86+/files/make-memtest86+-boot-floppy.1
new file mode 100644
index 000000000000..e1283e5efc8f
--- /dev/null
+++ b/sys-apps/memtest86+/files/make-memtest86+-boot-floppy.1
@@ -0,0 +1,39 @@
+.\" Man page for make-memtest86+-boot-floppy
+
+.TH make-memtest86+-boot-floppy 1
+
+.SH NAME
+make-memtest86+-boot-floppy \- create a memtest86+ boot-floppy using GRUB.
+
+.SH SYNOPSIS
+
+.B make-memtest86+-boot-floppy [ \-\-memtest
+.I <path to memtest86+-image>
+.B ] [ \-\-floppyimage
+.I <path to floppyimage/device>
+.B ]
+
+.SH DESCRIPTION
+.B make-memtest86+-boot-floppy
+can create a memtest86+ boot floppy using GRUB as the bootloader.
+
+.SH OPTIONS
+
+.IP "\-\-memtest <path to the memtest-image>"
+Path to the memtest86+-image, default is /boot/memtest86+.bin.
+
+.IP "\-\-floppyimage <path to the floppyimage or device>"
+File or device where the boot-image should be written to, default is /dev/fd0.
+
+.IP "\-\-help"
+Display a short message about the options of the tool.
+
+.SH AUTHOR
+This man-page has been written by Thomas Schmidt <thomas@thsnet.de>
+.PP
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU General Public License, Version 2 any
+later version published by the Free Software Foundation.
+.PP
+On Debian systems, the complete text of the GNU General Public
+License can be found in /usr/share/common\-licenses/GPL.
diff --git a/sys-apps/memtest86+/files/memtest86+-1.70-gnu_hash.patch b/sys-apps/memtest86+/files/memtest86+-1.70-gnu_hash.patch
new file mode 100644
index 000000000000..5a9e06dc06d7
--- /dev/null
+++ b/sys-apps/memtest86+/files/memtest86+-1.70-gnu_hash.patch
@@ -0,0 +1,11 @@
+diff -Naurp memtest86+-1.70-orig/memtest_shared.lds memtest86+-1.70/memtest_shared.lds
+--- memtest86+-1.70-orig/memtest_shared.lds 2007-01-27 13:34:16.000000000 +0100
++++ memtest86+-1.70/memtest_shared.lds 2007-01-27 13:41:30.000000000 +0100
+@@ -18,6 +18,7 @@ SECTIONS {
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .hash : { *(.hash) }
++ .gnu.hash : { *(.gnu.hash) }
+ .dynamic : { *(.dynamic) }
+
+ .rel.text : { *(.rel.text .rel.text.*) }
diff --git a/sys-apps/memtest86+/files/memtest86+-2.01-hardcoded_cc.patch b/sys-apps/memtest86+/files/memtest86+-2.01-hardcoded_cc.patch
new file mode 100644
index 000000000000..3b07731daadd
--- /dev/null
+++ b/sys-apps/memtest86+/files/memtest86+-2.01-hardcoded_cc.patch
@@ -0,0 +1,30 @@
+diff -Naurp memtest86+-2.01-orig/Makefile memtest86+-2.01/Makefile
+--- memtest86+-2.01-orig/Makefile 2008-03-11 21:04:28.000000000 +0100
++++ memtest86+-2.01/Makefile 2008-03-11 21:05:25.000000000 +0100
+@@ -8,10 +8,9 @@
+ #
+ FDISK=/dev/fd0
+
+-AS=as -32
+-CC=gcc
+-
+-CFLAGS=-Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC
++CPPFLAGS=-m32
++CFLAGS=-Wall -m32 -march=i486 -O1 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC -fno-stack-protector
++ASFLAGS=-32
+
+ OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
+ config.o linuxbios.o memsize.o pci.o controller.o random.o extra.o \
+@@ -47,10 +46,10 @@ memtest.bin: memtest_shared.bin bootsect
+ memtest_shared.bin -o memtest.bin
+
+ reloc.o: reloc.c
+- $(CC) -c $(CFLAGS) -fno-strict-aliasing reloc.c
++ $(CC) -c $(CFLAGS) -fno-strict-aliasing -fno-stack-protector reloc.c
+
+ test.o: test.c
+- $(CC) -c -Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding test.c
++ $(CC) -c -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin -ffreestanding -fno-stack-protector -fno-pie -nopie test.c
+
+ clean:
+ rm -f *.o *.s *.iso memtest.bin memtest memtest_shared memtest_shared.bin
diff --git a/sys-apps/memtest86+/files/memtest86+-4.00-hardcoded_cc.patch b/sys-apps/memtest86+/files/memtest86+-4.00-hardcoded_cc.patch
new file mode 100644
index 000000000000..f2950b64e807
--- /dev/null
+++ b/sys-apps/memtest86+/files/memtest86+-4.00-hardcoded_cc.patch
@@ -0,0 +1,30 @@
+diff -Nuar --exclude '*.orig' --exclude '*rej' --exclude '*~' memtest86+-4.00.orig/Makefile memtest86+-4.00/Makefile
+--- memtest86+-4.00.orig/Makefile 2009-09-21 17:35:46.000000000 -0700
++++ memtest86+-4.00/Makefile 2009-09-25 09:04:23.000000000 -0700
+@@ -8,10 +8,9 @@
+ #
+ FDISK=/dev/fd0
+
+-AS=as -32
+-CC=gcc
+-
+-CFLAGS= -Wall -march=i486 -m32 -O2 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC
++CPPFLAGS=-m32
++CFLAGS=-Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC -fno-stack-protector
++ASFLAGS=-32
+
+ OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
+ config.o linuxbios.o memsize.o pci.o controller.o random.o spd.o \
+@@ -47,10 +46,10 @@
+ memtest_shared.bin -o memtest.bin
+
+ reloc.o: reloc.c
+- $(CC) -c $(CFLAGS) -fno-strict-aliasing reloc.c
++ $(CC) -c $(CFLAGS) -fno-strict-aliasing -fno-stack-protector reloc.c
+
+ test.o: test.c
+- $(CC) -c -Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding test.c
++ $(CC) -c -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin -ffreestanding -fno-stack-protector -fno-pie -nopie test.c
+
+ clean:
+ rm -f *.o *.s *.iso memtest.bin memtest memtest_shared memtest_shared.bin
diff --git a/sys-apps/memtest86+/files/memtest86+-4.20-hardcoded_cc.patch b/sys-apps/memtest86+/files/memtest86+-4.20-hardcoded_cc.patch
new file mode 100644
index 000000000000..2eb750c8dd93
--- /dev/null
+++ b/sys-apps/memtest86+/files/memtest86+-4.20-hardcoded_cc.patch
@@ -0,0 +1,30 @@
+diff -Naurp memtest86+-4.10-orig/Makefile memtest86+-4.10/Makefile
+--- memtest86+-4.10-orig/Makefile 2010-06-24 00:27:22.864634431 +0200
++++ memtest86+-4.10/Makefile 2010-06-24 00:28:42.402478590 +0200
+@@ -8,10 +8,9 @@
+ #
+ FDISK=/dev/fd0
+
+-AS=as -32
+-CC=gcc
+-
+-CFLAGS= -Wall -march=i486 -m32 -O2 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC -fno-stack-protector
++CFLAGS=-Wall -march=i486 -m32 -O2 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC -fno-stack-protector
++CPPFLAGS=-m32
++ASFLAGS=-32
+
+ OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
+ config.o linuxbios.o memsize.o pci.o controller.o random.o spd.o \
+@@ -47,10 +46,10 @@ memtest.bin: memtest_shared.bin bootsect
+ memtest_shared.bin -o memtest.bin
+
+ reloc.o: reloc.c
+- $(CC) -c $(CFLAGS) -fno-strict-aliasing reloc.c
++ $(CC) -c $(CFLAGS) -fno-strict-aliasing -fno-stack-protector reloc.c
+
+ test.o: test.c
+- $(CC) -c -Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding test.c
++ $(CC) -c -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin -ffreestanding -fno-stack-protector -fno-pie test.c
+
+ clean:
+ rm -f *.o *.s *.iso memtest.bin memtest memtest_shared memtest_shared.bin
diff --git a/sys-apps/memtest86+/files/memtest86+-5.01-gcc-473.patch b/sys-apps/memtest86+/files/memtest86+-5.01-gcc-473.patch
new file mode 100644
index 000000000000..ff9b15a9e4e1
--- /dev/null
+++ b/sys-apps/memtest86+/files/memtest86+-5.01-gcc-473.patch
@@ -0,0 +1,54 @@
+diff -Narup memtest86+-5.01-orig/controller.c memtest86+-5.01/controller.c
+--- memtest86+-5.01-orig/controller.c 2013-08-09 22:01:58.000000000 -0400
++++ memtest86+-5.01/controller.c 2014-06-22 11:01:17.347923472 -0400
+@@ -292,7 +292,7 @@ static void setup_nhm(void)
+
+ /* First, locate the PCI bus where the MCH is located */
+
+- for(i = 0; i < sizeof(possible_nhm_bus); i++) {
++ for(i = 0; i < sizeof(possible_nhm_bus) / sizeof(possible_nhm_bus[0]); i++) {
+ pci_conf_read( possible_nhm_bus[i], 3, 4, 0x00, 2, &vid);
+ pci_conf_read( possible_nhm_bus[i], 3, 4, 0x02, 2, &did);
+ vid &= 0xFFFF;
+@@ -327,7 +327,7 @@ static void setup_nhm32(void)
+ ctrl.mode = ECC_NONE;
+
+ /* First, locate the PCI bus where the MCH is located */
+- for(i = 0; i < sizeof(possible_nhm_bus); i++) {
++ for(i = 0; i < sizeof(possible_nhm_bus) / sizeof(possible_nhm_bus[0]); i++) {
+ pci_conf_read( possible_nhm_bus[i], 3, 4, 0x00, 2, &vid);
+ pci_conf_read( possible_nhm_bus[i], 3, 4, 0x02, 2, &did);
+ vid &= 0xFFFF;
+diff -Narup memtest86+-5.01-orig/io.h memtest86+-5.01/io.h
+--- memtest86+-5.01-orig/io.h 2013-08-09 22:01:58.000000000 -0400
++++ memtest86+-5.01/io.h 2014-06-22 11:00:19.279251873 -0400
+@@ -31,7 +31,7 @@
+ */
+
+ #define __OUT1(s,x) \
+-extern inline void __out##s(unsigned x value, unsigned short port) {
++static inline void __out##s(unsigned x value, unsigned short port) {
+
+ #define __OUT2(s,s1,s2) \
+ __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
+@@ -43,7 +43,7 @@ __OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a"
+ __OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; }
+
+ #define __IN1(s) \
+-extern inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v;
++static inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v;
+
+ #define __IN2(s,s1,s2) \
+ __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
+diff -Narup memtest86+-5.01-orig/Makefile memtest86+-5.01/Makefile
+--- memtest86+-5.01-orig/Makefile 2013-08-09 22:01:58.000000000 -0400
++++ memtest86+-5.01/Makefile 2014-06-22 10:59:27.463573842 -0400
+@@ -12,7 +12,7 @@ FDISK=/dev/fd0
+ AS=as -32
+ CC=gcc
+
+-CFLAGS= -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin \
++CFLAGS= -Wall -march=i486 -m32 -O0 -fomit-frame-pointer -fno-builtin \
+ -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector
+
+ OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
diff --git a/sys-apps/memtest86+/files/memtest86+-5.01-hardcoded_cc.patch b/sys-apps/memtest86+/files/memtest86+-5.01-hardcoded_cc.patch
new file mode 100644
index 000000000000..f140a7fc6605
--- /dev/null
+++ b/sys-apps/memtest86+/files/memtest86+-5.01-hardcoded_cc.patch
@@ -0,0 +1,16 @@
+--- Makefile.orig 2015-02-01 01:08:33.000000000 +0300
++++ Makefile 2015-02-01 01:10:17.624757244 +0300
+@@ -9,11 +9,10 @@
+ #
+ FDISK=/dev/fd0
+
+-AS=as -32
+-CC=gcc
+-
+ CFLAGS= -Wall -march=i486 -m32 -O0 -fomit-frame-pointer -fno-builtin \
+ -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector
++CPPFLAGS= -m32
++ASFLAGS= -32
+
+ OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
+ config.o cpuid.o linuxbios.o pci.o memsize.o spd.o error.o dmi.o controller.o \
diff --git a/sys-apps/memtest86+/memtest86+-2.01.ebuild b/sys-apps/memtest86+/memtest86+-2.01.ebuild
new file mode 100644
index 000000000000..747415f50430
--- /dev/null
+++ b/sys-apps/memtest86+/memtest86+-2.01.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit mount-boot eutils
+
+DESCRIPTION="Memory tester based on memtest86"
+HOMEPAGE="http://www.memtest.org/"
+SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* amd64 x86"
+IUSE="serial"
+RESTRICT="test"
+
+DEPEND=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${PN}-2.01-hardcoded_cc.patch
+ epatch "${FILESDIR}"/${PN}-1.70-gnu_hash.patch
+
+ if use serial ; then
+ sed -e 's/#define SERIAL_CONSOLE_DEFAULT 0/#define SERIAL_CONSOLE_DEFAULT 1/' -i config.h
+ fi
+}
+
+src_compile() {
+ emake || die
+}
+
+src_install() {
+ insinto /boot/memtest86plus
+ doins memtest.bin || die
+ dodoc README README.build-process
+}
+
+pkg_postinst() {
+ einfo
+ einfo "memtest.bin has been installed in /boot/memtest86plus/"
+ einfo "You may wish to update your bootloader configs"
+ einfo "by adding these lines:"
+
+ einfo " - For grub: (replace '?' with correct numbers for your boot partition)"
+ einfo " > title=Memtest86Plus"
+ einfo " > root (hd?,?)"
+ einfo " > kernel /boot/memtest86plus/memtest.bin"
+
+ einfo " - For lilo:"
+ einfo " > image = /boot/memtest86plus/memtest.bin"
+ einfo " > label = Memtest86Plus"
+ einfo
+}
diff --git a/sys-apps/memtest86+/memtest86+-4.00.ebuild b/sys-apps/memtest86+/memtest86+-4.00.ebuild
new file mode 100644
index 000000000000..17412a02cbab
--- /dev/null
+++ b/sys-apps/memtest86+/memtest86+-4.00.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+QA_PRESTRIPPED=/boot/memtest86plus/memtest
+
+inherit mount-boot eutils
+
+DESCRIPTION="Memory tester based on memtest86"
+HOMEPAGE="http://www.memtest.org/"
+SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* amd64 x86"
+IUSE="floppy serial"
+RESTRICT="test"
+
+RDEPEND="floppy? ( >=sys-boot/grub-0.95 sys-fs/mtools )"
+DEPEND="${RDEPEND}"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${PN}-4.00-hardcoded_cc.patch
+
+ # Merged upstream
+ #epatch "${FILESDIR}"/${PN}-1.70-gnu_hash.patch
+
+ sed -i -e's/$(LD) -s /$(LD) /' Makefile
+ sed -i -e's,0x10000,0x100000,' memtest.lds
+
+ if use serial ; then
+ sed -i -e 's/#define SERIAL_CONSOLE_DEFAULT 0/#define SERIAL_CONSOLE_DEFAULT 1/' config.h
+ fi
+}
+
+src_compile() {
+ emake || die
+}
+
+src_install() {
+ insinto /boot/memtest86plus
+ newins memtest.bin memtest || die
+ newins memtest memtest.netbsd || die
+ dosym memtest /boot/memtest86plus/memtest.bin
+ dodoc README README.build-process
+
+ if use floppy ; then
+ dobin "${FILESDIR}"/make-memtest86+-boot-floppy
+ doman "${FILESDIR}"/make-memtest86+-boot-floppy.1
+ fi
+}
+
+pkg_postinst() {
+ mount-boot_pkg_postinst
+ einfo
+ einfo "memtest has been installed in /boot/memtest86plus/"
+ einfo "You may wish to update your bootloader configs"
+ einfo "by adding these lines:"
+ einfo " - For grub: (replace '?' with correct numbers for your boot partition)"
+ einfo " > title=Memtest86Plus"
+ einfo " > root (hd?,?)"
+ einfo " > kernel /boot/memtest86plus/memtest"
+ einfo " or try this if you get grub error 28:"
+ einfo " > title=Memtest86Plus"
+ einfo " > root (hd?,?)"
+ einfo " > kernel --type=netbsd /boot/memtest86plus/memtest.netbsd"
+ einfo
+ einfo " - For lilo:"
+ einfo " > image = /boot/memtest86plus/memtest"
+ einfo " > label = Memtest86Plus"
+ einfo
+}
diff --git a/sys-apps/memtest86+/memtest86+-4.20-r1.ebuild b/sys-apps/memtest86+/memtest86+-4.20-r1.ebuild
new file mode 100644
index 000000000000..bda1e1aae492
--- /dev/null
+++ b/sys-apps/memtest86+/memtest86+-4.20-r1.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit mount-boot eutils toolchain-funcs
+
+DESCRIPTION="Memory tester based on memtest86"
+HOMEPAGE="http://www.memtest.org/"
+SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* amd64 x86"
+IUSE="floppy serial"
+
+BOOTDIR=/boot/memtest86plus
+QA_PRESTRIPPED="${BOOTDIR}/memtest.netbsd"
+
+RDEPEND="floppy? ( >=sys-boot/grub-0.95:0 sys-fs/mtools )"
+DEPEND=""
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-4.20-hardcoded_cc.patch
+
+ sed -i -e 's,0x10000,0x100000,' memtest.lds || die
+
+ if use serial ; then
+ sed -i \
+ -e '/^#define SERIAL_CONSOLE_DEFAULT/s:0:1:' \
+ config.h \
+ || die "sed failed"
+ fi
+
+ cat - > "${T}"/39_${PN} <<EOF
+#!/bin/sh
+exec tail -n +3 \$0
+
+menuentry "${PN} ${PV}" {
+ linux16 ${BOOTDIR}/memtest
+}
+
+menuentry "${PN} ${PV} (netbsd)" {
+ insmod bsd
+ knetbsd ${BOOTDIR}/memtest.netbsd
+}
+EOF
+
+ tc-export AS CC LD
+}
+
+src_test() { :; }
+
+src_install() {
+ insinto ${BOOTDIR}
+ newins memtest.bin memtest
+ newins memtest memtest.netbsd
+ dosym memtest ${BOOTDIR}/memtest.bin
+
+ exeinto /etc/grub.d
+ doexe "${T}"/39_${PN}
+
+ dodoc README README.build-process FAQ changelog
+
+ if use floppy ; then
+ dobin "${FILESDIR}"/make-memtest86+-boot-floppy
+ doman "${FILESDIR}"/make-memtest86+-boot-floppy.1
+ fi
+}
+
+pkg_postinst() {
+ mount-boot_pkg_postinst
+ elog
+ elog "memtest has been installed in ${BOOTDIR}/"
+ elog "You may wish to update your bootloader configs"
+ elog "by adding these lines:"
+ elog " - For grub2 just run grub-mkconfig, a configuration file is installed"
+ elog " as /etc/grub.d/39_${PN}"
+ elog " - For grub legacy: (replace '?' with correct numbers for your boot partition)"
+ elog " > title=${PN}"
+ elog " > root (hd?,?)"
+ elog " > kernel ${BOOTDIR}/memtest"
+ elog " - For lilo:"
+ elog " > image = ${BOOTDIR}/memtest"
+ elog " > label = ${PN}"
+ elog
+}
diff --git a/sys-apps/memtest86+/memtest86+-4.20-r2.ebuild b/sys-apps/memtest86+/memtest86+-4.20-r2.ebuild
new file mode 100644
index 000000000000..06dac9cca1e0
--- /dev/null
+++ b/sys-apps/memtest86+/memtest86+-4.20-r2.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit mount-boot eutils toolchain-funcs
+
+DESCRIPTION="Memory tester based on memtest86"
+HOMEPAGE="http://www.memtest.org/"
+SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="floppy serial"
+
+BOOTDIR=/boot/memtest86plus
+QA_PRESTRIPPED="${BOOTDIR}/memtest.netbsd"
+
+RDEPEND="floppy? ( >=sys-boot/grub-0.95:0 sys-fs/mtools )"
+DEPEND=""
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-4.20-hardcoded_cc.patch
+
+ sed -i -e 's,0x10000,0x100000,' memtest.lds || die
+
+ if use serial ; then
+ sed -i \
+ -e '/^#define SERIAL_CONSOLE_DEFAULT/s:0:1:' \
+ config.h \
+ || die "sed failed"
+ fi
+
+ tc-export AS CC LD
+}
+
+src_test() { :; }
+
+src_install() {
+ insinto ${BOOTDIR}
+ newins memtest.bin memtest
+ newins memtest memtest.netbsd
+ dosym memtest ${BOOTDIR}/memtest.bin
+
+ exeinto /etc/grub.d
+ doexe "${FILESDIR}"/39_memtest86+
+
+ dodoc README README.build-process FAQ changelog
+
+ if use floppy ; then
+ dobin "${FILESDIR}"/make-memtest86+-boot-floppy
+ doman "${FILESDIR}"/make-memtest86+-boot-floppy.1
+ fi
+}
+
+pkg_postinst() {
+ mount-boot_pkg_postinst
+ elog
+ elog "memtest has been installed in ${BOOTDIR}/"
+ elog "You may wish to update your bootloader configs"
+ elog "by adding these lines:"
+ elog " - For grub2 just run grub-mkconfig, a configuration file is installed"
+ elog " as /etc/grub.d/39_${PN}"
+ elog " - For grub legacy: (replace '?' with correct numbers for your boot partition)"
+ elog " > title=${PN}"
+ elog " > root (hd?,?)"
+ elog " > kernel ${BOOTDIR}/memtest"
+ elog " - For lilo:"
+ elog " > image = ${BOOTDIR}/memtest"
+ elog " > label = ${PN}"
+ elog
+}
diff --git a/sys-apps/memtest86+/memtest86+-5.01-r1.ebuild b/sys-apps/memtest86+/memtest86+-5.01-r1.ebuild
new file mode 100644
index 000000000000..1232c12688c4
--- /dev/null
+++ b/sys-apps/memtest86+/memtest86+-5.01-r1.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit mount-boot eutils toolchain-funcs
+
+DESCRIPTION="Memory tester based on memtest86"
+HOMEPAGE="http://www.memtest.org/"
+SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="floppy serial"
+
+BOOTDIR=/boot/memtest86plus
+QA_PRESTRIPPED="${BOOTDIR}/memtest.netbsd"
+QA_FLAGS_IGNORED="${BOOTDIR}/memtest.netbsd"
+
+RDEPEND="floppy? ( >=sys-boot/grub-0.95:0 sys-fs/mtools )"
+DEPEND=""
+
+src_prepare() {
+ sed -i -e 's,0x10000,0x100000,' memtest.lds || die
+ sed -e "s/scp memtest.bin root@192.168.0.12:\/srv\/tftp\/mt86plus//g" -i Makefile
+ epatch "${FILESDIR}/${P}-gcc-473.patch" \
+ "${FILESDIR}/${P}-hardcoded_cc.patch"
+
+ if use serial ; then
+ sed -i \
+ -e '/^#define SERIAL_CONSOLE_DEFAULT/s:0:1:' \
+ config.h \
+ || die "sed failed"
+ fi
+
+ tc-export AS CC LD
+}
+
+src_test() { :; }
+
+src_install() {
+ insinto ${BOOTDIR}
+ newins memtest.bin memtest
+ newins memtest memtest.netbsd
+ dosym memtest ${BOOTDIR}/memtest.bin
+
+ exeinto /etc/grub.d
+ doexe "${FILESDIR}"/39_memtest86+
+
+ dodoc README README.build-process FAQ changelog
+
+ if use floppy ; then
+ dobin "${FILESDIR}"/make-memtest86+-boot-floppy
+ doman "${FILESDIR}"/make-memtest86+-boot-floppy.1
+ fi
+}
+
+pkg_postinst() {
+ mount-boot_pkg_postinst
+ elog
+ elog "memtest has been installed in ${BOOTDIR}/"
+ elog "You may wish to update your bootloader configs"
+ elog "by adding these lines:"
+ elog " - For grub2 just run grub-mkconfig, a configuration file is installed"
+ elog " as /etc/grub.d/39_${PN}"
+ elog " - For grub legacy: (replace '?' with correct numbers for your boot partition)"
+ elog " > title=${PN}"
+ elog " > root (hd?,?)"
+ elog " > kernel ${BOOTDIR}/memtest"
+ elog " - For lilo:"
+ elog " > image = ${BOOTDIR}/memtest"
+ elog " > label = ${PN}"
+ elog
+}
diff --git a/sys-apps/memtest86+/memtest86+-5.01.ebuild b/sys-apps/memtest86+/memtest86+-5.01.ebuild
new file mode 100644
index 000000000000..88def26d997e
--- /dev/null
+++ b/sys-apps/memtest86+/memtest86+-5.01.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit mount-boot eutils toolchain-funcs
+
+DESCRIPTION="Memory tester based on memtest86"
+HOMEPAGE="http://www.memtest.org/"
+SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="floppy serial"
+
+BOOTDIR=/boot/memtest86plus
+QA_PRESTRIPPED="${BOOTDIR}/memtest.netbsd"
+QA_FLAGS_IGNORED="${BOOTDIR}/memtest.netbsd"
+
+RDEPEND="floppy? ( >=sys-boot/grub-0.95:0 sys-fs/mtools )"
+DEPEND=""
+
+src_prepare() {
+ sed -i -e 's,0x10000,0x100000,' memtest.lds || die
+ sed -e "s/scp memtest.bin root@192.168.0.12:\/srv\/tftp\/mt86plus//g" -i Makefile
+ epatch "${FILESDIR}/${P}-gcc-473.patch" \
+ "${FILESDIR}/${P}-hardcoded_cc.patch"
+
+ if use serial ; then
+ sed -i \
+ -e '/^#define SERIAL_CONSOLE_DEFAULT/s:0:1:' \
+ config.h \
+ || die "sed failed"
+ fi
+
+ cat - > "${T}"/39_${PN} <<EOF
+#!/bin/sh
+exec tail -n +3 \$0
+
+menuentry "${PN} ${PV}" {
+ linux16 ${BOOTDIR}/memtest
+}
+
+menuentry "${PN} ${PV} (netbsd)" {
+ insmod bsd
+ knetbsd ${BOOTDIR}/memtest.netbsd
+}
+EOF
+
+ tc-export AS CC LD
+}
+
+src_test() { :; }
+
+src_install() {
+ insinto ${BOOTDIR}
+ newins memtest.bin memtest
+ newins memtest memtest.netbsd
+ dosym memtest ${BOOTDIR}/memtest.bin
+
+ exeinto /etc/grub.d
+ doexe "${T}"/39_${PN}
+
+ dodoc README README.build-process FAQ changelog
+
+ if use floppy ; then
+ dobin "${FILESDIR}"/make-memtest86+-boot-floppy
+ doman "${FILESDIR}"/make-memtest86+-boot-floppy.1
+ fi
+}
+
+pkg_postinst() {
+ mount-boot_pkg_postinst
+ elog
+ elog "memtest has been installed in ${BOOTDIR}/"
+ elog "You may wish to update your bootloader configs"
+ elog "by adding these lines:"
+ elog " - For grub2 just run grub-mkconfig, a configuration file is installed"
+ elog " as /etc/grub.d/39_${PN}"
+ elog " - For grub legacy: (replace '?' with correct numbers for your boot partition)"
+ elog " > title=${PN}"
+ elog " > root (hd?,?)"
+ elog " > kernel ${BOOTDIR}/memtest"
+ elog " - For lilo:"
+ elog " > image = ${BOOTDIR}/memtest"
+ elog " > label = ${PN}"
+ elog
+}
diff --git a/sys-apps/memtest86+/metadata.xml b/sys-apps/memtest86+/metadata.xml
new file mode 100644
index 000000000000..d7975494757f
--- /dev/null
+++ b/sys-apps/memtest86+/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+<use>
+ <flag name='serial'>Compile with serial console support</flag>
+ <flag name='floppy'>Install a script to create floppy disks containing memtest86+ binaries.</flag>
+</use>
+</pkgmetadata>