Contents
What is initramfs and initrd?
Both initrd and ramfs are zipped at compile time, but the difference is, initrd is a block device unpacked to be mounted by the kernel at booting, while ramfs is unpacked via cpio into memory.
What does initrd do in Linux?
Init is the parent of all processes, executed by the kernel during the booting of a system. Its principle role is to create processes from a script stored in the file /etc/inittab. It usually has entries which cause init to spawn gettys on each line that users can log in.
What is initrd and Vmlinuz in Linux?
vmlinuz is the name of the Linux kernel executable. vmlinux is generally just an intermediate step to producing vmlinuz. initrd: The initial RAM disk (initrd) is an initial root file system that is mounted prior to when the real rootfile system is available.
Where to find initrd and initramfs in Linux?
There’s a lengthy explanation in the kernel source tree in the file Documentation/filesystems/ramfs-rootfs-initramfs.txt, but I’ll try to simplify that just a bit. In a nutshell, when your bootloader (GRUB?) loads your Linux kernel, it is of course the kernel’s job to finish the boot process.
How does the Linux kernel autodetect initramfs?
In this case, the kernel will autodetect the type (initramfs, not initrd) and extract the external cpio archive into rootfs before trying to run /init.
How does the kernel free memory when using initrd?
When using initrd, the system typically boots as follows: the kernel converts initrd into a “normal” RAM disk and frees the memory used by initrd if the root device is not /dev/ram0, the old (deprecated) change_root procedure is followed. see the “Obsolete root change mechanism” section below.
Which is better ramfs or initramfs in Linux?
This has the memory efficiency advantages of initramfs (no ramdisk block device) but the separate packaging of initrd (which is nice if you have non-GPL code you’d like to run from initramfs, without conflating it with the GPL licensed Linux kernel binary). It can also be used to supplement the kernel’s built-in initramfs image.