Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Use one of compression algorithms that you compiled in, depends on you kernel config. –  Sampo Sarrala Jul 6 '12 at 0:04

2 Answers 2

up vote 1 down vote accepted

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 make bzImage.

share|improve this answer
    
Wouldn't he want make vmlinuz, if he wants that format and not bzip2? –  Ben Voigt Jul 6 '12 at 17:15
    
vmlinuz isn'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 –  jackweirdy Jul 6 '12 at 17:22
    
vmlinuz files are what you get with make bzImage. Both the names vmlinuz and bzImage refer 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). –  Pierre Carrier Jul 6 '12 at 17:23

From the Wikipedia article on vmlinux :

Compression

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.