Node:Embedded data, Next:Filesystem interface, Previous:Memory map, Up:Internals
Stage 1 and Stage 2 have embedded variables whose locations are well-defined, so that the installation can patch the binary file directly without recompilation of the stages.
In Stage 1, these are defined:
0x3E
0x40
0x41
0x42
0x44
0x48
0x1FE
0xAA55
).
See the file stage1/stage1.S
, for more information.
In the first sector of Stage 1.5 and Stage 2, the block lists are
recorded between firstlist
and lastlist
. The address of
lastlist
is determined when assembling the file
stage2/start.S
.
The trick here is that it is actually read backward, and the first 8-byte block list is not read here, but after the pointer is decremented 8 bytes, then after reading it, it decrements again, reads, and so on, until it is finished. The terminating condition is when the number of sectors to be read in the next block list is zero.
The format of a block list can be seen from the example in the code just
before the firstlist
label. Note that it is always from the
beginning of the disk, but not relative to the partition
boundaries.
In the second sector of Stage 1.5 and Stage 2, these are defined:
0x6
0x8
0xC
0x10
0x11
0x12
0x12
+ the length of the version string
See the file stage2/asm.S
, for more information.