Memtest86+: Difference between revisions
No edit summary |
(First update since 2011, needs review and updates for use with SeaBIOS) |
||
Line 1: | Line 1: | ||
== Building == | == Building == | ||
Instead of building coreboot with MemTest86+ as its default payload, it is recommended to simply load the binary from your payload of choice as an extra boot option. | |||
=== Manual build === | |||
First download the latest tarball, extract and cd into it: | |||
$ ''' | $ '''curl -O http://www.memtest.org/download/5.01/memtest86+-5.01.tar.gz''' | ||
$ ''' | $ '''tar -xvzf memtest86+-5.01.tar.gz && cd memtest86+-5.01''' | ||
The default Makefile includes a scp command to backup any previously built binary which we obviously don't want. Furthermore, due to MemTest86+ 5.01 being slightly outdated as of 27.09.2013, compilation will fail on newer versions of GCC unless we add a specific option. Last but not least SERIAL_BAUD_RATE should be increased and we might also want to hear a beep before memory testing starts. The following patch includes all those changes, feel free to adjust. | |||
--- Makefile 2015-11-18 23:49:40.900093793 +0100 | |||
+++ Makefile.new 2015-11-19 00:08:37.392634002 +0100 | |||
@@ -15,3 +15,3 @@ | |||
CFLAGS= -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin \ | |||
- -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector | |||
+ -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector -fgnu89-inline | |||
@@ -23,3 +23,2 @@ | |||
all: clean memtest.bin memtest | |||
- scp memtest.bin root@192.168.0.12:/srv/tftp/mt86plus | |||
--- config.h 2015-11-18 23:49:27.696700200 +0100 | |||
+++ config.h.new 2015-11-19 00:08:55.799401157 +0100 | |||
@@ -19,3 +19,3 @@ | |||
/* BEEP_MODE - Beep on error. Default off, Change to 1 to enable */ | |||
-#define BEEP_MODE 0 | |||
+#define BEEP_MODE 1 | |||
@@ -37,3 +37,3 @@ | |||
/* SERIAL_BAUD_RATE - Baud rate for the serial console */ | |||
-#define SERIAL_BAUD_RATE 9600 | |||
+#define SERIAL_BAUD_RATE 115200 | |||
Either make those changes by hand or paste the patch into a file and apply it: | |||
$ '''patch < fix.patch''' | |||
$ '''make''' | Now build it: | ||
$ '''make -j$(nproc)''' | |||
The | The resulting binaries are: | ||
memtest: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped | |||
memtest.bin: DOS/MBR boot sector | |||
In case GRUB2 is used default payload, add the x86-bootable '''memtest.bin''' to your ROM image with | |||
$ '''cbfstool coreboot.rom add -f memtest.bin -n memtest.bin -t raw''' | |||
and add the following entry to your grub.cfg: | |||
menuentry 'MemTest86+ 5.01' { | |||
set root='cbfsdisk' | |||
linux16 /memtest.bin | |||
} | |||
Alternatively one can also load it directly from disk, e.g. by placing it under '''/boot/memtest.bin''' and adjusting the menuentry accordingly: | |||
search -n --set=root -f /boot/memtest.bin |
Revision as of 00:56, 19 November 2015
Building
Instead of building coreboot with MemTest86+ as its default payload, it is recommended to simply load the binary from your payload of choice as an extra boot option.
Manual build
First download the latest tarball, extract and cd into it:
$ curl -O http://www.memtest.org/download/5.01/memtest86+-5.01.tar.gz $ tar -xvzf memtest86+-5.01.tar.gz && cd memtest86+-5.01
The default Makefile includes a scp command to backup any previously built binary which we obviously don't want. Furthermore, due to MemTest86+ 5.01 being slightly outdated as of 27.09.2013, compilation will fail on newer versions of GCC unless we add a specific option. Last but not least SERIAL_BAUD_RATE should be increased and we might also want to hear a beep before memory testing starts. The following patch includes all those changes, feel free to adjust.
--- Makefile 2015-11-18 23:49:40.900093793 +0100 +++ Makefile.new 2015-11-19 00:08:37.392634002 +0100 @@ -15,3 +15,3 @@ CFLAGS= -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin \ - -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector + -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector -fgnu89-inline @@ -23,3 +23,2 @@ all: clean memtest.bin memtest - scp memtest.bin root@192.168.0.12:/srv/tftp/mt86plus --- config.h 2015-11-18 23:49:27.696700200 +0100 +++ config.h.new 2015-11-19 00:08:55.799401157 +0100 @@ -19,3 +19,3 @@ /* BEEP_MODE - Beep on error. Default off, Change to 1 to enable */ -#define BEEP_MODE 0 +#define BEEP_MODE 1 @@ -37,3 +37,3 @@ /* SERIAL_BAUD_RATE - Baud rate for the serial console */ -#define SERIAL_BAUD_RATE 9600 +#define SERIAL_BAUD_RATE 115200
Either make those changes by hand or paste the patch into a file and apply it:
$ patch < fix.patch
Now build it:
$ make -j$(nproc)
The resulting binaries are:
memtest: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped memtest.bin: DOS/MBR boot sector
In case GRUB2 is used default payload, add the x86-bootable memtest.bin to your ROM image with
$ cbfstool coreboot.rom add -f memtest.bin -n memtest.bin -t raw
and add the following entry to your grub.cfg:
menuentry 'MemTest86+ 5.01' { set root='cbfsdisk' linux16 /memtest.bin }
Alternatively one can also load it directly from disk, e.g. by placing it under /boot/memtest.bin and adjusting the menuentry accordingly:
search -n --set=root -f /boot/memtest.bin