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:
0x3E0x400x410x420x440x480x1FE0xAA55).
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:
0x60x80xC0x100x110x120x12 + the length of the version stringSee the file stage2/asm.S, for more information.