The initramfs is automatically generated by the kernel build process. Create your specification file and set the kernel option CONFIG_INITRAMFS_SOURCE=
to the location of your file. The creation of the initramfs is explained in the kernel documentation, read ramfs-rootfs-initramfs.txt.
Also, do i need to generate an external file list for it to boot from initramfs properly?
Several methods exist to create and use an initramfs.
Finally, you may eventually extract the archive initramfs_data.cpio.gz
located in the usr
directory of the kernel sources, to check its contents. It is mentioned in the documentation.
Example
prompt% mkdir -pv /usr/src/initramfs
prompt% nano /usr/src/initramfs/initramfs_list
prompt% cd /usr/src/linux
prompt% make menuconfig
# CONFIG_INITRAMFS_SOURCE=/usr/src/initramfs/initramfs_list
prompt% make && make modules_install
prompt% ls usr/
built-in.o gen_init_cpio initramfs_data.cpio.gz initramfs_data.o modules.builtin modules.order
prompt% mkdir -v /tmp/initramfs/
prompt% cp -v usr/initramfs_data.cpio.gz /tmp/initramfs
prompt% cd /tmp/initramfs/
prompt% cpio -i -d -H newc -F initramfs_data.cpio --no-absolute-filenames
prompt% ls
After rebuilding and rebooting, the message does not appear, and it's presumably not booting from initramfs.
Note that an initramfs must include a valid init.
update-initramfs
at kernel package installation time.update-initramfs
is similar in concept to thedracut
tool mentioned in the Gentoo tutorial you linked. If you choose to use Gentoo-style initramfs embedded in the kernel file, you should probably remove anyinitrd
boot options from GRUB, as those will probably override the in-kernel initramfs. – telcoM Jul 10 '18 at 05:14