--- memtest86+-4.00.orig/README
+++ memtest86+-4.00/README
@@ -78,14 +78,13 @@
 
 4) Serial Console
 =================
+
 Memtest86+ can be used on PC's equipped with a serial port for the console.
 By default serial port console support is not enabled since it slows
-down testing.  To enable change the SERIAL_CONSOLE_DEFAULT define in
-config.h from a zero to a one.  The serial console baud rate may also
-be set in config.h with the SERIAL_BAUD_RATE define.  The other serial
-port settings are no parity, 8 data bits, 1 stop bit.  All of the features
-used by Memtest86+ are accessible via the serial console.  However, the
-screen sometimes is garbled when the online commands are used.
+down testing.
+
+To activate it, add a console parameter on the memtest86+
+command-line, like: "/boot/memtest86+.bin console=ttyS0,115200n8".
 
 
 5) Online Commands
--- memtest86+-4.00.orig/Makefile
+++ memtest86+-4.00/Makefile
@@ -11,7 +11,7 @@
 AS=as -32
 CC=gcc
 
-CFLAGS= -Wall -march=i486 -m32 -O2 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC
+CFLAGS= -Wall -march=i486 -m32 -O2 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC -fno-stack-protector
 
 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 \
--- memtest86+-4.00.orig/debian/lilo.conf
+++ memtest86+-4.00/debian/lilo.conf
@@ -0,0 +1,8 @@
+# sample /etc/lilo.conf entry for memtest86
+
+image  = /boot/memtest86+.bin
+ label = memtest86+
+
+image = /boot/memtest86+.bin
+ append = "console=ttyS0,115200n8"
+ label = memtest86+serial
--- memtest86+-4.00.orig/debian/changelog
+++ memtest86+-4.00/debian/changelog
@@ -0,0 +1,457 @@
+memtest86+ (4.00-2ubuntu3common0omsk1) lucid; urgency=low
+
+  * Update to latest from lucid, remaining changes:
+    - debian/rules: Do not install grub rule.
+
+ -- Michael Terry <michael.terry@canonical.com>  Tue, 23 Mar 2010 14:12:54 +0000
+
+memtest86+ (4.00-2ubuntu3) lucid; urgency=low
+
+  * Only run update-grub in the postrm on remove/purge.
+
+ -- Colin Watson <cjwatson@ubuntu.com>  Tue, 23 Mar 2010 09:26:27 +0000
+
+memtest86+ (4.00-2ubuntu2) lucid; urgency=low
+
+  * Reapply dropped patch from karmic:
+    - Don't emit grub2 menu items if /boot is on a loop-mounted device (e.g.
+      Wubi; LP: #435153).
+  * Cache results of prepare_grub_to_access_device to speed up update-grub
+    runs a little.
+
+ -- Colin Watson <cjwatson@ubuntu.com>  Mon, 22 Feb 2010 16:06:40 +0000
+
+memtest86+ (4.00-2ubuntu1) lucid; urgency=low
+
+  * Merge from debian testing, remaining changes:
+    - Makefile: Add -fno-stack-protector to CFLAGS, since this package does
+      not link against libc.
+    - debian/grub: check for existance of /usr/lib/grub/grub-mkconfig_lib
+    - debian/postinst: Only run update-grub2 in postinst if 
+      /boot/grub/grub.cfg exists
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Mon, 09 Nov 2009 17:09:57 +0100
+
+memtest86+ (4.00-2) unstable; urgency=low
+
+  * Fix wrong integration of grub2 patch (Closes: #549125).
+
+ -- Yann Dirson <dirson@debian.org>  Thu, 01 Oct 2009 21:05:36 +0200
+
+memtest86+ (4.00-1) unstable; urgency=low
+
+  * New upstream release (Closes: #548033).
+  * Dropped obsolete patches for old gcc-4.3 bugs (works fine now), and
+    for opteron (support for builtin memory controller was redone).
+  * Update grub2 support file to use "linux16" command and use
+    grub-mkconfig_lib instead of old update-grub_lib (Avi Rozen,
+    Closes: #539907, #522345).
+  * Update grub2 support file for systems where /boot is on a separate
+    partition (Vasilis Vasaitis, Closes: #540572).
+
+ -- Yann Dirson <dirson@debian.org>  Tue, 29 Sep 2009 23:40:15 +0200
+
+memtest86+ (2.11-3ubuntu5) karmic; urgency=low
+
+  * debian/grub:
+    - check for existance of /usr/lib/grub/grub-mkconfig_lib before
+      sourcing it (LP: #459080). This fixes a upgrade failure when
+      the memtest86+ postinst is run but the new grub-common is not
+      yet installed 
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Fri, 23 Oct 2009 16:14:27 +0200
+
+memtest86+ (2.11-3ubuntu4) karmic; urgency=low
+
+  * Don't emit grub2 menu items if /boot is on a loop-mounted device (e.g.
+    Wubi; LP: #435153).
+
+ -- Colin Watson <cjwatson@ubuntu.com>  Mon, 28 Sep 2009 10:01:25 +0100
+
+memtest86+ (2.11-3ubuntu3) karmic; urgency=low
+
+  * Use grub2's 16-bit Linux loader, not the 32-bit one (LP: #424506).
+
+ -- Colin Watson <cjwatson@ubuntu.com>  Fri, 04 Sep 2009 22:19:32 +0100
+
+memtest86+ (2.11-3ubuntu2) karmic; urgency=low
+
+  * Fix grub2 menu hook to use grub-mkconfig_lib rather than the deprecated
+    update-grub_lib (thanks, Alex Valavanis; LP: #384627).
+  * Only run update-grub2 in postinst if /boot/grub/grub.cfg exists. This
+    makes installation in chroots work rather better.
+
+ -- Colin Watson <cjwatson@ubuntu.com>  Wed, 24 Jun 2009 16:55:39 +0100
+
+memtest86+ (2.11-3ubuntu1) jaunty; urgency=low
+
+  * Merge from debian unstable (Closes LP: #299161), remaining changes:
+    - Makefile: Add -fno-stack-protector to CFLAGS, since this package does
+      not link against libc.
+
+ -- Chris Cheney <ccheney@ubuntu.com>  Thu, 26 Mar 2009 11:45:00 -0500
+
+memtest86+ (2.11-3) unstable; urgency=low
+
+  * Upload to squeeze.
+  * Adjust test condition on which to run update-grub2 in postinst (Robert
+    Millan, Closes: #448771).
+  * Parametrize debian/rules for easier sync with package memtest.
+  * Added a note in extended description that memtest86 is still
+    being worked on.
+  * Otherwise sync minor changes with memtest86 3.5-1 packaging.
+  * Provide link to GPL-2 instead of just GPL in copyright file (lintian).
+  * Run lilo from postinst without explicit path (lintian).
+  * Add a whatis entry to make-memtest86+-boot-floppy manpage (lintian).
+
+ -- Yann Dirson <dirson@debian.org>  Sun, 01 Mar 2009 16:50:40 +0100
+
+memtest86+ (2.11-2) experimental; urgency=low
+
+  * Remove "source" bashism from grub script (Closes: #513867).
+  * Document use of serial console in README, add example configs for grub
+    (Daniel Kahn Gillmor) and lilo, and make the grub script generate an
+    entry with serial console enabled (Closes: #503867).
+  * Add Homepage field in control file.
+  * Bumped Standards-Version to 3.8.0.
+
+ -- Yann Dirson <dirson@debian.org>  Sun, 08 Feb 2009 16:27:58 +0100
+
+memtest86+ (2.11-1) experimental; urgency=low
+
+  * New upstream release, into experimental to avoid disrupting lenny.
+  * Acknowledge NMU.
+  * Build with gcc-multilib on kfreebsd-amd64
+    (Petr Salinger, Closes: #493464).
+  * Update grub script for current version of grub
+    (Justin B Rye, Closes: #492242).
+  * Support for x86_64 in make-memtest86+-boot-floppy (Håkon Stordahl,
+    Closes: #451050).
+  * Use variables in make-memtest86+-boot-floppy (Gokdeniz Karadag,
+    Closes: #510128).
+  * Allow building for hurd-i386 architecture (Samuel Thibault,
+    Closes: #482899).
+  * Include changes from Ubuntu packages:
+    * Allow building for lpia architecture (Closes: #505526, #482065).
+    * Check for existence of /boot/grub in postrm.
+    * Install ELF image of memtest86+ in the binary package
+      (Closes: #505525).
+
+ -- Yann Dirson <dirson@debian.org>  Sat, 31 Jan 2009 00:26:54 +0100
+
+memtest86+ (2.01-1.1ubuntu1) jaunty; urgency=low
+
+  * Resynchronise with Debian. Remaining changes:
+    - debian/control: Add lpia as supported architecture.
+    - Makefile: Add -fno-stack-protector to CFLAGS, since this package does
+      not link against libc.
+    - Check for existence of /boot/grub in postrm.
+    - Install ELF image of memtest86+ in the binary package.
+  * Sync up postrm should-we-run-update-grub2 check with postinst.
+
+ -- Colin Watson <cjwatson@ubuntu.com>  Thu, 13 Nov 2008 10:37:16 +0000
+
+memtest86+ (2.01-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Makefile: Use -O1 not -Os for gcc4.3. (Closes: #500818).
+  * Make clean not ignore errors.
+
+ -- Barry deFreese <bdefreese@debian.org>  Thu, 02 Oct 2008 21:13:33 -0400
+
+memtest86+ (2.01-1ubuntu2) intrepid; urgency=low
+
+  * Build with -O1 rather than -Os (from
+    https://qa.mandriva.com/show_bug.cgi?id=42679; LP: #246412).
+
+ -- Colin Watson <cjwatson@ubuntu.com>  Thu, 11 Sep 2008 21:03:51 +0100
+
+memtest86+ (2.01-1ubuntu1) intrepid; urgency=low
+
+  * Merge from debian unstable, remaining changes:
+    - debian/control: Add lpia as supported architecture.
+    - Makefile: Add -fno-stack-protector to CFLAGS, since this package does
+      not link against libc.
+    - Merge basically the same as the one from Saïvann Carignan, thanks for
+      your work! LP: #192517
+  * Simplify the patch from LP #129614, the preinst is fine in debian, the
+    postinst needs to check for presence of /boot/grub.
+  * Do not call update-grub, but update-grub2. See
+    http://bugs.debian.org/460080 for details.
+  * install ELF image of memtest86+ in the binary package Thanks to Forest
+    Bond for the patch. (LP: #175720).
+
+ -- Reinhard Tartler <siretart@tauware.de>  Tue, 20 May 2008 17:04:27 +0200
+
+memtest86+ (2.01-1) unstable; urgency=low
+
+  * New upstream release (Closes: #468780).
+    * Serial console now supported as boot parameter (Closes: 308355).
+  * Added in README.Debian a pointer to the GRUB Legacy sample config
+    (Closes: #445517), mentionned that GRUB2 is automatically handled, and
+    that the make-memtest86+-boot-floppy script uses GRUB Legacy.
+  * Call update-grub2 instead of update-grub (Closes: #460080).
+
+ -- Yann Dirson <dirson@debian.org>  Wed, 23 Apr 2008 21:21:47 +0200
+
+memtest86+ (1.70-3ubuntu1) gutsy; urgency=low
+
+  * Merge from debian unstable, remaining changes:
+    - debian/control: Add lpia as supported architecture.
+    - Makefile: Add -fno-stack-protector to CFLAGS, since this package does
+      not link against libc.
+  * Check for /boot/grub/menu.lst rather than /boot/grub/menu.lst in
+    post{inst,rm}, LP: #129614
+
+ -- Reinhard Tartler <siretart@tauware.de>  Wed, 26 Sep 2007 22:43:24 +0200
+
+memtest86+ (1.70-3) unstable; urgency=low
+
+  * Build-depend on gcc-multilib on amd64 (Closes: #426239).
+  * Check for existence of /boot/grub/grub.cfg before running update-grub
+    (Closes: #425221).
+  * Take into account in make-memtest86+-boot-floppy path changes in
+    grub-legacy (Justin B Rye, Closes: #412255).  Does not support grub2,
+    however.
+
+ -- Yann Dirson <dirson@debian.org>  Sun, 29 Jul 2007 16:17:18 +0200
+
+memtest86+ (1.70-2ubuntu2) gutsy; urgency=low
+
+  * debian/control: Add lpia as supported architecture.
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue, 31 Jul 2007 00:04:33 +0200
+
+memtest86+ (1.70-2ubuntu1) gutsy; urgency=low
+
+  * Merge to Debian unstable; remaining Ubuntu changes:
+    - debian/control: Add libc6-dev-i386 build dependency on amd64 to fix
+      FTBFS.
+    - Makefile: Add -fno-stack-protector to CFLAGS, since this package does
+      not link against libc.
+  * debian/control: Set Ubuntu maintainer.
+
+ -- Martin Pitt <martin.pitt@ubuntu.com>  Mon, 21 May 2007 09:39:41 +0200
+
+memtest86+ (1.70-2) unstable; urgency=low
+
+  * Upload to unstable now that etch is released.
+  * Applied patch from Robert Millan to run update-grub when present
+    (Closes: #313000).
+  * Applied patch from Cyril Brulebois for GNU/kFreeBSD support (Closes: #338603):
+    * Adjust debian/rules to patch conditionally memtest{,_shared}.lds to
+      handle the right OUTPUT_FORMAT.
+    * Add "kfreebsd-i386 kfreebsd-amd64" to the Architecture field.
+  * Applied patch from Holger Mense to avoid user interaction in postinst
+    during non-interactive upgrades (Closes: #383634).
+  * Included an entry for /etc/grub.d from Robert Millan, added a Suggests
+    entry on grub2 accordingly (Closes: #422357).
+  * Switch to debhelper compat v5, added ${misc:Depends}.
+  * Updated FSF address in debian/copyright (lintian).
+  * Bumped Standards-Version to 3.7.2.
+
+ -- Yann Dirson <dirson@debian.org>  Sat, 19 May 2007 22:09:43 +0200
+
+memtest86+ (1.70-1) experimental; urgency=low
+
+  * New upstream release (Closes: #409863, #411444).
+  * Updated package description and suggests line for memtester (Closes:
+    #396552).
+  * Fixed typo in extended description (Closes: #377730).
+
+ -- Yann Dirson <dirson@debian.org>  Tue, 20 Feb 2007 19:39:29 +0100
+
+memtest86+ (1.65-1) unstable; urgency=low
+
+  * New upstream release (Closes: #331394).
+  * Get rid of "read -p" bashism in postinst (Closes: 327454).
+  * Get rid of the -a and -o bashisms in test calls in postinst, use &&
+    and || instead (lintian).
+  * Fixed style error in extended description (Tarzeau).
+
+ -- Yann Dirson <dirson@debian.org>  Wed,  5 Oct 2005 21:56:07 +0200
+
+memtest86+ (1.60-2) unstable; urgency=low
+
+  * Install (partial) upstream changelog (Closes: #325129).
+  * Added a clarifying note to the sample grub.conf for /boot partitions
+    (Closes: #311144).
+  * Applied patch from Mattias Wadenstein to test for ECC on more chipsets
+    (Closes: #303049).
+
+ -- Yann Dirson <dirson@debian.org>  Fri,  2 Sep 2005 09:47:12 +0200
+
+memtest86+ (1.60-1) unstable; urgency=low
+
+  * New upstream release.
+  * Re-applied Opteron patch.
+
+ -- Yann Dirson <dirson@debian.org>  Mon, 27 Jun 2005 23:28:25 +0200
+
+memtest86+ (1.55.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * Applied Opteron patch from Mattias Wadenstein (Closes: #302371).
+  * Added amd64 to the Architecture list in debian/control (Closes:
+    #280508).
+
+ -- Yann Dirson <dirson@debian.org>  Mon,  4 Apr 2005 15:19:44 +0200
+
+memtest86+ (1.51-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Yann Dirson <dirson@debian.org>  Thu, 17 Feb 2005 21:13:29 +0100
+
+memtest86+ (1.50-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Yann Dirson <dirson@debian.org>  Fri, 28 Jan 2005 21:44:07 +0100
+
+memtest86+ (1.40-1) unstable; urgency=low
+
+  * New upstream release, based on memtest86 3.2 (Closes: #290027).
+  * No need to patch README any more.
+  * Removed capitalized article at start of short description (thanks
+    lintian).
+
+ -- Yann Dirson <dirson@debian.org>  Sat, 15 Jan 2005 23:14:30 +0100
+
+memtest86+ (1.30-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Yann Dirson <dirson@debian.org>  Fri, 12 Nov 2004 18:36:29 +0100
+
+memtest86+ (1.27-2) unstable; urgency=low
+
+  * Removed the note in extended description that it was once part of
+    hwtools, since that only applies to memtest86.
+
+ -- Yann Dirson <dirson@debian.org>  Sat, 16 Oct 2004 16:35:46 +0200
+
+memtest86+ (1.27-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Yann Dirson <dirson@debian.org>  Fri, 15 Oct 2004 23:16:30 +0200
+
+memtest86+ (1.26-2) unstable; urgency=low
+
+  * regarding make-memtest86+-boot-floppy:
+    - posixified call to "read" (Closes: #275233).
+    - added mtools to suggested packages, and notice early when the
+      package is missing (Closes: #264619).
+    - changed message about grub package, and versionned the suggests
+      field, so people know they need a recent version of it (Closes:
+      #269148).
+  * Bumped Standards-Version to 3.6.1, no change.
+
+ -- Yann Dirson <dirson@debian.org>  Wed, 13 Oct 2004 23:58:12 +0200
+
+memtest86+ (1.26-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Yann Dirson <dirson@debian.org>  Mon, 13 Sep 2004 23:07:44 +0200
+
+memtest86+ (1.20-2) unstable; urgency=low
+
+  * Fixed make-memtest86+-boot-floppy to use /lib/grub instead of old
+    /usr/lib/grub (Closes: #261883).
+  * Added grub to the list of suggested packages.  Mentionned the script
+    in the description.
+  * Include manpage by Thomas Schmidt for make-memtest86+-boot-floppy
+    (see #263708).
+  * Added debian/watch file.
+
+ -- Yann Dirson <dirson@debian.org>  Sat,  7 Aug 2004 01:39:21 +0200
+
+memtest86+ (1.20-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Yann Dirson <dirson@debian.org>  Mon, 19 Jul 2004 14:38:19 +0200
+
+memtest86+ (1.15-2) unstable; urgency=low
+
+  * Install make-memtest86+-boot-floppy in /usr/bin/.
+  * Mention it in README.Debian.
+
+ -- Yann Dirson <dirson@debian.org>  Tue, 25 May 2004 15:49:16 +0200
+
+memtest86+ (1.15-1) unstable; urgency=low
+
+  * New upstream release:
+    - KTxxx-specific code was disabled (Closes: #241698).
+    - allows building with gcc 3.3, so go for it.
+
+ -- Yann Dirson <dirson@debian.org>  Sun, 23 May 2004 00:52:15 +0200
+
+memtest86+ (1.11-3) unstable; urgency=low
+
+  * Step back to using gcc-2.95 to allow gcc-3.2 to be dropped (Closes:
+    #236455).
+
+ -- Yann Dirson <dirson@debian.org>  Thu,  1 Apr 2004 22:16:53 +0200
+
+memtest86+ (1.11-2) unstable; urgency=low
+
+  * Fixed --memtest option in make-memtest86+-boot-floppy.
+  * Integrated changes from Martin Koeppe in
+    make-memtest86+-boot-floppy:
+    * use mtools to write into floppy image without being root
+    * cannot select filesystem type anymore, msdos only (who cares ?)
+    * put full GRUB on floppy to be able to install on harddisk
+  * Removed internal parameter for fd0, since that booting floopy is
+    always fd0 (if not, tell me).  That settles the potential problem with
+    linux/grub device names mapping: there's no problem.
+  * When writing to a real device, use a temporary image file and dd it as
+    a last step, so that mtools synchronous writes do not slow down things.
+
+ -- Yann Dirson <dirson@debian.org>  Mon, 15 Mar 2004 18:21:35 +0100
+
+memtest86+ (1.11-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Yann Dirson <dirson@debian.org>  Tue, 17 Feb 2004 14:00:55 +0100
+
+memtest86+ (1.10-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Yann Dirson <dirson@debian.org>  Mon, 16 Feb 2004 15:12:15 +0100
+
+memtest86+ (1.00-4) unstable; urgency=low
+
+  * Fixed postinst snippet to check for memtest86+ instead of memtest86
+    (thanks hmh).
+
+ -- Yann Dirson <dirson@debian.org>  Thu,  5 Feb 2004 10:18:50 +0100
+
+memtest86+ (1.00-3) unstable; urgency=low
+
+  * Fixed make-memtest86+-boot-floppy to correctly select the devault
+    image as /dev/fd0.
+  * Fixed make-memtest86+-boot-floppy usage summary to advertise expected
+    syntax.
+
+ -- Yann Dirson <dirson@debian.org>  Wed,  4 Feb 2004 18:02:26 +0100
+
+memtest86+ (1.00-2) unstable; urgency=low
+
+  * Improved the make-memtest86+-boot-floppy script to support writing to
+    a floppy image.
+
+ -- Yann Dirson <dirson@debian.org>  Wed,  4 Feb 2004 14:59:39 +0100
+
+memtest86+ (1.00-1) unstable; urgency=low
+
+  * Initial packaging, based on memtest86 3.0-5 (Closes: #230963).
+  * Force the use of gcc-3.2, since neither 3.3 nor 2.95 work.
+  * Use dh-buildinfo.
+
+ -- Yann Dirson <dirson@debian.org>  Wed,  4 Feb 2004 00:14:06 +0100
+
--- memtest86+-4.00.orig/debian/control
+++ memtest86+-4.00/debian/control
@@ -0,0 +1,32 @@
+Source: memtest86+
+Section: misc
+Priority: optional
+Maintainer: Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>
+XSBC-Original-Maintainer: Yann Dirson <dirson@debian.org>
+Build-Depends: debhelper (>> 5.0.0), dh-buildinfo, gcc-multilib [amd64 kfreebsd-amd64]
+Homepage: http://www.memtest.org/
+Standards-Version: 3.8.0
+
+Package: memtest86+
+Architecture: i386 amd64 kfreebsd-i386 kfreebsd-amd64 lpia hurd-i386
+Depends: ${misc:Depends}
+Suggests: hwtools, memtester, kernel-patch-badram, memtest86, grub2 (>=1.95+20070515-1) | grub (>= 0.95+cvs20040624), mtools
+Description: thorough real-mode memory tester
+ Memtest86+ scans your RAM for errors.
+ .
+ This tester runs independently of any OS - it is run at computer
+ boot-up, so that it can test *all* of your memory.  You may want to
+ look at `memtester', which allows to test your memory within Linux,
+ but this one won't be able to test your whole RAM.
+ .
+ It can output a list of bad RAM regions usable by the BadRAM kernel
+ patch, so that you can still use you old RAM with one or two bad bits.
+ .
+ Memtest86+ is based on memtest86 3.0, and adds support for recent
+ hardware, as well as a number of general-purpose improvements,
+ including many patches to memtest86 available from various sources.
+ .
+ Both memtest86 and memtest86+ are being worked on in parallel.
+ .
+ A convenience script is also provided to make a grub-based floppy or
+ image.
--- memtest86+-4.00.orig/debian/watch
+++ memtest86+-4.00/debian/watch
@@ -0,0 +1,2 @@
+version=2
+http://www.memtest.org/ download/(.*)/memtest86\+-(?:.*)\.tar\.gz
--- memtest86+-4.00.orig/debian/postrm
+++ memtest86+-4.00/debian/postrm
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+if ([ "$1" = remove ] || [ "$1" = purge ]) && \
+   test -e /boot/grub/grub.cfg && which update-grub2 > /dev/null ; then
+    update-grub2
+fi
+
+#DEBHELPER#
--- memtest86+-4.00.orig/debian/grub
+++ memtest86+-4.00/debian/grub
@@ -0,0 +1,37 @@
+#!/bin/sh
+set -e
+
+# older versions of grub2 do not have this yet (LP: #459080)
+if [ ! -e /usr/lib/grub/grub-mkconfig_lib ]; then
+    echo "no grub-mkconfig_lib, exiting"
+    exit 0
+fi
+
+. /usr/lib/grub/grub-mkconfig_lib
+
+# We can't cope with loop-mounted devices here.
+case ${GRUB_DEVICE_BOOT} in
+  /dev/loop/*|/dev/loop[0-9])
+    exit 0
+  ;;
+esac
+
+if test -e /boot/memtest86+.bin ; then
+  MEMTESTPATH=$( make_system_path_relative_to_its_root "/boot/memtest86+.bin" )
+  echo "Found memtest86+ image: $MEMTESTPATH" >&2
+  cat << EOF
+menuentry "Memory test (memtest86+)" {
+EOF
+  prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
+  printf '%s\n' "${prepare_boot_cache}"
+  cat << EOF
+	linux16	$MEMTESTPATH
+}
+menuentry "Memory test (memtest86+, serial console 115200)" {
+EOF
+  printf '%s\n' "${prepare_boot_cache}"
+  cat << EOF
+	linux16	$MEMTESTPATH console=ttyS0,115200n8
+}
+EOF
+fi
--- memtest86+-4.00.orig/debian/compat
+++ memtest86+-4.00/debian/compat
@@ -0,0 +1 @@
+5
--- memtest86+-4.00.orig/debian/make-memtest86+-boot-floppy
+++ memtest86+-4.00/debian/make-memtest86+-boot-floppy
@@ -0,0 +1,110 @@
+#!/bin/sh
+#
+# Script for making a memtest86 boot floppy using GRUB as bootloader
+#
+
+# (c) 2003 Peter Loje Hansen <pl@2m.dk>
+#  - original version
+# (c) 2004 Yann Dirson <dirson@debian.org>
+#  - added parameters
+#  - ability to work on a floppy image instead of a real floppy
+#  - adapted patches from Martin Koeppe <martin@koeppe-net.de>, to use
+#    mtools and install full grub
+
+# TODO:
+# - add a flag to generate a default boot entry for (hd0)
+
+set -e
+
+MEMTEST=/boot/memtest86+.bin
+FLOPPYIMAGE=/dev/fd0
+GRUBBIN=/usr/sbin/grub 
+GRUBLIB=/usr/lib/grub
+MFORMAT=/usr/bin/mformat 
+
+arch=$(dpkg --print-architecture)
+case "$arch" in
+  i386|?*-i386)   GRUBARCH=i386;;
+  amd64|?*-amd64) GRUBARCH=x86_64;;
+  *)              error "Unsupported architecture: $arch";;
+esac
+
+error()
+{
+    echo >&2 "$0: $*"
+    exit 1
+}
+
+needsarg()
+{
+    [ $1 -ge 2 ] || error "syntax error"
+}
+
+[ -d $GRUBLIB ] || error "Can't find $GRUBLIB - did you install a recent grub package (0.95+cvs20040624 or later) ?"
+[ -x $MFORMAT ] || error "Can't find mformat - did you install the mtools package ?"
+
+while [ $# -gt 0 ]
+do
+    case "$1" in
+    --help) echo "$0 [--memtest $MEMTEST] [--floppyimage $FLOPPYIMAGE]"; exit 0 ;;
+    --memtest) needsarg $#; MEMTEST="$2"; shift ;;
+    --floppyimage) needsarg $#; FLOPPYIMAGE="$2"; shift ;;
+    *) error "syntax error" ;;
+    esac
+    shift
+done
+
+MOUNTPOINT=$(mktemp -d)
+
+if [ -b "$FLOPPYIMAGE" ]
+then
+    FINALDEV="$FLOPPYIMAGE"
+    FLOPPYIMAGE="$(mktemp)"
+else
+    FINALDEV=""
+fi
+
+echo "* Creating msdos file system"
+echo
+if [ ! -s "$FLOPPYIMAGE" ]; then
+    # unless a non-empty image exists, create a blank one first
+    dd bs=1024 count=1440 if=/dev/zero of="$FLOPPYIMAGE"
+fi
+# FIXME: "-f 1440" should probably be dropped
+mformat -i $FLOPPYIMAGE -f 1440 :: 
+
+mmd -i $FLOPPYIMAGE ::/boot 
+mmd -i $FLOPPYIMAGE ::/boot/grub 
+
+echo
+echo "* Installing GRUB files"
+mcopy -v -i "$FLOPPYIMAGE" - ::/boot/grub/menu.lst <<EOF
+color green/black light-green/black
+default 0
+timeout 10
+title  memtest
+kernel (fd0)/boot/memtest.bin
+EOF
+mcopy -v -i "$FLOPPYIMAGE" $GRUBLIB/$GRUBARCH/* ::/boot/grub 
+
+echo
+echo "* Installing $MEMTEST"
+mcopy -v -i "$FLOPPYIMAGE" "$MEMTEST" ::/boot/memtest.bin 
+
+echo
+echo -n "* Installing GRUB"
+$GRUBBIN --batch --device-map=/dev/null <<EOF
+device (fd0) $FLOPPYIMAGE
+root (fd0)
+setup (fd0)
+quit
+EOF
+
+if [ -n "$FINALDEV" ]; then
+    echo
+    echo "Insert a writable floppy for $FINALDEV and press enter"
+    read FOO
+
+    dd bs=1024 if="$FLOPPYIMAGE" of="$FINALDEV"
+    rm "$FLOPPYIMAGE"
+fi
--- memtest86+-4.00.orig/debian/make-memtest86+-boot-floppy.1
+++ memtest86+-4.00/debian/make-memtest86+-boot-floppy.1
@@ -0,0 +1,39 @@
+.\" Man page for make-memtest86+-boot-floppy 
+
+.TH make-memtest86+-boot-floppy 1
+
+.SH NAME
+make-memtest86+-boot-floppy \- create a memtest86+ boot-floppy using GRUB.
+
+.SH SYNOPSIS
+
+.B make-memtest86+-boot-floppy [ \-\-memtest 
+.I <path to memtest86+-image>
+.B ] [ \-\-floppyimage 
+.I <path to floppyimage/device>
+.B ]
+
+.SH DESCRIPTION
+.B make-memtest86+-boot-floppy
+can create a memtest86+ boot floppy using GRUB as the bootloader.
+
+.SH OPTIONS
+
+.IP "\-\-memtest <path to the memtest-image>"
+Path to the memtest86+-image, default is /boot/memtest86+.bin.
+
+.IP "\-\-floppyimage <path to the floppyimage or device>"
+File or device where the boot-image should be written to, default is /dev/fd0.
+
+.IP "\-\-help" 
+Display a short message about the options of the tool.
+
+.SH AUTHOR
+This man-page has been written by Thomas Schmidt <thomas@thsnet.de>
+.PP
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU General Public License, Version 2 any
+later version published by the Free Software Foundation.
+.PP
+On Debian systems, the complete text of the GNU General Public
+License can be found in /usr/share/common\-licenses/GPL.
--- memtest86+-4.00.orig/debian/copyright
+++ memtest86+-4.00/debian/copyright
@@ -0,0 +1,25 @@
+This package was debianized by Yann Dirson <dirson@debian.org>
+
+It was downloaded from http://www.memtest.org/
+
+Upstream Author: Samuel Demeulemeester <memtest@memtest.org>, based on
+memtest86 by Chris Brady <cbrady@sgi.com>, and various contributors.
+
+License:
+
+   This package is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 dated June, 1991.
+
+   This package is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this package; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL-2'.
--- memtest86+-4.00.orig/debian/README.Debian
+++ memtest86+-4.00/debian/README.Debian
@@ -0,0 +1,14 @@
+memtest86+ for Debian
+---------------------
+
+Binary image is /boot/memtest86+.bin
+
+It is automatically registered against grub2.  For other bootloaders
+you'll need to do some manual setup (see examples/grub-menu.lst for
+GRUB Legacy or examples/lilo.conf for LILO), or to make a boot-floppy,
+and reboot on this image.
+
+The make-memtest86+-boot-floppy utility will help you to create a
+boot floppy or floppy image using GRUB Legacy.
+
+ -- Yann Dirson <dirson@debian.org>, Wed, 23 Apr 2008 21:05:51 z
--- memtest86+-4.00.orig/debian/grub-menu.lst
+++ memtest86+-4.00/debian/grub-menu.lst
@@ -0,0 +1,12 @@
+# sample /boot/grub/menu.lst entry for memtest86
+#
+# This example assumes the contents of /boot is on the root partition.
+# If your /boot is on its own partition, remove /boot from the 'kernel' line.
+
+title  memtest86+
+root   (hd0,0)
+kernel /boot/memtest86+.bin
+
+title  memtest86+ (serial console 115200)
+root   (hd0,0)
+kernel /boot/memtest86+.bin console=ttyS0,115200n8
--- memtest86+-4.00.orig/debian/rules
+++ memtest86+-4.00/debian/rules
@@ -0,0 +1,64 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+PACKAGE=memtest86+
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+
+# Different kernels, ABIs, ld defaults, see #338603
+ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
+	sed -i -e 's/"elf32-i386"/"elf32-i386-freebsd"/' memtest.lds memtest_shared.lds
+endif
+
+	$(MAKE) # CC=gcc-2.95
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+
+	[ ! -f Makefile ] || $(MAKE) clean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	install -d debian/$(PACKAGE)/usr/bin
+	install -m755 debian/make-$(PACKAGE)-boot-floppy debian/$(PACKAGE)/usr/bin/
+	install -D -m644 memtest.bin debian/$(PACKAGE)/boot/$(PACKAGE).bin
+	install -D -m644 memtest debian/$(PACKAGE)/usr/lib/$(PACKAGE)/$(PACKAGE).elf
+	#install -D -m755 debian/grub debian/$(PACKAGE)/etc/grub.d/20_$(PACKAGE)
+	dh_installman debian/make-$(PACKAGE)-boot-floppy.1
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+#	dh_installdebconf
+	dh_installdocs README
+	dh_buildinfo
+	dh_installexamples debian/lilo.conf debian/grub-menu.lst
+	dh_installchangelogs changelog
+#	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+#	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- memtest86+-4.00.orig/debian/postinst
+++ memtest86+-4.00/debian/postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -e
+
+# offer to run LILO
+# (adapted from snippet by chr.ohm@gmx.net)
+if [ -x /sbin/lilo ] && [ -r /etc/lilo.conf ] && 
+	[ "${DEBIAN_FRONTEND}" != "noninteractive" ] &&
+	grep "image.*=.*/boot/memtest86+.bin" /etc/lilo.conf >/dev/null
+then
+    echo "You seem to have an entry for memtest86+ in /etc/lilo.conf."
+    printf "Run lilo now [y/N]? "
+    read c
+    if [ "$c" = "y" ] || [ "$c" = "Y" ]
+    then
+	lilo
+    fi
+fi
+
+if [ "$1" = "configure" ] && [ -x "`which update-grub2 2>/dev/null`" ] && [ -e /boot/grub/grub.cfg ]; then
+    update-grub2
+fi
+
+#DEBHELPER#
