5

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?

1
  • Use one of compression algorithms that you compiled in, depends on you kernel config. Jul 6, 2012 at 0:04

3 Answers 3

3

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.

3
  • Wouldn't he want make vmlinuz, if he wants that format and not bzip2?
    – Ben Voigt
    Jul 6, 2012 at 17:15
  • 4
    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, 2012 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). Jul 6, 2012 at 17:23
0

According to the documentation you need to execute:

make bzImage

and then:

cp bzImage vmlinuz

to create the vmlinuz file.

-1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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