In ptxdist it is called MEMTEST86P because + is not valid.

Signed-off-by: Alexander Stein <[email protected]>
---
Changes in V2:
* Adjust files suggested by Michael.

 .../memtest86+-4.10-hardcoded_cc.patch             |   39 ++++++++++
 patches/memtest86+-4.20/serial_base.patch          |   26 ++++++
 patches/memtest86+-4.20/series                     |    2 +
 rules/memtest86p.in                                |   27 +++++++
 rules/memtest86p.make                              |   81 ++++++++++++++++++++
 5 files changed, 175 insertions(+), 0 deletions(-)
 create mode 100644 patches/memtest86+-4.20/memtest86+-4.10-hardcoded_cc.patch
 create mode 100755 patches/memtest86+-4.20/serial_base.patch
 create mode 100644 patches/memtest86+-4.20/series
 create mode 100644 rules/memtest86p.in
 create mode 100644 rules/memtest86p.make

diff --git a/patches/memtest86+-4.20/memtest86+-4.10-hardcoded_cc.patch 
b/patches/memtest86+-4.20/memtest86+-4.10-hardcoded_cc.patch
new file mode 100644
index 0000000..4841b1d
--- /dev/null
+++ b/patches/memtest86+-4.20/memtest86+-4.10-hardcoded_cc.patch
@@ -0,0 +1,39 @@
+Subject: Remove hardcoded cc variable
+
+This patch is from Gentoo.
+URL: 
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/memtest86+/files/memtest86+-4.10-hardcoded_cc.patch?revision=1.1
+
+This patch cleans up the Makefile to allow overwrite CC and AS variable
+
+Signed-off-by: Alexander Stein <[email protected]>
+
+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 -nopie test.c
+ 
+ clean:
+       rm -f *.o *.s *.iso memtest.bin memtest memtest_shared 
memtest_shared.bin
diff --git a/patches/memtest86+-4.20/serial_base.patch 
b/patches/memtest86+-4.20/serial_base.patch
new file mode 100755
index 0000000..ea18382
--- /dev/null
+++ b/patches/memtest86+-4.20/serial_base.patch
@@ -0,0 +1,26 @@
+Subject: Use serial port addresses provided by BIOS
+
+Using this patch memtest86+ uses the serial port addresses provided by BIOS 
rather hardcoded defaults.
+
+Signed-off-by: Alexander Stein <[email protected]>
+
+--- memtest86+-4.20/lib.c      2011-01-23 19:11:04.000000000 +0100
++++ memtest86+-4.20/lib.c      2011-03-30 09:31:38.519674571 +0200
+@@ -24,7 +24,7 @@
+ #error Bad SERIAL_TTY. Only ttyS0 and ttyS1 are supported.
+ #endif
+ short serial_tty = SERIAL_TTY;
+-const short serial_base_ports[] = {0x3f8, 0x2f8, 0x3e8, 0x2e8};
++unsigned short serial_base_ports[] = {0x3f8, 0x2f8, 0x3e8, 0x2e8};
+
+ #if ((115200%SERIAL_BAUD_RATE) != 0)
+ #error Bad default baud rate
+@@ -1112,6 +1112,8 @@
+       serial_baud_rate = (int) baud_rate;
+  save_tty:
+       serial_tty = (short) tty;
++      /* fetch I/O port address from BIOS data area */
++      serial_base_ports[serial_tty] = ((const unsigned short *) 
0x0400)[serial_tty];
+       serial_cons = 1;
+ }
+
diff --git a/patches/memtest86+-4.20/series b/patches/memtest86+-4.20/series
new file mode 100644
index 0000000..70c0db8
--- /dev/null
+++ b/patches/memtest86+-4.20/series
@@ -0,0 +1,2 @@
+memtest86+-4.10-hardcoded_cc.patch
+serial_base.patch
diff --git a/rules/memtest86p.in b/rules/memtest86p.in
new file mode 100644
index 0000000..7e0a3f4
--- /dev/null
+++ b/rules/memtest86p.in
@@ -0,0 +1,27 @@
+## SECTION=debug_tools
+
+menuconfig MEMTEST86P
+       tristate
+       prompt "memtest86+                    "
+       help
+         Memory tester based on memtest86
+
+if MEMTEST86P
+
+config MEMTEST86P_SERIAL
+       bool "serial support"
+       help
+         The default state of the serial console.
+         This is normally off since it slows down testing.
+
+if MEMTEST86P_SERIAL
+
+config MEMTEST86P_BAUDRATE
+       int "default serial baudrate"
+       default 115200
+       help
+         Default baudrate for serial console.
+
+endif
+
+endif
diff --git a/rules/memtest86p.make b/rules/memtest86p.make
new file mode 100644
index 0000000..e843c99
--- /dev/null
+++ b/rules/memtest86p.make
@@ -0,0 +1,81 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2011 by Alexander Stein <[email protected]>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_MEMTEST86P) += memtest86p
+
+#
+# Paths and names
+#
+MEMTEST86P_VERSION     := 4.20
+MEMTEST86P             := memtest86+-$(MEMTEST86P_VERSION)
+MEMTEST86P_SUFFIX      := tar.gz
+MEMTEST86P_URL         := 
http://www.memtest.org/download/$(MEMTEST86P_VERSION)/$(MEMTEST86P).$(MEMTEST86P_SUFFIX)
+MEMTEST86P_SOURCE      := $(SRCDIR)/$(MEMTEST86P).$(MEMTEST86P_SUFFIX)
+MEMTEST86P_DIR         := $(BUILDDIR)/$(MEMTEST86P)
+MEMTEST86P_LICENSE     := GPL-2
+MEMTEST86P_MD5         := ef62c2f5be616676c8c62066dedc46b3
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/memtest86p.prepare:
+       @$(call targetinfo)
+
+ifdef PTXCONF_MEMTEST86P_SERIAL
+       sed -i -e 's/#define SERIAL_CONSOLE_DEFAULT 0/#define 
SERIAL_CONSOLE_DEFAULT 1/' $(MEMTEST86P_DIR)/config.h
+       sed -i -e 's/#define SERIAL_BAUD_RATE .*/#define SERIAL_BAUD_RATE 
$(PTXCONF_MEMTEST86P_BAUDRATE)/' $(MEMTEST86P_DIR)/config.h
+else
+       @sed -i -e 's/#define SERIAL_CONSOLE_DEFAULT 1/#define 
SERIAL_CONSOLE_DEFAULT 0/' $(MEMTEST86P_DIR)/config.h
+endif
+       # Don't prestrip generated files
+       sed -i -e 's/$$(LD) -s /$$(LD) /' $(MEMTEST86P_DIR)/Makefile
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+MEMTEST86P_PATH        := PATH=$(CROSS_PATH)
+MEMTEST86P_MAKE_OPT    := $(CROSS_ENV_PROGS)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/memtest86p.install:
+       @$(call targetinfo)
+       install -D -m 644 $(MEMTEST86P_DIR)/memtest.bin \
+               $(MEMTEST86P_PKGDIR)/boot/memtest86+.bin
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/memtest86p.targetinstall:
+       @$(call targetinfo)
+
+       @$(call install_init, memtest86p)
+       @$(call install_fixup, memtest86p,PRIORITY,optional)
+       @$(call install_fixup, memtest86p,SECTION,base)
+       @$(call install_fixup, memtest86p,AUTHOR,"Alexander Stein 
<[email protected]>")
+       @$(call install_fixup, memtest86p,DESCRIPTION,missing)
+
+       @$(call install_copy, memtest86p, 0, 0, 0644, -, /boot/memtest86+.bin)
+
+       @$(call install_finish, memtest86p)
+
+       @$(call touch)
+
+# vim: syntax=make
-- 
1.7.3.4


-- 
ptxdist mailing list
[email protected]

Reply via email to