summaryrefslogtreecommitdiff
path: root/sys-apps/memtest86/files
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/memtest86/files')
-rw-r--r--sys-apps/memtest86/files/39_memtest8618
-rw-r--r--sys-apps/memtest86/files/39_memtest86-r169
-rw-r--r--sys-apps/memtest86/files/memtest86-4.3.3-build-nopie.patch47
-rw-r--r--sys-apps/memtest86/files/memtest86-4.3.7-io-extern-inline.patch29
-rw-r--r--sys-apps/memtest86/files/memtest86-4.3.7-no-clean.patch16
-rw-r--r--sys-apps/memtest86/files/memtest86-4.3.7-reboot-def.patch13
6 files changed, 192 insertions, 0 deletions
diff --git a/sys-apps/memtest86/files/39_memtest86 b/sys-apps/memtest86/files/39_memtest86
new file mode 100644
index 000000000000..a736bce6a316
--- /dev/null
+++ b/sys-apps/memtest86/files/39_memtest86
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+. /usr/share/grub/grub-mkconfig_lib
+
+memtest=/boot/memtest86/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
diff --git a/sys-apps/memtest86/files/39_memtest86-r1 b/sys-apps/memtest86/files/39_memtest86-r1
new file mode 100644
index 000000000000..596a676cceb2
--- /dev/null
+++ b/sys-apps/memtest86/files/39_memtest86-r1
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+. /usr/share/grub/grub-mkconfig_lib
+
+memtest=/boot/memtest86/memtest.bin
+
+memtestelf=/boot/memtest86/memtest
+
+if [ -f "${memtest}" ] && [ -f "${memtestelf}" ]; then
+ multiple_memtest=true
+fi
+
+submenu_indentation=""
+if [ "${multiple_memtest}" = "true" ] && [ "${GRUB_DISABLE_SUBMENU}" != "y" ]; then
+ submenu_indentation="${grub_tab}"
+ cat <<EOF
+submenu 'Memtest86' {
+EOF
+fi
+
+if [ -f "${memtest}" ]; then
+ gettext_printf "Found memtest image: %s\n" "${memtest}" >&2
+
+ device="$("${grub_probe}" --target=device "${memtest}")"
+ path="$(make_system_path_relative_to_its_root "${memtest}")"
+ cat <<EOF
+${submenu_indentation}menuentry 'Memtest86' {
+EOF
+
+ if [ -n "{submenu_indentation}" ]; then
+ prepare_grub_to_access_device "${device}" | grub_add_tab | grub_add_tab
+ else
+ prepare_grub_to_access_device "${device}" | grub_add_tab
+ fi
+
+ cat <<EOF
+ ${submenu_indentation}linux16 "${path}"
+${submenu_indentation}}
+EOF
+fi
+
+if [ -f "${memtestelf}" ]; then
+ gettext_printf "Found memtest image: %s\n" "${memtestelf}" >&2
+
+ device="$("${grub_probe}" --target=device "${memtestelf}")"
+ path="$(make_system_path_relative_to_its_root "${memtestelf}")"
+ cat <<EOF
+${submenu_indentation}menuentry 'Memtest86 (ELF)' {
+EOF
+
+ if [ -n "${submenu_indentation}" ]; then
+ prepare_grub_to_access_device "${device}" | grub_add_tab | grub_add_tab
+ else
+ prepare_grub_to_access_device "${device}" | grub_add_tab
+ fi
+
+ # We use knetbsd as a lazy way of booting an ELF.
+ # It's not actually related to NetBSD at all.
+ cat <<EOF
+ ${submenu_indentation}knetbsd "${path}"
+${submenu_indentation}}
+EOF
+fi
+
+if [ "${multiple_memtest}" = "true" ] && [ "${GRUB_DISABLE_SUBMENU}" != "y" ]; then
+ cat <<EOF
+}
+EOF
+fi
diff --git a/sys-apps/memtest86/files/memtest86-4.3.3-build-nopie.patch b/sys-apps/memtest86/files/memtest86-4.3.3-build-nopie.patch
new file mode 100644
index 000000000000..adbbe6f86dc7
--- /dev/null
+++ b/sys-apps/memtest86/files/memtest86-4.3.3-build-nopie.patch
@@ -0,0 +1,47 @@
+diff -Naur src.orig/Makefile src/Makefile
+--- src.orig/Makefile 2013-10-10 16:52:14.292140058 -0400
++++ src/Makefile 2013-10-10 16:51:37.431138380 -0400
+@@ -8,11 +8,9 @@
+ #
+ FDISK=/dev/fd0
+
+-AS=as -32
+-CC=gcc
++ASFLAGS=-32
+
+-CFLAGS= -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin \
+- -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector
++CFLAGS= -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC -fno-stack-protector -fno-pie $(SMP_FL)
+
+ OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
+ config.o memsize.o error.o smp.o cpuid.o vmem.o random.o
+@@ -23,7 +21,7 @@
+ # 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 -T memtest_shared.lds -m elf_i386 \
+ -o $@ $(OBJS) && \
+ $(LD) -shared -Bsymbolic -T memtest_shared.lds -o $@ $(OBJS)
+
+@@ -50,10 +48,10 @@
+ $(CC) -c $(CFLAGS) -fno-strict-aliasing reloc.c
+
+ test.o: test.c
+- $(CC) -c -Wall -march=i486 -m32 -O0 -fomit-frame-pointer -fno-builtin -ffreestanding test.c
++ $(CC) -c $(CFLAGS:-fPIC=) -o $@ $<
+
+ random.o: random.c
+- $(CC) -c -Wall -march=i486 -m32 -O3 -fomit-frame-pointer -fno-builtin -ffreestanding random.c
++ $(CC) -c -Wall -march=i486 -m32 -O3 -fomit-frame-pointer -fno-builtin -ffreestanding -fno-stack-protector -fno-pie random.c
+
+ clean:
+ rm -f *.o *.s *.iso memtest.bin memtest memtest_shared \
+@@ -72,3 +70,7 @@
+ dos: all
+ cat mt86+_loader memtest.bin > memtest.exe
+
++head.o: head.s
++bootsect.o: bootsect.s
++setup.o: setup.s
++
diff --git a/sys-apps/memtest86/files/memtest86-4.3.7-io-extern-inline.patch b/sys-apps/memtest86/files/memtest86-4.3.7-io-extern-inline.patch
new file mode 100644
index 000000000000..3e6754d112b3
--- /dev/null
+++ b/sys-apps/memtest86/files/memtest86-4.3.7-io-extern-inline.patch
@@ -0,0 +1,29 @@
+the meaning of extern inline changed between standards. use static inline
+for these tiny I/O functions everywhere to keep things simple.
+
+--- a/io.h
++++ b/io.h
+@@ -31,6 +31,6 @@
+ */
+
+ #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) \
+@@ -43,6 +43,6 @@
+ __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) \
+@@ -55,6 +55,6 @@
+ __IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; }
+
+ #define __OUTS(s) \
+-extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
++static inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
+ { __asm__ __volatile__ ("cld ; rep ; outs" #s \
+ : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
diff --git a/sys-apps/memtest86/files/memtest86-4.3.7-no-clean.patch b/sys-apps/memtest86/files/memtest86-4.3.7-no-clean.patch
new file mode 100644
index 000000000000..cd8fc66ba094
--- /dev/null
+++ b/sys-apps/memtest86/files/memtest86-4.3.7-no-clean.patch
@@ -0,0 +1,16 @@
+don't run the clean target when building all as we run into parallel races:
+ - memtest kicks off building of a bunch of .o files
+ - clean runs in parallel which runs `rm` and deletes some of the new .o
+ - memtest goes to link and fails because objects are missing
+
+--- a/Makefile
++++ b/Makefile
+@@ -19,7 +19,7 @@
+ OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
+ config.o memsize.o error.o smp.o cpuid.o vmem.o random.o
+
+-all: clean memtest.bin memtest
++all: memtest.bin memtest
+
+ # Link it statically once so I know I don't have undefined
+ # symbols and then link it dynamically so I have full
diff --git a/sys-apps/memtest86/files/memtest86-4.3.7-reboot-def.patch b/sys-apps/memtest86/files/memtest86-4.3.7-reboot-def.patch
new file mode 100644
index 000000000000..be9e35347fe7
--- /dev/null
+++ b/sys-apps/memtest86/files/memtest86-4.3.7-reboot-def.patch
@@ -0,0 +1,13 @@
+the reboot func is used elsewhere, so don't mark it inline
+
+--- a/lib.c
++++ b/lib.c
+@@ -33,7 +33,7 @@ struct ascii_map_str {
+ int keycode;
+ };
+
+-inline void reboot(void)
++void reboot(void)
+ {
+
+ /* tell the BIOS to do a cold start */