#readelf -a a.out ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) ...............
Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .rodata.compresse PROGBITS 0000000000000000 00200000 0000000000000014 0000000000000000 WA 0 0 1 ........... Symbol table '.symtab' contains 9 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1 2: 0000000000000014 0 NOTYPE GLOBAL DEFAULT 1 input_data_end 3: 0000000000000004 0 NOTYPE GLOBAL DEFAULT 1 input_data 4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 input_len 5: 0000000000000004 0 NOTYPE GLOBAL DEFAULT 1 _binary_bin_start 6: 0000000000000010 0 NOTYPE GLOBAL DEFAULT ABS _binary_bin_size 7: 0000000000000014 0 NOTYPE GLOBAL DEFAULT 1 _binary_bin_end 8: 0000000000000010 0 NOTYPE GLOBAL DEFAULT 1 output_len
No version information found in this file.
bzImage access the compressed kernel
在arch/x86/boot/compressed/head_32.S内可以很方便的引用压缩后的内核image. /* * Do the decompression, and jump to the new kernel.. */ movl output_len(%ebx), %eax pushl %eax pushl %ebp # output address movl input_len(%ebx), %eax pushl %eax # input_len leal input_data(%ebx), %eax pushl %eax # input_data leal boot_heap(%ebx), %eax pushl %eax # heap area as third argument pushl %esi # real mode pointer as second arg call decompress_kernel
this is a magic how does bzImage include the compressed kernel arch/x86/boot/compressed/Makefile , 如下两行 LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T$(obj)/piggy.o: $(obj)