Creating a boot initramfs
An initial RAM filesystem, or initramfs
, is a compressed cpio
archive. cpio
is an old Unix archive format, similar to TAR and ZIP but easier to decode and so requiring less code in the kernel. You need to configure your kernel with CONFIG_BLK_DEV_INITRD
to support initramfs
.
As it happens, there are three different ways to create a boot ramdisk: as a standalone cpio
archive, as a cpio
archive embedded in the kernel image, and as a device table that the kernel build system processes as part of the build. The first option gives the most flexibility because we can mix and match kernels and ramdisks to our heart's content. However, it means that you have two files to deal with instead of one, and not all bootloaders have the facility to load a separate ramdisk. I will show you how to build one into the kernel later.
Standalone initramfs
The following sequence of instructions creates the archive, compresses it, and adds a U-Boot header ready for loading...