# Vmlinux

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Vmlinux
> Markdown URL: https://mediated.wiki/source/Vmlinux.md
> Source: https://en.wikipedia.org/wiki/Vmlinux
> Source revision: 1337977769
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Executable file containing the Linux kernel}}
{{lowercase title}}
{{Refimprove|date=April 2012}}

right|thumb|Linux kernel boot and decompression process

'''<code>vmlinux</code>''' (Virtual Memory Linux) is a [statically linked](/source/static_library) [executable](/source/executable) file that contains the [Linux kernel](/source/Linux_kernel) in one of the [object file](/source/object_file) formats supported by Linux, which includes [Executable and Linkable Format](/source/Executable_and_Linkable_Format) (ELF) and [Common Object File Format](/source/Common_Object_File_Format) (COFF). The <code>vmlinux</code> file might be required for kernel [debugging](/source/debugging), [symbol table](/source/symbol_table) generation or other operations, but must be made bootable before being used as an [operating system kernel](/source/operating_system_kernel) by adding a [multiboot](/source/Multiboot_Specification) header, [bootsector](/source/bootsector) and setup routines. '''<code>vmlinuz</code>''' is the compressed version of <code>vmlinux</code>.

==Etymology==
Traditionally, [UNIX](/source/UNIX) platforms called the kernel image <code>/unix</code>. With the development of [virtual memory](/source/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](/source/vmunix), while in <code>vmlinuz</code> the letter <code>z</code> at the end denotes that it is compressed (for example [gzip](/source/gzip)ped).<ref name="linfo">{{cite web
 | url         = http://www.linfo.org/vmlinuz.html
 | website     = www.linfo.org
 | date        = March 29, 2005
 | publisher   = Bellevue Linux
 | access-date = 2015-06-21
 | title       = vmlinuz Definition}}</ref>

==Location==
Traditionally, the kernel was located in the [root directory](/source/root_directory) of the filesystem hierarchy; however, as the [bootloader](/source/bootloader) must use [BIOS](/source/BIOS) drivers to access the [hard disk](/source/hard_disk), limitations on some [i386](/source/i386) systems meant only the [first 1024 cylinders](/source/cylinder_1024) of the hard disk were addressable.

To overcome this, Linux distributors encouraged users to create a [partition](/source/disk_partitioning) at the beginning of their drives specifically for storing bootloader and kernel-related files. [GRUB](/source/GRUB), [LILO](/source/LILO_(boot_loader)) and [SYSLINUX](/source/SYSLINUX) are common bootloaders.

