
348 Embedded Linux System Design and Development
1. First the function reads in various fields of the header and calculates the
required memory and type of loading required.
text_len = ntohl(hdr->data_start);
data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start);
bss_len = ntohl(hdr->bss_end) - ntohl(hdr->data_end);
stack_len = ntohl(hdr->stack_size);
Figure 10.2 bFLT file sections.
Figure 10.3 bFLT file loaded in memory.
Flat File Header
.Text
.data
GOT Entries
Reloc Entries =
flat_hdr.reloc_count
File Beginning, Offset = 0
Text Start, Offset = flat_hdr.entry
Data Start, Offset = flat_hdr.data_start
Data end, Offset = flat_hdr.data_end
Relocation start, Offset = flat_hdr ...