<code>vmlinux</code> (Virtual Memory Linux) is a statically linked executable file that contains the Linux kernel in one of the object file formats supported by Linux, which includes Executable and Linkable Format (ELF) and Common Object File Format (COFF). The <code>vmlinux</code> file might be required for kernel debugging, symbol table generation or other operations, but must be made bootable before being used as an operating system kernel by adding a multiboot header, bootsector and setup routines. <code>vmlinuz</code> is the compressed version of <code>vmlinux</code>.
Traditionally, UNIX platforms called the kernel image <code>/unix</code>. With the development of virtual memory, kernels that supported this feature were given the <code>vm</code>- prefix to differentiate them. The name <code>vmlinux</code> is a mutation of vmunix, while in <code>vmlinuz</code> the letter <code>z</code> at the end denotes that it is compressed (for example gzipped).
Traditionally, the kernel was located in the root directory of the filesystem hierarchy; however, as the bootloader must use BIOS drivers to access the hard disk, limitations on some i386 systems meant only the first 1024 cylinders of the hard disk were addressable.
To overcome this, Linux distributors encouraged users to create a partition at the beginning of their drives specifically for storing bootloader and kernel-related files. GRUB, LILO and SYSLINUX are common bootloaders.
By convention, this partition is mounted on the filesystem hierarchy as <code>/boot</code>. This was later standardised by the Filesystem Hierarchy Standard (FHS), which now requires the Linux kernel image to be located in either <code>/</code> or <code>/boot</code>, although there is no technical restriction enforcing this.
Traditionally, when creating a bootable kernel image, the kernel is also compressed using gzip, or, since Linux 2.6.30, using LZMA or bzip2, which requires a very small decompression stub to be included in the resulting image. The stub decompresses the kernel code, on some systems printing dots to the console to indicate progress, and then continues the boot process. Support for LZO, xz, LZ4 and zstd compression was added later.
The decompression routine is a negligible factor in boot time, and prior to the development of the bzImage, the size constraints of some architectures, notably i386, were extremely limiting, making compression a necessity.
On the SPARC architecture, the vmlinux file is compressed using simple gzip, because the SILO boot loader transparently decompresses gzipped images.
The filename of the bootable image is not important, but many popular distributions use vmlinuz.
As the Linux kernel matured, the size of the kernels generated by users grew beyond the limits imposed by some architectures, where the space available to store the compressed kernel code is limited. The bzImage (big zImage) format was developed to overcome this limitation by splitting the kernel over non-contiguous memory regions.
The bzImage was compressed using gzip until Linux 2.6.30, which introduced more algorithms. Although the <code>bz</code> prefix may suggest that bzip2 compression is used, this is not the case. (The bzip2 package is often distributed with tools prefixed with <code>bz</code>, such as <code>bzless</code>, <code>bzcat</code>, etc.)
The bzImage file is in a specific format. It contains concatenated <code>bootsect.o</code> + <code>setup.o</code> + <code>misc.o</code> + <code>piggy.o</code>. <code>piggy.o</code> contains the gzipped vmlinux file in its data section. The script <code>extract-vmlinux</code> found under <code>scripts/</code> in the kernel sources decompresses a kernel image. Some distributions (e.g. Red Hat and clones) may come with a <code>kernel-debuginfo</code> RPM that contains the <code>vmlinux</code> file for the matching kernel RPM, and it typically gets installed under <code>/usr/lib/debug/lib/modules/$(uname -r)/vmlinux</code> or <code>/usr/lib/debug/lib64/modules/$(uname -r)/vmlinux</code>.