This is a quick post to share my experience booting uncompressed Linux kernel images, during the benchmarks of kernel compression options, and no compression at all was one of these options.
It is sometimes useful to boot a kernel image with no compression. Though the kernel image is bigger, and takes more time to copy from storage to RAM, the kernel image no longer has to be decompressed to RAM. This is useful for systems with a very slow CPU, or very little RAM to store both the compressed and uncompressed images during the boot phase. The typical case is booting CPUs emulated by FPGA, during processor development, before the final silicon is out. For example, I saw a Cortex A15 chip boot at 11 MHz during Linaro Connect Q2.11 in Budapest. At this clock frequency, booting a kernel image with no compression saves several minutes of boot time, reducing development and test time. Note that with such hardware emulators, copying the kernel image to RAM is cheap, as it is done by the emulator from a file given by the user, before starting to emulate the system.
Building a kernel image with no compression on ARM is easy, but only once you know where the uncompressed image is and what to do! For people who have never done that before, I’m sharing quick instructions here.
To generate your uncompressed kernel image, all you have to do is run the usual make
command. The file that you need is arch/arm/boot/Image
.
Depending on the bootloader that you use, this could be sufficient. However, if you use U-boot, you still need to put this image in a uImage
container, to let U-boot know about details such as how big the image is, what its entry point is, whether it is compressed or not… The problem is you can’t run make uImage
any more to produce this container. That’s because Linux on ARM has no configuration option to keep the kernel uncompressed, and the uImage
file would contain a compressed kernel.
Therefore, you have to create the uImage
by invoking the mkimage
command manually. To do this without having to guess the right mkimage
parameters, I recommend to run make V=1 uImage
once:
$ make V=1 uImage ... Kernel: arch/arm/boot/zImage is ready /bin/bash /home/mike/linux/scripts/mkuboot.sh -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n 'Linux-3.3.0-rc6-00164-g4f262ac' -d arch/arm/boot/zImage arch/arm/boot/uImage Image Name: Linux-3.3.0-rc6-00164-g4f262ac Created: Thu Mar 8 13:54:00 2012 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3351272 Bytes = 3272.73 kB = 3.20 MB Load Address: 80008000 Entry Point: 80008000 Image arch/arm/boot/uImage is ready
Don’t be surprised if the above message says that the kernel is uncompressed (corresponding to -C none
). If we told U-boot that the image is already compressed, it would take care of uncompressing it to RAM before starting the kernel image.
Now, you know what mkimage
command you need to run. Just invoke this command on the Image
file instead of zImage
(you can directly replace mkuboot.sh
by mkimage
):
$ mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n 'Linux-3.3.0-rc6-00164-g4f262ac' -d arch/arm/boot/Image arch/arm/boot/uImage Image Name: Linux-3.3.0-rc6-00164-g4f262ac Created: Thu Mar 8 14:02:27 2012 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 6958068 Bytes = 6794.99 kB = 6.64 MB Load Address: 80008000 Entry Point: 80008000
Now, you can use your uImage
file as usual.