How to generate an initrd image with Yocto

From KoanSoftware Wiki
Jump to: navigation, search

How to generate an initramf image with Yocto

To build an initramfs, you only need to specify the initramfs image name (e.g., INITRAMFS_IMAGE) and its type (e.g., INITRAMFS_FSTYPES).

 INITRAMFS_IMAGE = "core-image-tiny-initramfs"
 INITRAMFS_FSTYPES = "cpio.gz"

Moreover, the kernel requires these features to load and uncompress the initramfs:

 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_RD_GZIP=y
 CONFIG_DECOMPRESS_GZIP=y

In addition if you want the initramfs to be packaged into the kernel binary instead of being a separate binary (or a different image node of a kernel fitimage) use this setting:

 INITRAMFS_IMAGE_BUNDLE = "1"