x86 kernel build chain - how bzImage gets created

Graeme Russ graeme.russ at gmail.com
Tue Nov 22 05:46:31 EST 2011


Hi All,

Hopefully this will help demystify the build process

Notation:
<primary input file> (<file size in bytes>)
  |
  + <additional input file>
  |
  * <command>
  |
  \-> <output file> (<file size in bytes>)

The file sizes are arbitrary and are based on the current configuration
options I have set for a small kernel. They are simply there to illustrate
the relative differences in file sizes.

Note that vmlinux.o is not used to generate bzImage but I've included it
for completeness

+ arch/x86/kernel/head_32.o
+ arch/x86/kernel/head32.o
+ arch/x86/kernel/head.o
+ arch/x86/kernel/init_task.o
+ init/built-in.o
+ usr/built-in.o
+ arch/x86/built-in.o
+ kernel/built-in.o
+ mm/built-in.o
+ fs/built-in.o
+ ipc/built-in.o
+ security/built-in.o
+ crypto/built-in.o
+ block/built-in.o
+ lib/lib.a
+ arch/x86/lib/lib.a
+ lib/built-in.o
+ arch/x86/lib/built-in.o
+ drivers/built-in.o
+ sound/built-in.o
+ firmware/built-in.o
+ arch/x86/pci/built-in.o
+ net/built-in.o
|
* ld -m elf_i386 -r -o vmlinux.o
|
\->vmlinux.o (2,889,050)

+ arch/x86/kernel/head_32.o
+ arch/x86/kernel/head32.o
+ arch/x86/kernel/head.o
+ arch/x86/kernel/init_task.o
+ init/built-in.o
+ usr/built-in.o
+ arch/x86/built-in.o
+ kernel/built-in.o
+ mm/built-in.o
+ fs/built-in.o
+ ipc/built-in.o
+ security/built-in.o
+ crypto/built-in.o
+ block/built-in.o
+ lib/lib.a
+ arch/x86/lib/lib.a
+ lib/built-in.o
+ arch/x86/lib/built-in.o
+ drivers/built-in.o
+ sound/built-in.o
+ firmware/built-in.o
+ arch/x86/pci/built-in.o
+ net/built-in.o
+ .tmp_kallsyms2.o
|
* ld -m elf_i386 --build-id -T arch/x86/kernel/vmlinux.lds
|
\->vmlinux (2,629,659)
   |
   * objcopy -R .comment -S
   |
   \->arch/x86/boot/compressed/vmlinux.bin (2,094,132)
      |
      * gzip
      |
      \-> arch/x86/boot/compressed/vmlinux.bin.gz (1,074,711)
         |
         * .incbin
         |
         \-> piggy.S
            |
            * gcc
            |
            \-> piggy.o (1,075,419)
               |
               + arch/x86/boot/compressed/head_32.o
               + arch/x86/boot/compressed/misc.o
               + arch/x86/boot/compressed/string.o
               + arch/x86/boot/compressed/cmdline.o
               + arch/x86/boot/compressed/early_serial_console.o
               |
               * ld -m elf_i386 -T arch/x86/boot/compressed/vmlinux.lds
               |
               \->arch/x86/boot/compressed/vmlinux (1,099,538)
                  |
                  * objcopy -O binary -R .note -R .comment -S
                  |
                  \-> arch/x86/boot/vmlinux.bin (1,092,060)
                     |
                     |   + arch/x86/boot/a20.o
                     |   + arch/x86/boot/bioscall.o
                     |   + arch/x86/boot/cmdline.o
                     |   + arch/x86/boot/copy.o
                     |   + arch/x86/boot/cpu.o
                     |   + arch/x86/boot/cpucheck.o
                     |   + arch/x86/boot/early_serial_console.o
                     |   + arch/x86/boot/edd.o
                     |   + arch/x86/boot/header.o
                     |   + arch/x86/boot/main.o
                     |   + arch/x86/boot/mca.o
                     |   + arch/x86/boot/memory.o
                     |   + arch/x86/boot/pm.o
                     |   + arch/x86/boot/pmjump.o
                     |   + arch/x86/boot/printf.o
                     |   + arch/x86/boot/regs.o
                     |   + arch/x86/boot/string.o
                     |   + arch/x86/boot/tty.o
                     |   + arch/x86/boot/video.o
                     |   + arch/x86/boot/video-mode.o
                     |   + arch/x86/boot/version.o
                     |   + arch/x86/boot/video-vga.o
                     |   + arch/x86/boot/video-vesa.o
                     |   + arch/x86/boot/video-bios.o
                     |   |
                     |   * ld -m elf_i386 -T arch/x86/boot/setup.ld
                     |   |
                     |   \->arch/x86/boot/setup.elf (186,171)
                     |      |
                     |      * objcopy -O binary arch/x86/boot/setup.elf
                     |      |
                     +      \-> arch/x86/boot/setup.bin (12,604)
                     |
                     * arch/x86/boot/tools/build
                     |
                     \-> arch/x86/boot/bzImage (1,104,864)



More information about the Kernelnewbies mailing list