The question is pretty much summed up by the title - I've just built a kernel which has generated the vmlinux output file. How do I compress this into a vmlinuz image?
Use one of compression algorithms that you compiled in, depends on you kernel config.– Sampo Sarrala - codidact.orgJul 6, 2012 at 0:04
Compression is a compile-time option.
The process is quite tricky, as the resulting file will start with native code that decompresses the rest of the kernel and jumps there.
So there's no straightforward way, and nobody ever spent the time to implement recompression (at least as far as I know) as it's simple enough to recompile.
In conclusion, you'll have to use
Wouldn't he want
make vmlinuz, if he wants that format and not bzip2? Jul 6, 2012 at 17:15
vmlinuzisn't a make option - also, bzImage doesn't mean its compressed with bzip - it's shorthand for big zimage where z means zipped; see en.wikipedia.org/wiki/Vmlinux#bzImage Jul 6, 2012 at 17:22
vmlinuzfiles are what you get with
make bzImage. Both the names
bzImagerefer to a compressed kernel, and do not relate to a specific compression algorithm (no, don't try to deduce anything from the prefix or suffix). Jul 6, 2012 at 17:23
According to the documentation you need to execute:
cp bzImage vmlinuz
to create the
From the Wikipedia article on vmlinux :
Traditionally, when creating a bootable kernel image, the kernel is also compressed using the zlib algorithm, 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.
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 by convention it is called vmlinuz or zImage.
So depending on which architecture you are running on, and which Linux version, the answer will vary.
The best way is to let the kernel build process compress it for you.