Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image vs zImage vs uImage

What is the difference between them?

I know that u-boot needs a kernel in uImage format.

The system I use first boots from stage 1 loader and then it calls u-boot. I want to discard u-boot and directly boot from stage 1 loader. Which type of kernel image do I have to use?

like image 470
yildizabdullah Avatar asked Mar 11 '14 10:03

yildizabdullah


People also ask

What is zImage and uImage?

zImage: a compressed version of the Linux kernel image that is self-extracting. uImage: an image file that has a U-Boot wrapper (installed by the mkimage utility) that includes the OS type and loader information. A very common practice (e.g. the typical Linux kernel Makefile) is to use a zImage file.

Is zImage uncompressed kernel image?

The zImage or uImage files that you are using are compressed kernel images.

What is image UB?

Image.ub : Contains compressed kernel and device tree. ● petalinux-build command uses BitBake to build the output products ● BitBake is a core component of the Yocto Project and is used by the OpenEmbedded build system to build images.

What is a fit image?

The FIT image is a placeholder that has the zImage and the base Device Tree, plus additional overlays that can be selected at boot time. The following steps are required to boot the FIT Image from U-boot: Load the FIT image like you would normally load the uImage or zImage.


1 Answers

What is the difference between them?

Image: the generic Linux kernel binary image file.

zImage: a compressed version of the Linux kernel image that is self-extracting.

uImage: an image file that has a U-Boot wrapper (installed by the mkimage utility) that includes the OS type and loader information.
A very common practice (e.g. the typical Linux kernel Makefile) is to use a zImage file. Since a zImage file is self-extracting (i.e. needs no external decompressors), the wrapper would indicate that this kernel is "not compressed" even though it actually is.


Note that the author/maintainer of U-Boot considers the (widespread) use of using a zImage inside a uImage questionable:

Actually it's pretty stupid to use a zImage inside an uImage. It is much better to use normal (uncompressed) kernel image, compress it using just gzip, and use this as poayload for mkimage. This way U-Boot does the uncompresiong instead of including yet another uncompressor with each kernel image.

(quoted from https://lists.yoctoproject.org/pipermail/yocto/2013-October/016778.html)


Which type of kernel image do I have to use?

You could choose whatever you want to program for.
For economy of storage, you should probably chose a compressed image over the uncompressed one.
Beware that executing the kernel (presumably the Linux kernel) involves more than just loading the kernel image into memory. Depending on the architecture (e.g. ARM) and the Linux kernel version (e.g. with or without DTB), there are registers and memory buffers that may have to be prepared for the kernel. In one instance there was also hardware initialization that U-Boot performed that had to be replicated.

ADDENDUM

I know that u-boot needs a kernel in uImage format.

That is accurate for all versions of U-Boot which only have the bootm command.
But more recent versions of U-Boot could also have the bootz command that can boot a zImage.

like image 91
sawdust Avatar answered Sep 21 '22 18:09

sawdust