Re: Why is -O binary used in kbuild ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  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... ?? 
 
TIA. 
 
Sumit Sharma. 
 
On Sat, 18 Sep 2004 Jon Masters wrote : 
>On 14 Sep 2004 12:48:42 -0000, matrix reloaded 
><matrix_reloaded18@xxxxxxxxxxxxxx> 
> 
> >         I am going through the kbuild process and found that at some stage after 
> > building vmlinux inside "/usr/src/linux/" somewhere kbuild uses objcopy to build 
> > bzImage inside /usr/src/linux/arch/i386/boot/compressed :- 
> 
> > Could anyone please explain why we are creating binary image of vmlinux here. 
> 
>We want a compressed kernel image that can uncompress itself and 
>appear as an x86 boot sector image rather than a standard ELF 
>executable file. 
> 
>Linux build procedures tend to rely upon objcopy a lot to remove 
>unwanted sections from output files or to bodge in particular sections 
>- for example the dummy stage adds several utilities to an image file 
>which also contains the kernel image. I use objcopy on embedded boards 
>to bundle a kernel image with bootloader and firmware in to one 
>loadable image. 
> 
>Cheers, 
> 
>Jon. 

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux