2

I'm using buildroot to generate my images and for sure there is the option of compression with the help of different methods (LZO, LZMA, gzip, ...).

So far i found these 3 compression options in buildroot (v. 2013.11):

  • Kernel compression Mode (in make linux-menuconfig)

  • Built-in initramfs compression mode (in make linux-menuconfig)

  • Compression method for the .cpio root file system ( (in make menuconfig)

my questions are:

  1. what is the difference of these modes and
  2. why am I forced to chose between 3 methods for the kernel compression, instead of leaving it uncompressed ?

greetings

3
  1. The three different options are for three different aspects of the generated Linux system, the kernel itself, the initramfs and the result file system.

    • Kernel compression Mode: this compresses the compiled kernel image. For example, on my Ubuntu 12.04 machine, the kernel is at /boot/vmlinuz-3.8.0-35-generic
    • Built-in initramfs compression mode: the compression of the initial ram filesystem image. On my machine, this would be /boot/initrd.img-3.8.0-35-generic.
    • Compression method for the .cpio root file system: This is the root / filesystem. On a desktop system, this will be usually a disk partition (ext2/3/4...), mounted read/write on /. On an embedded system, it would be a compressed .cpio archive mounted read only on / (after the boot completes).

    The Linux kernel is decompressed by the boot-loader into memory and then given control, then the kernel will mount the initial ram file system as the root fs, the initramfs will do certain tasks, including loading the real file system (the .cpio root file system) and finishing the boot process.

    The three different modes uses different compression algorithms, the different algorithms has different requirement when decompressing the data: memory usage, time to decompress (cpu usage) and the library decompression routines' size.

    So you need to choose the compression algorithms that better suits your needs and your target platform. There exists many charts that compares the requirements and the performance of different libraries (benchmarks).

  2. buildroot is usually targeted at embedded devices (as I know), the size factor is very critical in these devices, thus you usually need the initramfs, the kernel, and the root filesystem to be compressed.

    Actually, even on non embedded devices (desktop, servers...) the kernel and the initramfs are usually compressed. The pros of doing this outscores the cons.

  • 1. Maybe I was a bit too unspecific. I was think about the different kind of compression of what is gonna be compressed (by the 3 mentioned modes), less about how it's gonna be done - like is just the kernel compressed? is the whole image at once compressed, and where are the pros and cons. 2. I want to have a fast booting Linux and I believe, that if the hardware is good enough, it's the fastest way to boot the system, right? – user3085931 Feb 5 '14 at 14:54
  • I edited my answer, hope it answers your original question now. – aularon Feb 5 '14 at 15:02
  • Thanks. But what is compressed when a Kernel compression Mode is set, what is compressed by built-in initramfs compression and the rootfs compression – user3085931 Feb 5 '14 at 15:05
  • 1
    Edited again, I added three points on the three different config options. – aularon Feb 5 '14 at 15:13
  • 1
    No it won't. The three different images are separate, none of them includes the other. You can double check the result files to ensure this, decompress the rootfs and you can see that it does not include neither the kernel nor the initramfs. (Since the rootfs is a compressed filesystem it may contain the other two, which are merely just singel files compressed). – aularon Feb 5 '14 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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