blob: 2ef9d1a89ee3fc599527379462cee6c9f1a06005 [file] [log] [blame]
Martin Roth9b1b3352016-02-24 12:27:06 -08001During memory testing memtest86 relocates itself in memory so it can test the
2memory it was previously running from. memtest86 is compiled as position mostly
3independent code. Some relocations records must be processed to achieve the
4affect of position independent code. A 16 bit loader is prepended to memtest86
5so it can be loaded from a floppy, or from lilo.
6
7In restructuring the build process I had several goals. Maintainability and
8comprehsibility of the build process. Simplicity of the toolset. And the
9ability to build images bootable by both the legacy x86 bootloader,
Martin Roth4dcd13d2016-02-24 13:53:07 -080010and images bootable by bootloaders that directly load static ELF images.
Martin Roth9b1b3352016-02-24 12:27:06 -080011
12With the ability to proecess relocation records, memtest.bin has been
13reduced in size from 84480 bytes to 49308 bytes. And now only requires one copy
14of memtest86. A reduction in size of 35K. And the build process can now ignore
15the size of memtest86.
16
17BIOS calls have been moved from setup.S to head.S making bootsect.S and
18setup.S exclusively for booting.
19
20memtest86 is built in three stages. In the first stage the relocatable object
21files are built as with any program. In the second stage the relocatable object
22files are linked together into memtest_shared, a shared library version
23of memtest86. In the third stage a raw memory image of memtest_shared is formed
24and linked into memtest.bin, and memtest.
25
26memtest.bin is the floppy/lilo bootable target.
27
28memtest is the ELF bootable target.
29
30Another major change is now data in the bss segment is also preserved
Martin Roth4dcd13d2016-02-24 13:53:07 -080031when memtest86 is relocated, and memtest86 can be relocated to any address.
Martin Roth9b1b3352016-02-24 12:27:06 -080032
33The one thing to watch out for is pointers to data inside of memtest86. Except
34for constant pointers to static data there is not enough information to generate
35relocation records for pointers so they will not change when memtest86 is
36relocated, which might lead to nasty surpises.
37
38Eric Biederman <ebiederman@lnxi.com>
39