By convention, this partition is [mount](/source/mount_(computing))ed on the filesystem hierarchy as <code>/boot</code>. This was later standardised by the [Filesystem Hierarchy Standard](/source/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.<ref>{{cite book
 | chapter    = Section 3.5.2 — /boot : Static files of the boot loader
 | title      = FHS 2.3
 | date       = 2004-01-29
 | access-date = 2014-03-11
 | url        = http://www.pathname.com/fhs/pub/fhs-2.3.html#BOOTSTATICFILESOFTHEBOOTLOADER
 | quote      = The operating system kernel must be located in either / or /boot.}}</ref>

==Compression==
Traditionally, when creating a bootable [kernel image](/source/Kernel_(operating_system)), the kernel is also [compressed](/source/data_compression) using [gzip](/source/gzip), or, since Linux 2.6.30,<ref name="linux-2.6.30_compression">Linux 2.6.30, released the 9th of June 2009, added support to compress the kernel image with the LZMA and bzip2 algorithms [https://kernelnewbies.org/Linux_2_6_30#head-5773b3b80a9c48eca5aae1e45561f9237d493ae1]</ref> using [LZMA](/source/LZMA) or [bzip2](/source/bzip2), which requires a very small [decompression](/source/data_compression) 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](/source/Lempel%E2%80%93Ziv%E2%80%93Oberhumer),<ref>Linux 2.6.33, released on February 24, 2010, added support to compress the kernel image with LZO [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7dd65feb6c603e13eba501c34c662259ab38e70e]</ref> [xz](/source/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm),<ref>Linux 2.6.38, released on March 14, 2011, added support to compress the kernel image with xz [https://kernelnewbies.org/Linux_2_6_38#Core]</ref> [LZ4](/source/LZ4_(compression_algorithm))<ref>Linux 3.11, released on September 2, 2013, added support to compress the kernel image with LZ4 [https://kernelnewbies.org/Linux_3.11#Core]</ref> and [zstd](/source/zstd)<ref>Linux 5.9, released on October 11, 2020, added support to compress the kernel image, [initrd](/source/initrd) and [initramfs](/source/initramfs) with zstd [https://kernelnewbies.org/Linux_5.9#Support_for_ZSTD_compressed_kernel.2C_ramdisk_and_initramfs]</ref> 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](/source/SPARC) architecture, the vmlinux file is compressed using simple [gzip](/source/gzip), because the [SILO](/source/SILO_(boot_loader)) boot loader transparently decompresses gzipped images.

<!-- which convention!? rather "often" or "usually" but there's no convention... -->
The filename of the bootable image is not important, but many popular distributions use ''vmlinuz''.

==bzImage==
thumb|Anatomy of a bzImage

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](/source/computer_storage) regions.<ref>{{Cite web |last=Rubini |first=Alessandro |date=June 1997 |title=Booting the Kernel |url=https://www.linux.it/~rubini/docs/boot/boot.html |access-date=2025-08-26 |website=www.linux.it}}</ref>

The bzImage was compressed using [gzip](/source/gzip) until Linux 2.6.30,<ref name="linux-2.6.30_compression" /> which introduced more algorithms. Although the <code>bz</code> [prefix](/source/prefix_(linguistics)) may suggest that [bzip2](/source/bzip2) compression is used, this is not the case.<ref name="linfo"/> (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>.<ref>{{cite mailing list
 | url         = https://lkml.org/lkml/1999/9/28/29
 | title       = Re: bzImage decompression
 | date        = 1999-09-28
 | mailing-list = [LKML](/source/Linux_kernel_mailing_list)
 | author      = Yann Droneaud
 | quote       = The zImage contain bootsect.o + setup.o + misc.o + piggy.o}}</ref> <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](/source/Red_Hat) and clones) may come with a <code>kernel-debuginfo</code> [RPM](/source/RPM_Package_Manager) 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>.

==See also==
{{Portal|Linux}}
* [Booting process of Linux](/source/Booting_process_of_Linux)
* [Linux kernel](/source/Linux_kernel)
* [Module (Linux)](/source/Module_(Linux))
* [initrd](/source/initrd)
* [System.map](/source/System.map)
* [Object file](/source/Object_file)

==Notes and references==
{{Reflist}}

==Further reading==
* {{cite book
 |chapter      = 10. Kernel Files Information
 |author       = Alavoor Vasudevan
 |date         = 2003-08-15
 |title        = The Linux Kernel HOWTO
 |url          = http://oss.sgi.com/LDP/HOWTO/Kernel-HOWTO/kernel_files_info.html
 |access-date  = 2014-03-11
 |archive-date = 2017-10-10
 |archive-url  = https://web.archive.org/web/20171010203604/http://oss.sgi.com/LDP/HOWTO/Kernel-HOWTO/kernel_files_info.html
 |url-status   = dead
}}
* {{cite journal
 | author  = Daniel Pierre Bovet
 | date    = 2013-01-03
 | title   = Special sections in Linux binaries
 | url     = https://lwn.net/Articles/531148/
 | journal = [LWN.net](/source/LWN.net)
 | quote   = all special sections appearing in the Linux kernel end up packed in one of the segments defined in the vmlinux ELF header. Each special section fulfills a particular purpose.}}

==External links==
* [http://www.faqs.org/docs/kernel_2_4/lki-1.html Boot process]

{{Linux kernel}}

Category:Linux kernel

---
Adapted from the Wikipedia article [Vmlinux](https://en.wikipedia.org/wiki/Vmlinux) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Vmlinux?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
