On Mon, Sep 20, 2004 at 06:42:00 -0000, matrix reloaded wrote: > Hi Jonathan, > Thanks for the reply. But still there are some doubts, like while building > bzImage, kbuild procedure does objcopy of /usr/src/linux/vmlinux to create > /usr/src/linux/arch/i386/boot/compressed/vmlinux.bin ... [Here I have taken > $temppiggy=vmlinux.bin]. It compresses it and then this it links it to create piggy.o > :- > > $ gzip -9 < vmlinux.bin > vmlinux.bin.gz > $ ld -r vmlinux.bin.gz -o piggy.o > > Now at this point I think that piggy.o is in ELF format, but there are only .data, > .shstrtab, .symtab and .shmstr sections present in this. > > $ readelf -S piggy.o > There are 5 section headers, starting at offset 0x10eb38: > > Section Headers: > [Nr] Name Type Addr Off Size ES Flg Lk Inf Al > [ 0] NULL 00000000 000000 000000 00 0 0 0 > [ 1] .data PROGBITS 00000000 000034 10eae3 00 WA 0 0 1 > [ 2] .shstrtab STRTAB 00000000 10eb17 000021 00 0 0 1 > [ 3] .symtab SYMTAB 00000000 10ec00 0000b0 10 4 5 4 > [ 4] .strtab STRTAB 00000000 10ecb0 000085 00 0 0 1 > Key to Flags: > W (write), A (alloc), X (execute), M (merge), S (strings) > I (info), L (link order), G (group), x (unknown) > O (extra OS processing required) o (OS specific), p (processor specific) > > > After this kbuild compiles head.S and misc.c and gets head.o and misc.o. Now, it > links these 2 with piggy.o to get bvmlinux... > > My question is if we don't have .text section at this point for vmlinux [which we had > at starting], then how does kernel know about which section is data and which is > text... ?? piggy.o must NOT have a .text section. It's all data, which after unpacking yield another ELF object -- which does have a .text section to jump into. But as a packed object, there is nothing to execute there. The head.o and misc.o have a .text section, right? And thus bvmlinux should too... ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature