What is initramfs and when do you need it?
initramfs (initial RAM filesystem) is a small temporary root filesystem that the kernel loads into RAM before mounting the real root filesystem. It is a gzip-compressed cpio archive that the bootloader places in memory alongside the kernel. The kernel unpacks it, mounts it as the initial root, and runs its /init script.
You need initramfs when the real root filesystem cannot be mounted directly by the kernel at boot time. Common scenarios include: the root filesystem is on an encrypted partition and the kernel must run userspace tools to unlock it; the root is on a network filesystem (NFS) and networking must be configured first; the root is on a complex storage setup (LVM, software RAID) requiring userspace utilities; or the root filesystem type requires a kernel module that is not built-in.
In many embedded systems, initramfs is unnecessary because the root filesystem is on a simple block device (eMMC partition, SD card) with a built-in filesystem driver. Skipping initramfs saves boot time — typically 100-300 ms — and reduces image size. However, some embedded products use initramfs as the only root filesystem (never switching to a block device), keeping the entire system in RAM for reliability. This approach avoids flash wear and filesystem corruption from unexpected power loss, at the cost of consuming DRAM for the entire filesystem.
Source: Embedded Linux Q&A
