How to create ZImage?

6,621

A zImage file contains a compressed Linux kernel image. If it is not available pre-built, you create it by compiling the kernel sources with make zImage. The initramfs created by mkinitcpio is a cpio archive containing the files of an initial ram filesystem that is used at startup. The kernel image and the initramfs are different things, so you can't convert the cpio archive into a zImage.

Share:
6,621

Related videos on Youtube

skap
Author by

skap

Student of Russian Southern Federal University.

Updated on September 18, 2022

Comments

  • skap
    skap almost 2 years

    Task

    I have an .img file(cpio, for initramfs). Actually, it is result of mkinitcpio. U-boot is used as a boot loader. But U-boot needs either UImage or ZImage. I need to glue U-boot with created cpio image. ZImage is preferrable as a result, because size matters.

    Question

    Is utility mkimage only able to create UImage? Is it possible to convert cpio to ZImage? How can I do it?

  • skap
    skap almost 7 years
    I should have mixed up everything. How can Early user space phase be executed when we have zImage instead of cpio?
  • Johan Myréen
    Johan Myréen almost 7 years
    They are not mutually exclusive. The bootloader typically load both zImage and the initramfs, although you can make do without the initramfs. The zImage file contains the kernel, which is started first. The kernel then uses the initramfs as an initial file system. The point of the initramfs is that you can use a generic kernel, stripped of most device drivers and file system code, which can be loaded as modules from the initramfs. If you build a custom kernel containing all the drivers you needed to boot up your hardware, it's not necessary to use an initramfs.