In order for the Yocto build system to build a cpio image file suitable to be used as initramfs, the IMAGE_FSTYPES variable needs to be configured to one of the following: cpio.gz, cpio.tar, cpio.lz4, cpio.lzma, or cpio.xz.
On the previous image, IMAGE_FSTYPES is set to cpio.gz.uboot so that the build system generates a compressed cpio image file with the u-boot header, suitable to be loaded through the bootz u-boot command.
INITRAMFS_FSTYPES defaults to cpio.gz, and needs to be appended to support any other format.
In this recipe, we are overriding the PACKAGE_INSTALL variable with the list of packages we want to install. We also add ROOTFS_BOOTSTRAP_INSTALL, which adds the run-postinstall package so that post installation scripts are correctly run. Standard images use the core-image class and the IMAGE_INSTALL variable to add packages and features. An initramfs typically wants a hardcoded list of packages so they are added setting the PACKAGE_INSTALL variable directly.
We also empty the IMAGE_FEATURES in order not to pollute the image with features.