#
# spec file for package memtest86+
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           memtest86+
Version:        5.01
Release:        8.2
Summary:        Memory Testing Image for x86 Architecture
License:        BSD-3-Clause
Group:          System/Boot
URL:            http://www.memtest.org
Source:         http://www.memtest.org/download/%{version}/%{name}-%{version}.tar.gz
Patch0:         fix-destdir
Patch1:         memtest86+-5.01-no-optimization.patch
Patch2:         memtest86+-5.01-compile-fix.patch
Patch3:         memtest86+-5.01-array-size-fix.patch
Patch4:         memtest86+-gcc5.patch
#!BuildIgnore:  gcc-PIE
Requires(pre):  /sbin/update-bootloader
Requires(pre):  perl
Provides:       lilo:/boot/memtest.bin
Obsoletes:      memtest86 <= 3.2
Provides:       memtest86 > 3.2
ExclusiveArch:  %{ix86} x86_64
%ifarch x86_64
BuildRequires:  glibc-devel-32bit glibc-32bit
%endif

%description
Memtest86 is an image that can be booted instead of a real OS. Once booted,
it can be used to test the computer's memory.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

%build
make %{?_smp_mflags}

%install
install -Dpm 0644 memtest \
  %{buildroot}/boot/memtest

%post
if [ "$YAST_IS_RUNNING" != instsys -a $1 = 1 -a \
	 -x /sbin/update-bootloader ]; then
	/sbin/update-bootloader --add --image /boot/memtest.bin --name "Memory Test (memtest86+)"
fi
true

%postun
test -x /sbin/update-bootloader && /sbin/update-bootloader --remove --force --image /boot/memtest.bin || true

%files
/boot/memtest
%doc README* changelog FAQ

%changelog
* Thu Jul 19 2018 mpluskal@suse.com
- Enable parallel build
- Modernise spec file with spec-cleaner
* Fri Oct 30 2015 jkeil@suse.de
- Remove unnecessary cdrkit BuildRequire dependency
* Mon Mar 23 2015 crrodriguez@opensuse.org
- memtest86+-gcc5.patch: Use -fgnu89-inline, fix build with
  GCC5, code relies on old inline semantics.
* Sun Feb 22 2015 meissner@suse.com
- BuildIgnore gcc-PIE, it does not make sense for this package.
* Thu Jul 31 2014 coolo@suse.com
- make it work by picking patches from Fedora - memtest doesn't like
  optimizations with newer compilers.
  See https://bugs.mageia.org/show_bug.cgi?id=11661 and fedora bugs.
- Added patches (all from fedora pkg):
  memtest86+-5.01-array-size-fix.patch
  memtest86+-5.01-compile-fix.patch
  memtest86+-5.01-no-optimization.patch
