aboutsummaryrefslogtreecommitdiff
path: root/sysutils/memtest86+
diff options
context:
space:
mode:
authorAlexey Dokuchaev <danfe@FreeBSD.org>2009-03-31 22:23:19 +0000
committerAlexey Dokuchaev <danfe@FreeBSD.org>2009-03-31 22:23:19 +0000
commit9d712428f5eea02595aa62eae9921e6363e21a6f (patch)
tree22fb0efd672ac61c6d0598ceca2bb8371936bee9 /sysutils/memtest86+
parent92531c1b9e19748331bd9a0cbc116e2e6cdbadd6 (diff)
downloadports-9d712428f5eea02595aa62eae9921e6363e21a6f.tar.gz
ports-9d712428f5eea02595aa62eae9921e6363e21a6f.zip
Add memtest86+ 2.11, stand-alone memory test for x86 architecture
computers. PR: ports/132700 (based on) Submitted by: Andriy Gapon
Notes
Notes: svn path=/head/; revision=231417
Diffstat (limited to 'sysutils/memtest86+')
-rw-r--r--sysutils/memtest86+/Makefile91
-rw-r--r--sysutils/memtest86+/distinfo3
-rw-r--r--sysutils/memtest86+/files/patch-Makefile29
-rw-r--r--sysutils/memtest86+/files/patch-error.c10
-rw-r--r--sysutils/memtest86+/files/patch-memtest.lds11
-rw-r--r--sysutils/memtest86+/files/patch-setup.S11
-rw-r--r--sysutils/memtest86+/files/patch-test.c60
-rw-r--r--sysutils/memtest86+/files/pkg-message.in19
-rw-r--r--sysutils/memtest86+/pkg-descr4
9 files changed, 238 insertions, 0 deletions
diff --git a/sysutils/memtest86+/Makefile b/sysutils/memtest86+/Makefile
new file mode 100644
index 000000000000..16813ed1ff3e
--- /dev/null
+++ b/sysutils/memtest86+/Makefile
@@ -0,0 +1,91 @@
+# New ports collection makefile for: memtest86+
+# Date created: 2009-03-10
+# Whom: Andriy Gapon <avg@icyb.net.ua>
+#
+# $FreeBSD$
+#
+
+PORTNAME= memtest86+
+PORTVERSION= 2.11
+CATEGORIES= sysutils
+MASTER_SITES= http://www.memtest.org/download/${PORTVERSION}/
+
+MAINTAINER= avg@icyb.net.ua
+COMMENT= Stand-alone memory test for x86 architecture computers
+
+ONLY_FOR_ARCHS= i386 amd64
+
+USE_DOS2UNIX= README memtest.lds setup.S
+USE_GMAKE= yes
+ALL_TARGET= all
+PORTDOCS= *
+
+# Please provide absolute path below (cannot be root)
+BOOT_DIR?= /boot/opt
+
+OPTIONS= ISO "Build bootable ISO image" off \
+ BOOT "Build ELF image loadable by boot2 and loader" on
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITHOUT_ISO) && defined(WITHOUT_BOOT)
+IGNORE= cannot be built: neither ISO nor BOOT selected
+.endif
+
+.if defined(WITH_BOOT)
+SUB_FILES= pkg-message
+SUB_LIST+= BOOT_DIR=${BOOT_DIR}
+.endif
+
+.if defined(WITH_ISO)
+USE_CDRTOOLS= yes
+ALL_TARGET+= iso
+.endif
+
+pre-fetch:
+.if !defined(PACKAGE_BUILDING)
+ @${ECHO} "If you only need bootable ISO image of memtest86+, you can"
+ @${ECHO} "simply download it from http://www.memtest.org/. Use this"
+ @${ECHO} "port if you need ELF image of memtest86+ that can be loaded"
+ @${ECHO} "by boot2 or loader(8), or if you want to use this port to"
+ @${ECHO} "build ISO image with custom tweaks in memtest86+ code."
+.endif
+
+PLIST= ${WRKDIR}/pkg-plist
+
+pre-install:
+# Generate PLIST dynamically because install things outside normal ${PREFIX}
+ @${TEST} -f ${PLIST} && ${RM} ${PLIST} || ${TRUE}
+.if defined(WITH_ISO)
+ @${ECHO} "%%DATADIR%%/mt${PORTVERSION:C/\.//}.iso" >> ${PLIST}
+ @${ECHO} "@dirrm %%DATADIR%%" >> ${PLIST}
+.endif
+.if defined(WITH_BOOT)
+ @${ECHO} "@cwd ${BOOT_DIR:H}" >> ${PLIST}
+ @${ECHO} "${BOOT_DIR:T}/memtest86+" >> ${PLIST}
+ @${ECHO} "@dirrm ${BOOT_DIR:T}" >> ${PLIST}
+.endif
+
+do-install:
+.if defined(WITH_ISO)
+ @${MKDIR} ${DATADIR}
+ ${INSTALL_DATA} ${WRKSRC}/mt${PORTVERSION:C/\.//}.iso ${DATADIR}
+.endif
+.if defined(WITH_BOOT)
+ @${MKDIR} ${BOOT_DIR}
+# XXX is INSTALL_KLD really appropriate here? XXX
+ ${INSTALL_KLD} ${WRKSRC}/memtest ${BOOT_DIR}/memtest86+
+.endif
+.if !defined(NOPORTDOCS)
+ @${MKDIR} ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+.endif
+
+post-install:
+.if defined(WITH_BOOT)
+ @${ECHO_MSG}
+ @${CAT} ${PKGMESSAGE}
+ @${ECHO_MSG}
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/memtest86+/distinfo b/sysutils/memtest86+/distinfo
new file mode 100644
index 000000000000..3e98395a43a6
--- /dev/null
+++ b/sysutils/memtest86+/distinfo
@@ -0,0 +1,3 @@
+MD5 (memtest86+-2.11.tar.gz) = e457774139c0bfef899359df91f49b3e
+SHA256 (memtest86+-2.11.tar.gz) = 43876a7221e39cde791f20d04ecb071adfa08975cac2e511d04359619ce16c0e
+SIZE (memtest86+-2.11.tar.gz) = 165937
diff --git a/sysutils/memtest86+/files/patch-Makefile b/sysutils/memtest86+/files/patch-Makefile
new file mode 100644
index 000000000000..f07daf54c8ec
--- /dev/null
+++ b/sysutils/memtest86+/files/patch-Makefile
@@ -0,0 +1,29 @@
+--- Makefile 2008-11-16 02:30:50.000000000 +0200
++++ Makefile 2009-02-18 09:03:07.000000000 +0200
+@@ -23,15 +23,15 @@ all: memtest.bin memtest
+ # symbols and then link it dynamically so I have full
+ # relocation information
+ memtest_shared: $(OBJS) memtest_shared.lds Makefile
+- $(LD) --warn-constructors --warn-common -static -T memtest_shared.lds \
++ $(LD) --warn-constructors --warn-common -static --oformat elf32-i386-freebsd -T memtest_shared.lds \
+ -o $@ $(OBJS) && \
+- $(LD) -shared -Bsymbolic -T memtest_shared.lds -o $@ $(OBJS)
++ $(LD) -shared -Bsymbolic --oformat elf32-i386-freebsd -T memtest_shared.lds -o $@ $(OBJS)
+
+ memtest_shared.bin: memtest_shared
+ objcopy -O binary $< memtest_shared.bin
+
+ memtest: memtest_shared.bin memtest.lds
+- $(LD) -s -T memtest.lds -b binary memtest_shared.bin -o $@
++ $(LD) -s --oformat elf32-i386-freebsd -T memtest.lds -b binary memtest_shared.bin -o $@
+
+ head.s: head.S config.h defs.h test.h
+ $(CC) -E -traditional $< -o $@
+@@ -58,7 +58,6 @@ clean:
+ iso:
+ make all
+ ./makeiso.sh
+- rm -f *.o *.s memtest.bin memtest memtest_shared memtest_shared.bin
+
+ install: all
+ dd <memtest.bin >$(FDISK) bs=8192
diff --git a/sysutils/memtest86+/files/patch-error.c b/sysutils/memtest86+/files/patch-error.c
new file mode 100644
index 000000000000..452b906527c7
--- /dev/null
+++ b/sysutils/memtest86+/files/patch-error.c
@@ -0,0 +1,10 @@
+--- error.c 2008-11-16 02:18:14.000000000 +0200
++++ error.c 2009-02-18 00:27:40.000000000 +0200
+@@ -11,7 +11,6 @@
+
+ #include "test.h"
+ #include "config.h"
+-#include <sys/io.h>
+ #include "dmi.h"
+
+ extern int test_ticks, nticks, beepmode;
diff --git a/sysutils/memtest86+/files/patch-memtest.lds b/sysutils/memtest86+/files/patch-memtest.lds
new file mode 100644
index 000000000000..0712bdcb03d5
--- /dev/null
+++ b/sysutils/memtest86+/files/patch-memtest.lds
@@ -0,0 +1,11 @@
+--- memtest.lds 2008-11-16 02:18:14.000000000 +0200
++++ memtest.lds 2009-02-18 00:24:22.000000000 +0200
+@@ -3,7 +3,7 @@
+
+ ENTRY(_start);
+ SECTIONS {
+- . = 0x10000;
++ . = 0xc0120000;
+ _start = . ;
+ .data : {
+ *(.data)
diff --git a/sysutils/memtest86+/files/patch-setup.S b/sysutils/memtest86+/files/patch-setup.S
new file mode 100644
index 000000000000..82d39f8819c5
--- /dev/null
+++ b/sysutils/memtest86+/files/patch-setup.S
@@ -0,0 +1,11 @@
+--- setup.S 2008-11-16 02:18:14.000000000 +0200
++++ setup.S 2009-02-18 00:28:02.000000000 +0200
+@@ -42,7 +42,7 @@ start:
+ jz alt_a20_done
+
+ /* set or clear bit1, the ALT_A20_GATE bit */
+- movb 4(%esp), %ah
++ addr32 movb 4(%esp), %ah
+ testb %ah, %ah
+ jz alt_a20_cont1
+ orb $2, %al
diff --git a/sysutils/memtest86+/files/patch-test.c b/sysutils/memtest86+/files/patch-test.c
new file mode 100644
index 000000000000..367bad070b9b
--- /dev/null
+++ b/sysutils/memtest86+/files/patch-test.c
@@ -0,0 +1,60 @@
+--- test.c 2008-11-16 02:18:14.000000000 +0200
++++ test.c 2009-02-18 00:27:11.000000000 +0200
+@@ -6,12 +6,11 @@
+ * ----------------------------------------------------
+ * MemTest86+ V2.01 Specific code (GPL V2.0)
+ * By Samuel DEMEULEMEESTER, sdemeule@memtest.org
+ * http://www.canardpc.com - http://www.memtest.org
+ */
+
+-#include "test.h"
+ #include "config.h"
+-#include <sys/io.h>
++#include "test.h"
+ #include "dmi.h"
+
+ extern int segs, bail;
+@@ -1400,6 +1399,20 @@ void sleep(int n, int sms)
+ }
+ }
+
++static inline unsigned char inb(unsigned int port)
++{
++ unsigned char data;
++
++ asm __volatile__("inb %1,%0" : "=a" (data) : "id" ((unsigned short)(port)));
++ return (data);
++}
++
++static inline void outb(unsigned int port, unsigned char data)
++{
++ asm __volatile__("outb %0,%1" : : "a" (data), "id" ((unsigned short)(port)));
++}
++
++
+ /* Beep function */
+
+ void beep(unsigned int frequency)
+@@ -1407,18 +1420,18 @@ void beep(unsigned int frequency)
+ unsigned int count = 1193180 / frequency;
+
+ // Switch on the speaker
+- outb_p(inb_p(0x61)|3, 0x61);
++ outb(inb(0x61)|3, 0x61);
+
+ // Set command for counter 2, 2 byte write
+- outb_p(0xB6, 0x43);
++ outb(0xB6, 0x43);
+
+ // Select desired Hz
+- outb_p(count & 0xff, 0x42);
++ outb(count & 0xff, 0x42);
+ outb((count >> 8) & 0xff, 0x42);
+
+ // Block for 100 microseconds
+ sleep(100, 1);
+
+ // Switch off the speaker
+- outb(inb_p(0x61)&0xFC, 0x61);
++ outb(inb(0x61)&0xFC, 0x61);
+ }
diff --git a/sysutils/memtest86+/files/pkg-message.in b/sysutils/memtest86+/files/pkg-message.in
new file mode 100644
index 000000000000..06a329da8fc3
--- /dev/null
+++ b/sysutils/memtest86+/files/pkg-message.in
@@ -0,0 +1,19 @@
+========================================================================
+This port has installed ELF image of memtest86+ to
+%%BOOT_DIR%%/memtest86+. You can load it from from boot prompt by
+interrupting boot process and entering
+
+ N:ad(M,a)%%BOOT_DIR%%/memtest86+
+
+where N and M denote proper disk and slice numbers. See boot(8) for
+details.
+
+Alternatively you can load the image from loader prompt by escaping to
+it and entering the following commands:
+
+ unload
+ load %%BOOT_DIR%%/memtest86+
+ boot
+
+As already advised, see loader(8) for details.
+========================================================================
diff --git a/sysutils/memtest86+/pkg-descr b/sysutils/memtest86+/pkg-descr
new file mode 100644
index 000000000000..01b85671a183
--- /dev/null
+++ b/sysutils/memtest86+/pkg-descr
@@ -0,0 +1,4 @@
+Memtest86+ is a stand-alone memory test for x86 architecture computers
+based on the well-known original memtest86 written by Chris Brady.
+
+WWW: http://www.memtest.org/