xmas

Deutsche Fassung (mit etwas mehr Kram)

All patches/scripts/programs on this page except atc.tar.gz are published under the GPL.

tmpfs+tar as replacement for initrd

Since introduction of tmpfs into the linux kernel, the initrd stuff (including normal ramdisks) is not only bloated but highly obsolete. The idea is to mount an empty tmpfs as root, extract an (optionally compressed) tar image (passed to the kernel by the same mechanism as currently the initrd), and launch /sbin/init. The remaining boot sequeence (BOOTP/DHCP loopups, NFS mounts or just mounting the normal root filesystem) could be done in userspace, by scipts and/or programs from the tar image.

The next steps would be:

Here's the patch for linux-2.4.26: patch-2.4.26-inittar.bz2, (Changelog). Most of the changes required for the step from 2.4.18 to 2.4.19 are from David L. Parsley. Compared with older releases, the patch is much smaller, but the splitup of rd.c has gone. This means that you will have also the classical ramdisk and initrd code in your kernel.

To activate tmpfs+inittar, build the kernel with CONFIG_BLK_DEV_RAM, CONFIG_BLK_DEV_INITRD, CONFIG_TMPFS and CONFIG_TMPFS_INITTAR enaabled. Instead of passing an initrd, the bootloader should pass an optionally compressed tar file. When booting, the kernel first looks for a (compressed) tar file. If none is found, the kernel falls back to the usual initrd code. You can pass options to the tmpfs mount by giving the kernel an "inittar=tmpfs-options" command line parameter.

Ian McDonnel submitted a patch for the 2.6 kernel. Many thanks to Ian for this. Please note that this patch only supports gzip-compressed images. linux-2.6.10-inittar-p0.patch.bz2

Who likes to play atc(6) can use atc.tar.gz as an example of an inittar. Another example is my setup for discless clients (text only available in german but the scripts are commented in english). This setup can of course be used together with tmpfs+inittar or with an initrd.

A more complex script for mounting a "normal" filesystem on a harddisk or floppy is shown in rdinit-0.9.1. This script, installed as /sbin/init on an inittar (or initrd), together with other required programs (a shell, some other standard programs, mount, pivot_root) checks for the device to be mounted as root by looking at /proc/sys/kernel/real-root-dev. It mounts this filesystem and does the usual pivot_root(8)/chroot(8) logic. For a cut-down kernel (with mandatory tmpfs+inittar), the kernel won't evaluate a commandline option "root=...", so the could use $root instead of real-root-dev. Note that, for a real production version, the script should be replaced by a small program written in C and either statically linked against some small libc (as uClibc) or directly using syscalls. The current solution (a shell script and all those tools) is still too big to be accepted by the people.

New: inittar and bzip2 compression.

Due to a suggestion of Niklas Brunbäck I merged Christian Ludwig's wonderfull bzip2 patch (see http://shepard.kicks-ass.net/~cc/) and inittar. Now it is possible to boot a bzip2 compressed kernel that loads a bzip2 compressed tar file. To build a kernel with both inittar and bzip2 support, follow these steps:

Note: sometimes I'm too lazy to update this page, so you should look at the directory containing all patches for newer versions.

Inittar announcement mailinglist:

There's also a mailinglist for announcements of new inittar patches. If there's enough feedback, I can also reconfigure this list to be open for discussions about inittar. To subscribe, send a mail to <inittar-request@outback.escape.de> with "subscribe" in the subject.


kili@outback.escape.de