Documentation/initrd.txt update

From: Guilherme Destefani
Date: Mon Jul 03 2006 - 12:51:07 EST


The cpio initrd isn't documented in
linux-2.6.17/Documentation/initrd.txt.
(but it is in
linux-2.6.17/Documentation/filesystems/ramfs-rootfs-initramfs.txt)
initrd.txt shouldn't be updated?

Two possible updates follow, use patch -p1 inside the kernel tree.
--- linux-2.6.17.old/Documentation/initrd.txt 2006-06-17 22:49:35.000000000 -0300
+++ linux-2.6.17/Documentation/initrd.txt 2006-07-03 13:29:00.000000000 -0300
@@ -104,11 +104,13 @@
Third, you have to create the RAM disk image. This is done by creating a
file system on a block device, copying files to it as needed, and then
copying the content of the block device to the initrd file. With recent
-kernels, at least three types of devices are suitable for that:
+kernels, at least four types of devices are suitable for that:

- a floppy disk (works everywhere but it's painfully slow)
- a RAM disk (fast, but allocates physical memory)
- a loopback device (the most elegant solution)
+ - a cpio containing the initrd files, described in
+ Documentation/filesystems/ramfs-rootfs-initramfs.txt

We'll describe the loopback device method:

--- linux-2.6.17.old/Documentation/initrd.txt 2006-07-03 13:25:35.000000000 -0300
+++ linux-2.6.17/Documentation/initrd.txt 2006-07-03 13:39:54.000000000 -0300
@@ -140,6 +140,25 @@
compressed
# gzip -9 initrd

+It is also possible to use a cpio archive (instead of a file system),
+and pack all the files inside it.
+The kernel will create a ramdisk, unpack the contents of the initrd
+ and execute /init.
+
+To create such a file:
+
+ 1) Enter the directory containig the unpacked initrd files:
+ # cd /path/to/initrd
+ 2) Create the cpio file (whithout any leading path).
+ 3) Create a cpio file.
+ 4) Compress it with gzip to save space.
+ steps 2,3 and 4 can be archieved with:
+ find -printf "%P\n" |cpio -oc | gzip -9 > /full_path_to/initrd.img
+ |-------step 2------|-step 3--|------------step 4-----------------|
+
+Or use usr/gen_init_cpio
+(see Documentation/filesystems/ramfs-rootfs-initramfs.txt)
+
For experimenting with initrd, you may want to take a rescue floppy and
only add a symbolic link from /linuxrc to /bin/sh. Alternatively, you
can try the experimental newlib environment [2] to create a small