* Thu Nov  7 2013 duwe@suse.com
- update to memtest86+-5.01:
- Added support for up to 2 TB of RAM on X64 CPUs
- Added experimental SMT support up to 32 cores
- Added complete detection for memory controllers.
- Added Motherboard Manufacturer & Model reporting
- Added CPU temperature reporting
- Added enhanced Fail Safe Mode (Press F1 at startup)
- Added support for Intel "Sandy Bridge-E" CPUs
- Added support for Intel "Ivy Bridge" CPUs
- Added preliminary support for Intel "Haswell" CPUs
- Added preliminary support for Intel "Haswell-ULT" CPUs
- Added support for AMD "Kabini" (K16) CPUs
- Added support for AMD "Bulldozer" CPUs
- Added support for AMD "Trinity" CPUs
- Added support for AMD E-/C-/G-/Z- "Bobcat" CPUs
- Added support for Intel Atom "Pineview" CPUs
- Added support for Intel Atom "Cedar Trail" CPUs
- Added SPD detection on most AMD Chipsets
- Enforced Coreboot support
- Optimized run time for faster memory error detection
- Rewriten lots of memory timings detection code
- Corrected bugs, bugs and more bugs
- dropped patch: asm-inline-fix
* Fri Oct  5 2012 duwe@suse.com
- declare that the asm inline snippets in movinvr call e.g. rand()
  and might clobber caller-saved registers a, d, _and_ c.
  (bnc#773569)
* Wed Sep  5 2012 lars@samba.org
- PreReq /sbin/update-bootloader as it is used in the rpm post script hook;
  (bnc#628878).
* Sat Mar 17 2012 lars@samba.org
- PreReq perl to avoid update-bootloader to abort while install; (bnc#730022).
* Wed Mar 30 2011 trenn@suse.de
- Do not enable serial by default, console=ttySx,... still works
* Tue Mar 29 2011 trenn@suse.de
- Update to version 4.20:
  - Added failsafe mode (F1 at startup)
  - Added support for Intel "Sandy Bridge" CPU
  - Added support for AMD "fusion" CPU
  - Added Coreboot "table forward" support
  - Corrected some memory brand not detected
  - Various bug fixes
- Remove %%ifarch x86_64 check in .spec file. The internal Makefile
  already adds -m32 and -as32 itself.
* Mon Aug 30 2010 trenn@novell.com
- Remove old patches. Asked for inclusion, but not needed anymore:
  Patch 1/3 : No need to include.
  Patch 2/3 : Patch for Mt86+ 2.01. Will broke 4.10. Bug already patched in a
    cleaner way
  Patch 3/3 : Really no need. It's only a different way to add some comments.
* Fri Aug 27 2010 trenn@novell.com
- Update to version 4.10 with these features/fixes added:
  * New Features
    o Added support for Core i7 Extreme CPU (32nm)
    o Added support for Core i5/i3 (32 nm)
    o Added support for Pentium Gxxxx (32 mn)
    o Added support for Westmere-based Xeon
    o Added preliminary support for Intel Sandy Bridge
    o Added support for AMD 6-cores CPU
    o Added detection for Intel 3200/3210
    o New installer for USB Key
  * Bug Fixes
    o Corrected a crash at startup
    o Many others bug fixes
* Mon Sep 28 2009 trenn@suse.de
- Update to latest 4.00 version.
  Changes from mainline changelog:
    Features:
  * Major Architectural changes
  * First pass twice faster (reduced iterations)
  * Detect DDR2/3 brands and part numbers on Intel DDR2/3 chipsets
  * Added detection for Intel "Clarkdale" CPU
  * Added detection for Intel "Gulftown" CPU
  * Added detection for AMD "Magny-Cours" CPU
  * Added detection for Intel XMP Memory
  * Added for CPU w/ 0.5/1.5/3/6/12/16/18/24MB L3
  * Added "clean" DMI detection for DDR3/FBDIMM2
  * Better detection of Integrated Memory Controllers
    Bug Fixes
  * Corrected detection for Intel "Lynnfield" CPU
  * Corrected detection for AMD 45nm K10 CPU
  * Solved crash with AMD Geode LX
  * Complies with SMBIOS 2.6.1 specs
  * Fixed compilation issues with gcc 4.2+
  * Many others bug fixes
* Fri Nov 28 2008 duwe@suse.de
- work around a virtual address wrap at 4G, if > 5GB are installed
  (bnc#388191)
* Wed Apr 30 2008 coolo@suse.de
- update to 2.01 - among others:
  - Solved a major bug in Memory Address Errors Reporting
  - Patched for Intel-Powered Mac
  - Pass duration 20%% reduced
  - Solved a incoherency with pass progress indicator
  - Added support for 45 nm Mobile Core 2 w/ 3 Mo L2
  - Corrected Intel 3-Series (P35/X38) chipset init
- fix buffer overflows (bnc#359490) from Michael Matz
* Fri Aug 10 2007 duwe@suse.de
- Do not fail to install if update-bootloader is not there.
* Thu Aug  9 2007 duwe@suse.de
- Add memtest86+ to boot menu even if installed later
  (Feature #301969)
* Mon Feb 19 2007 trenn@suse.de
- added .gnu.hash section
* Thu Jan 25 2007 duwe@suse.de
  + update to 1.70:
- Added new DMI polling feature (Thanks to Joachim D.)
- Added Support for Core/Core2 Solo/Duo/Quad CPU
- Added Support for AMD K8 with DDR2 Memory
- Added Support for Intel CPU with 192/384 KB L2 Cache
- Added Support for FB-DIMM based memory (DMI)
- Added Detection for ALI CyberAladdin-T (M1644)
- Added Detection for Turion 64 X2
- Added Detection for AMD K8 with unknown chipsets
- Added Support for ATi Radeon xPress 3200
- Added Support for Intel i975X
- Added Support for Intel Q965/P965
- Added Support for Intel Q963/Q965
* Thu Nov 16 2006 mrueckert@suse.de
- switch to memtest86+ (http://www.memtest.org)
  Compared to memtest86 3.2 it supports more hardware. and has
  additional fixes. see http://www.memtest.org/#change for all
  details. This upgrade fixes bug (#148481).
- rediffed memtest86-3.2.diff to apply cleanly.
  new name: memtest86+-1.65.diff
- rediffed memtest86-3.2-timeout-serialconsole.diff to apply cleanly.
  new name: memtest86+-1.65_timeout-serialconsole.diff
- rediffed memtest86-include-linkonce to apply cleanly.
  new name: memtest86+-1.65_include-linkonce.patch
- cleaned up build section and directly use install instead of the
  broken install target
- added changelog and FAQ to the docs
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Tue May 10 2005 duwe@suse.de
- include *.gnu.linkonce.t.* sections in ld script,
  to build cleanly on amd64 with gcc4
* Mon Mar 14 2005 duwe@suse.de
- update to current version 3.2:
  more support for current CPUs and chipsets
  fix Bugs #60303 (duped #72202), #71215
* Mon Mar 22 2004 stepan@suse.de
- update to 3.1a. This fixes compilation with gcc 3.x
- drop precompiled binary completely
- add ExclusiveArch for x86 and AMD64
* Fri Mar 19 2004 stepan@suse.de
- update to v3.1
- remove gcc 2.95 exceptions
* Sun Sep  8 2002 kukuk@suse.de
- Add splitt alias [Bug #19111]
* Thu Sep  5 2002 garloff@suse.de
- memtest86-3.0 seems to hang on some machines if the serial
  console support is enabled, but no serial console connected.
  Add a timeout waiting for the serial console. (Bug #18302)
* Mon Sep  2 2002 garloff@suse.de
- Supply complete image (compiled by gcc-2.95), as I don't succeed
  solving the gcc-3.2 problems at this moment. (#18302)
* Sat Aug 31 2002 garloff@suse.de
- Supply main.s compiled with gcc-2.95 to work around problem with
  gcc-3.2.
* Tue Jul 30 2002 garloff@suse.de
- Split off lilo package.
* Tue Jul 30 2002 sf@suse.de
- added -m32 to compiler and linker for x86_64
- added --32 to as
- added glibc-devel-32bit for x86_64
* Fri Jun  7 2002 garloff@suse.de
- Update to memtest86-3.0:
  * Testing more than 2GB should work now.
  * Use PIC instead of two copies
  * Serial code avoid redundant writes now
  * ^l/l gives screen refresh (after connecting serial console)
  * Netbooting operational again
  * LinuxBIOS support (memory sizing)
* Mon Apr 22 2002 garloff@suse.de
- Update to memtest86-2.9:
  * Provide three memory sizing modes; default is conservative one
    probably not testing all memory on some boards
  * Testing more than 2GB supported
  * Memory testing in segments. Minor bug fixes.
* Fri Feb 15 2002 mantel@suse.de
- remove x bit from memtest.bin since it's not a Linux executable
* Tue Dec 11 2001 garloff@suse.de
- Update to memtest86-2.8(a):
  * Reworked build process; a network bootable boot image can be
    produced
  * mem and cache speed detection code rewritten (should work now)
  * CPU detection for Pentium 4
  * Serial console disabled by default
- Reenabled memtest86 serial console (9600 8n1) ;-)
- Clean up .spec file a bit
* Mon Jul 16 2001 uli@suse.de
- update memtest -> 2.7
* Mon Apr  9 2001 garloff@suse.de
- memtest86: Correct units (cosmetic)
* Thu Dec 21 2000 garloff@suse.de
- Update memtest86 to v2.5 final.
* Wed Nov 29 2000 garloff@suse.de
- Update memtest86 to v2.5-beta (Athlon/Duron support)
* Mon Aug 28 2000 garloff@suse.de
- Added memtest86-2.4.