Overview
A Linux system consists of various highly complex parts that all need to work together. A significant portion of the operating system consists of the boot-up sequence. One might think that its just BIOS/UEFI->Linux Kernel, however there sits something in between – the initramfs.
Initramfs is short for initial ram filesystem and is a small environment that allows the kernel to be slimmer and more flexible for any sort of case. For example, if the disk is encrypted using something like LUKS, the initramfs is responsible to ask the user for the password. Other use-cases might be environments where the root file system lives on:
- a raid device
- is on the network
- lives on a removable media
The initramfs is a special type of file system, which is called tmpfs. This is a file system that lives completely in ram/swap space and thus is deleted after system shutdown, reboot, or crash. The /tmp directory by default also is a tmpfs on distributions that use systemd. Additionally, the initramfs must be compressed as a cpio archive. This archive can be compared to tar, however it is easier to implement and more widely supported.
Helpful Websites
- https://sourcemage.org/HowTo/initramfs
- https://davidv.dev/posts/flashing-linux-disk-images-from-an-initramfs/
- https://wiki.debian.org/initramfs
- https://www.kernel.org/doc/html/latest/filesystems/ramfs-rootfs-initramfs.html
- https://wiki.gentoo.org/wiki/Initramfs/Guide
- https://wiki.gentoo.org/wiki/Tmpfs
- https://wiki.gentoo.org/wiki/PC_Boot_Process
- https://wiki.archlinux.org/title/EFI_boot_stub