104

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?

4

1 Answer 1

141

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.

3
  • 1
    My undrestanding is zImage = compressed Image uImage = Image + uBoot wrapper, correct me if i 'am wrong, the uBoot wrapper contains uBoot header and extra informations such boot device load address, entry point, but i couldn't find references showing the whole format of a uImage could you please share links on that
    – Mouin
    Jul 25, 2017 at 19:54
  • Thank you for the feedback, I have found resources about uImage header format. What i didn't understand is:1- where can i find the load address (boot device load addres) and entry point in the uImage (they don't exist in the header) 2- does a zImage contains these informations (load address and entry point), these is why i'am asking about the formats of both a zImage and a uImage
    – Mouin
    Jul 25, 2017 at 21:23
  • I have asked a follow-up question
    – Mouin
    Jul 25, 2017 at 22:09

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.