[lfs-chat] Initramfs (part 2)

Peng HG craftyflicker at hotmail.com
Sun Sep 4 10:57:43 PDT 2016

Initramfs is a root file system which the kernel loads into system memory when it boots up. So you have a Live environment right there. To make a LiveUSB of your freshly minted LFS, all you have to do is create a symbolic link from /init to /sbin/init, make sure none of the virtual file systems (dev, sys, proc, run) are mounted, do that cpio packaging on your entire root file system, and proceed as above (the kernel configuration should have a lot more meat than the one above of course). Best to do this like how you built LFS i.e. from a host environment, so your root file system lies dormant in the harddisk and you can proceed without worrying about the virtual file systems or other volatile files.

As explained in http://www.lightofdawn.org/blog/?viewDetailed=00128, there's a size limit for initramfs -- about 1/4 of your system RAM. That's the size limit for the entire root file system before it's packaged into the gzipped cpio, not the cpio archive file itself.

As initramfs runs off the system memory, it's transient like all purely Live environments. To have persistence, you can create a partition after the FAT32 esp, mount it (in init script), and save your persistent data in there. Maybe set your home directory to it.

I have tried this with a full-fleged BLFS file system, and it's FAST.

More information about the lfs-chat mailing list