All 2.6 Linux kernels contain a ["gzip"]ped "cpio" format archive, which is extracted into rootfs when the kernel boots up. The kernel then checks to see if ["rootfs"] now contains a file "init", and if so it executes it as PID 1.

At this point, this init process is responsible for bringing the system the rest of the way up, including locating and mounting the real root device (if any). If rootfs does not contain an init program after the embedded cpio archive is extracted into it, the kernel will fall through to the older code to locate and mount a root partition, then exec some variant of /sbin/init out of that.

All this differs from the old initrd in several ways:

One advantage of the text file is that root access is not required to +set permissions or create device nodes in a directory. (Note that those two example "file" entries expect to find files Named "init.sh" and "busybox" in a directory called "initramfs", under the linux-2.6.* directory. See Documentation/early-userspace/README for more details.)

If you don't already understand what shared libraries, devices, and paths you need to get a minimal root filesystem up and running, here are some references:

The ["klibc"] package (http://www.kernel.org/pub/linux/libs/klibc) is designed to be a tiny C library to statically link early userspace code against, along with some related utilities. One can use ["uClibc"] and ["busybox"]. (In theory you could use ["glibc"], but that's not well suited for small embedded usage. Also note that glibc dlopens libnss to do name lookups, even when otherwise statically linked.)

diff -ru old/Documentation/initrd.txt new/Documentation/initrd.txt --- old/Documentation/initrd.txt 2005-09-09 21:42:58.000000000 -0500 +++ new/Documentation/initrd.txt 2005-10-17 22:38:41.447859392 -0500 @@ -1,3 +1,6 @@

NOTE: New systems should probably be using initramfs instead of initrd. See Documentation/filesystems/ramfs-rootfs-initramfs.txt for details.

CategoryKernel