zupazt3
zupazt3

Reputation: 1046

Buildroot doesn't generate compressed Kernel image

I've successfully used buildroot (v. 2019.05) to built u-boot and Kernel and was able to boot it together.

The problem is that, even though I selected Kernel compression mode to gzip, all I get is the uncompressed Image file.

In the output directory (and Linux as well) there is only Image file, while there should be Image.gz.

How to generate Image.gz from / instead of Image?

Upvotes: 2

Views: 5464

Answers (3)

Arnout
Arnout

Reputation: 3464

On arm64, Linux does not support self-extracting compression. It relies on the boot loader to do that.

The Linux build system does have an Image.gz (and Image.bz2 etc.) target, but it does nothing more than calling gzip on Image (compare this with zImage, which adds a self-extractor).

Since it is easy to do the compression outside of the kernel build system, and since there are so many different compressors possible, Buildroot doesn't provide options for them. However, it is possible to select a custom image name (BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM) and then set BR2_LINUX_KERNEL_IMAGE_TARGET_NAME to Image.gz. Alternatively, you can do the compression in a post-build script.

Remember to make sure that the bootloader is able to decompress with that algorithm.

Upvotes: 8

Toto
Toto

Reputation: 89

In buildroot, besides selecting the compression mechanism you can also select the output format for the kernel image (uImage, zImage, vmlinux ...).

You should find on of those in your output/images/ or in the build directory of your kernel.

When using U-boot you probably want to use the uImage or the zImage. See this question. Both of them will be compressed if selected in the kernel configuration (CONFIG_KERNEL_GZIP).

During boot the uncompressed size of the kernel is logged in the beginning. You can compare it to the size on your filesystem.

## Booting kernel from Legacy Image at 10000000 ...
   Image Name:   Linux-4.14.73-ltsi
   Created:      2019-05-14  11:55:16 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4684016 Bytes = 4.5 MiB
   Load Address: 00008000
   Entry Point:  00008000
...

Upvotes: 1

Bora
Bora

Reputation: 496

According to the Linux package configuration tool:

This selection will just ensure that the correct host tools are built. The actual compression for the kernel should be selected in the kernel configuration menu.

Make sure you select the compression option using make linux-menuconfig too.

Upvotes: 2

Related Questions