Linux Kernel image in different forms

Linux kernel presents in different forms depending on the actual context.

linux kernel image

vmlinux

vmlinux, the name comes from the fact that “linux” supports virtual memory. It is typically in ELF format, created by linker. This file is needed when debugging kernel. In order to boot linux kernel, vmlinux image has to be transformed into different from based on processor type.

vmlinux.bin

this is binary form of kernel image, which is created by using objdump from vmlinux image.

bzImage

This is bootable image for x86 processor. The following picture well describe the actaul content of bzImage.

linux kernel bzImage

It contains concatenated bootsect.o + setup.o + misc.o + piggy.o

uImage

This is bootable image for a processor, which uses u-boot as bootloader. THe processors are like ARM (32-bit), PowerPC, MIPS. There is a utility tool “mkimage” to transform vmlinux into uImage. The uImage has the following header in the beginning of image.

typedef struct uimage_header {
    uint32_t    ih_magic;           /* Image Header Magic Number (BE) */
    uint32_t    ih_hcrc;            /* Image Header CRC Checksum (BE) */
    uint32_t    ih_time;            /* Image Creation Timestamp (BE) */
    uint32_t    ih_size;            /* Image Data Size (BE) */
    uint32_t    ih_load;            /* Data  Load  Address (BE) */
    uint32_t    ih_ep;              /* Entry Point Address (BE) */
    uint32_t    ih_dcrc;            /* Image Data CRC Checksum (BE) */
    uint8_t     ih_os;              /* Operating System     */
    uint8_t     ih_arch;            /* CPU architecture     */
    uint8_t     ih_type;            /* Image Type           */
    uint8_t     ih_comp;            /* Compression Type     */
    uint8_t     ih_name[IH_NMLEN];  /* Image Name       */
} uimage_header_t;

Image

This a relatively new format for ARMV8 64-bit processor. It can also created by using “mkimage” tool.

typedef struct arm64_image_header {
    uint32_t ih_code0;			/* Executable code */
    uint32_t ih_code1;			/* Executable code */
    uint64_t ih_text_offset;		/* Image load offset, little endian */
    uint64_t ih_image_size;		/* Effective Image size, little endian */
    uint64_t ih_flags;			/* kernel flags, little endian */
    uint64_t res2;		        /* reserved */
    uint64_t res3;		        /* reserved */
    uint64_t res4;		        /* reserved */
    uint32_t ih_magic;	                /* 0x644d5241 Magic number, little endian, "ARM\x64" */
    uint32_t res5;			/* reserved (used for PE COFF offset) */
} arm64_image_header_t;