From 358604aae2f1bae63667f4b811819d4f29de365b Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Fri, 18 Aug 2017 15:10:51 +0000 Subject: [PATCH] memtest86+: use debian patches, use default gcc --- pkgs/tools/misc/memtest86+/compile-fix.patch | 20 ---- pkgs/tools/misc/memtest86+/crash-fix.patch | 99 ------------------- pkgs/tools/misc/memtest86+/default.nix | 24 ++++- .../misc/memtest86+/no-optimization.patch | 11 --- pkgs/top-level/all-packages.nix | 4 +- 5 files changed, 23 insertions(+), 135 deletions(-) delete mode 100644 pkgs/tools/misc/memtest86+/compile-fix.patch delete mode 100644 pkgs/tools/misc/memtest86+/crash-fix.patch delete mode 100644 pkgs/tools/misc/memtest86+/no-optimization.patch diff --git a/pkgs/tools/misc/memtest86+/compile-fix.patch b/pkgs/tools/misc/memtest86+/compile-fix.patch deleted file mode 100644 index f178259f9e03..000000000000 --- a/pkgs/tools/misc/memtest86+/compile-fix.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- memtest86+-5.01/io.h~ 2013-08-10 02:01:58.000000000 +0000 -+++ memtest86+-5.01/io.h 2014-01-08 01:29:12.404465515 +0000 -@@ -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##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 --git a/pkgs/tools/misc/memtest86+/crash-fix.patch b/pkgs/tools/misc/memtest86+/crash-fix.patch deleted file mode 100644 index de7c86bac353..000000000000 --- a/pkgs/tools/misc/memtest86+/crash-fix.patch +++ /dev/null @@ -1,99 +0,0 @@ -diff --git a/controller.c b/controller.c -index f4f7371..183e9c3 100644 ---- a/controller.c -+++ b/controller.c -@@ -2,6 +2,8 @@ - * MemTest86+ V5 Specific code (GPL V2.0) - * By Samuel DEMEULEMEESTER, sdemeule@memtest.org - * http://www.canardpc.com - http://www.memtest.org -+ * -+ * Edited by David McInnis Oct 4, 2014 - */ - - //#include "defs.h" -@@ -292,7 +294,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 +329,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; -@@ -1424,7 +1426,7 @@ static void poll_fsb_amd64(void) { - unsigned long dramchr; - float clockratio; - double dramclock; -- unsigned int dummy[3]; -+ unsigned int dummy[4]; - int ram_type; - - float coef = 10; -@@ -2851,13 +2853,13 @@ static void poll_timings_nf4ie(void) { - - static void poll_timings_i875(void) { - -- ulong dev6, dev62; -+ ulong dev6; - ulong temp; - float cas; - int rcd, rp, ras, chan; - long *ptr, *ptr2; - -- pci_conf_read( 0, 6, 0, 0x40, 4, &dev62); -+ pci_conf_read( 0, 6, 0, 0x40, 4, &dev6); - ptr2=(long*)(dev6+0x68); - - /* Read the MMR Base Address & Define the pointer */ -diff --git a/init.c b/init.c -index 754b8d7..5bd8b4f 100644 ---- a/init.c -+++ b/init.c -@@ -7,6 +7,8 @@ - * - * Released under version 2 of the Gnu Public License. - * By Chris Brady -+ * -+ * Edited by David McInnis October 4, 2014 - */ - - -@@ -914,7 +916,6 @@ void cpu_type(void) - default: - cprint(0, COL_MID, "Unknown Intel"); - break; -- break; - } - - } -diff --git a/main.c b/main.c -index 0bc7ca0..613f811 100644 ---- a/main.c -+++ b/main.c -@@ -422,7 +422,7 @@ void test_start(void) - //initialise_cpus(); - btrace(my_cpu_num, __LINE__, "BeforeInit", 1, 0, 0); - /* Draw the screen and get system information */ -- init(); -+ init(); - - /* Set defaults and initialize variables */ - set_defaults(); -@@ -737,7 +737,7 @@ void test_start(void) - /* Do the same test for each CPU */ - if (++cpu_sel >= act_cpus) - { -- cpu_sel = 0; -+ cpu_sel = 0; - next_test(); - } else { - continue; diff --git a/pkgs/tools/misc/memtest86+/default.nix b/pkgs/tools/misc/memtest86+/default.nix index 5b4044f1891c..0a02f8fb4f73 100644 --- a/pkgs/tools/misc/memtest86+/default.nix +++ b/pkgs/tools/misc/memtest86+/default.nix @@ -8,8 +8,28 @@ stdenv.mkDerivation rec { sha256 = "0fch1l55753y6jkk0hj8f6vw4h1kinkn9ysp22dq5g9zjnvjf88l"; }; - # Patch incompatiblity with GCC. Source: http://koji.fedoraproject.org/koji/buildinfo?buildID=586907 - patches = [ ./compile-fix.patch ./crash-fix.patch ./no-optimization.patch ]; + patches = [ + (fetchurl { + url = "https://sources.debian.net/data/main/m/memtest86+/5.01-3/debian/patches/doc-serialconsole"; + sha256 = "1qh2byj9bmpchym8iq20n4hqmy10nrl6bi0d9pgdqikkmw9m38jq"; + }) + (fetchurl { + url = "https://sources.debian.net/data/main/m/memtest86+/5.01-3/debian/patches/multiboot"; + sha256 = "0nq61307ah5b41ff5nqs99wjzjzlajvfv6k9c9d0gqvhx8r4dvmy"; + }) + (fetchurl { + url = "https://sources.debian.net/data/main/m/memtest86+/5.01-3/debian/patches/memtest86+-5.01-O0.patch"; + sha256 = "1xmj3anq1fr0cxwv8lqfp5cr5f58v7glwc6z0v8hx8aib8yj1wl2"; + }) + (fetchurl { + url = "https://sources.debian.net/data/main/m/memtest86+/5.01-3/debian/patches/memtest86+-5.01-array-size.patch"; + sha256 = "0yxlzpfs6313s91y984p7rlf5rgybcjhg7i9zqy4wqhm3j90f1kb"; + }) + (fetchurl { + url = "https://sources.debian.net/data/main/m/memtest86+/5.01-3/debian/patches/gcc-5"; + sha256 = "13xfy6sn8qbj1hx4vms2cz24dsa3bl8n2iblz185hkn11y7141sc"; + }) + ]; preBuild = '' # Really dirty hack to get Memtest to build without needing a Glibc diff --git a/pkgs/tools/misc/memtest86+/no-optimization.patch b/pkgs/tools/misc/memtest86+/no-optimization.patch deleted file mode 100644 index 76815a931704..000000000000 --- a/pkgs/tools/misc/memtest86+/no-optimization.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- memtest86+-5.01/Makefile~ 2014-01-08 01:30:11.355900076 +0000 -+++ memtest86+-5.01/Makefile 2014-01-08 01:31:19.387555469 +0000 -@@ -12,7 +12,7 @@ - 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/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 663258dec397..5af704bfa43b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3146,9 +3146,7 @@ with pkgs; memtest86 = callPackage ../tools/misc/memtest86 { }; - memtest86plus = callPackage ../tools/misc/memtest86+ { - stdenv = overrideCC stdenv gcc5; - }; + memtest86plus = callPackage ../tools/misc/memtest86+ { }; meo = callPackage ../tools/security/meo { boost = boost155;