The Linux initramfs is a small root filesystem loaded into memory in order to facilitate the loading of the runtime root filesystem. It allows programs to run before mounting the root filesystem. For example, it is used for filesystem or partition encryption (e.g. dm-verity), to load a subset of kernel modules that are necessary to boot, verify the integrity of the root filesystem, a shell to debug mounting the runtime root filesystem, LVM/software RAID, overlayfs, etc.
There is a very interesting overlap with embedded root filesystem tools like Buildroot and Yocto, which are designed to generate runtime root filesystems.
Just like original SysVinit that consisted of shell scripts, building the initrd and later initramfs, was a cumbersome process. Red Hat developed dracut to formalize this process, but it also proved to be “complicated and inefficient.12
Just as systemd became the /init
(among many other
responsibilities) on all popular Linux distributions, it is also
attempting to improve the initramfs tooling being used by distributions.
mkosi
leverages the distribution packaging tooling to do
this.
This requires package maintainers (typically core packages) to support initramfs, which may require splitting up packages to consist of a smaller package that is targeted for the initramfs and another for the runtime root filesystem.
So, our idea is that the initramfs is not really any different from a regular Linux image it is just packaged differently
The same could be true for embedded systems, except a bit more care is required when considering the hardware.
It was originally targeting Fedora, but when
mkosi-initrd
was merged into mkosi
support was
added for all the major distributions.