5 ms·
Most modern distributions use initramfs. It usually contains a minimal shell and set of command-line tools (often Busybox-based). In most distributions, initr
by csense 14y ago
Most modern distributions use initramfs. It usually contains a minimal shell and set of command-line tools (often Busybox-based).
In most distributions, initramfs's main responsibility is to figure out where the OS the user wants to run is installed, mount it, and hand off PID #1 to the init binary in the mounted FS.
The reason initramfs exists is to allow the logic to do this to be part of the distribution, not the kernel. That way, distributions can have arbitrarily complicated procedures for accomplishing the above tasks. Or even deviate from the standard "find, mount, exec" pattern described above entirely: For example, if you're creating a simple embedded system where space is at a premium and your system will only ever execute one program, you might be able to save some space by statically linking the program and saving it as 'init' in your initramfs. If you compile your own kernel, there's even an option to meld the kernel and initramfs into a single file.
On Ubuntu- (and AFAIK most Debian-like systems), a set of scripts in the initramfs-tools package is used to rebuild the initramfs when a new kernel version is installed, or manually upon user request. (The most common reason for manually running update-initramfs is adding kernel modules for drivers that are necessary to access the filesystem you want to use as root, e.g. LVM or NFS.)