forked from Distrotech/memtest86
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathREADME.build-process
39 lines (29 loc) · 1.91 KB
/
README.build-process
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
During memory testing memetest86 relocates itself in memory so it can test the
memory it was previously running from. memetest86 is compiled as position mostly
independent code. Some relocations records must be processed to achieve the
affect of position independent code. A 16 bit loader is prepended to memetest86
so it can be loaded from a floppy, or from lilo.
In restructuring the build process I had several goals. Maintainability and
comprehsibility of the build process. Simplicity of the toolset. And the
ability to build images bootable by both the legacy x86 bootloader,
and images bootable by bootloaders that directly load static ELF images.
With the ability to proecess relocation records, memetest.bin has been
reduced in size from 84480 bytes to 49308 bytes. And now only requires one copy
of memetest86. A reduction in size of 35K. And the build process can now ignore
the size of memetest86.
BIOS calls have been moved from setup.S to head.S making bootsect.S and
setup.S exclusively for booting.
memetest86 is built in three stages. In the first stage the relocatable object
files are built as with any program. In the second stage the relocatable object
files are linked together into memetest_shared, a shared library version
of memetest86. In the third stage a raw memory image of memetest_shared is formed
and linked into memetest.bin, and memetest.
memetest.bin is the floppy/lilo bootable target.
memetest is the ELF bootable target.
Another major change is now data in the bss segment is also preserved
when memetest86 is relocated, and memetest86 can be relocated to any address.
The one thing to watch out for is pointers to data inside of memetest86. Except
for constant pointers to static data there is not enough information to generate
relocation records for pointers so they will not change when memetest86 is
relocated, which might lead to nasty surpises.
Eric Biederman <[email protected]>