Introduction
A boot loader starts Linux by loading one file into memory and jumping to it. That file is a boot image, and
what it looks like depends on the processor and on the loader. None of these files has an extension that tells you what it is:
the ones on a Raspberry Pi boot partition are kernel8.img and kernel7.img, and elsewhere you find
Image, zImage and uImage. What identifies each is a magic number at a fixed place
in its header, so the explorer looks there, and a file with no extension, or with .img, is recognised by it.
The formats
| Format | Magic | What it is |
|---|---|---|
| ARM64 Image | ARM\x64 at offset 56 | The uncompressed 64-bit ARM kernel with a 64-byte header. kernel8.img on a 64-bit Raspberry Pi, after the firmware has unpacked it, is one. |
| ARM zImage | 0x016F2818 at offset 0x24 | A self-extracting 32-bit ARM kernel: a stub followed by the compressed kernel. kernel7.img and kernel.img on a Raspberry Pi. |
| U-Boot uImage | 0x27051956 at offset 0 | A 64-byte header made by mkimage in front of any file: a kernel, a RAM disk, a devicetree. |
| RISC-V Image | RSC\x05 at offset 56 | The 64-byte header of the RISC-V Linux kernel, laid out like the ARM64 one. |
| FIT image | 0xD00DFEED at offset 0, with /images and /configurations nodes | U-Boot’s newer image format: a devicetree blob that holds the kernel, devicetree and RAM disk as properties, with hashes. .itb. |
A .gz kernel (Image.gz) is a gzip file: the explorer unpacks it and reads the result as one of the four. A
kernel for another processor (an x86 bzImage) is not among them.
In the explorer
Each viewer shows the header field by field with its checks, and, for the processors it has a disassembler for, the first bytes of the code: the ARM64 Image with the AArch64 decoder, the zImage with the ARM decoder (ARMv7-A by default, with a choice of ARM or Thumb-2 and of architecture), the RISC-V Image with the RISC-V decoder (RV64GC by default, with a choice). The rest of a kernel is not explained: it is code and data mixed, and the viewers do not name its functions. A uImage opens its data as a file of its own, and checks both CRC-32 values.
Also used for
- GEM Image – GEM desktop bitmaps for PC and Atari ST: a word header and run-length planes.
- Raw disk image – A disk or memory card copied byte for byte, with no header.
Not described
Known, not yet covered
- Reference and viewer: the Android
boot.img(magicANDROID!), the x86bzImageandvmlinuzand the Raspberry Pi boot partition files other than the kernels are not covered here. - Viewer: the compressed kernel inside a zImage is not unpacked: the format does not say where it starts.
Unknown
- Reference: the Raspberry Pi firmware files
bootcode.bin,start4.elfandfixup4.dathave no public format description that we have found;start4.elfis an ELF file and opens as one.
Links
Software
Reference
- Booting AArch64 Linux – the ARM64 Image header
- Booting ARM Linux – how a boot loader starts a zImage
- Boot image header in RISC-V Linux
- U-Boot include/image.h – the uImage header and its code tables