Skip to contentSkip to conversation

Documentation/initrd.txt update

PATCH Guilherme Destefani 2 participants 2 messages Jul 3, 2006 Documentation

lore
Share & tools
lore
#0 lore raw

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.

Documentation/initrd.txt +3 -1
@@ -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:
 
Documentation/initrd.txt +19 -0
@@ -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
#1 lore raw
Quoted 7 lines · Guilherme Destefani

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.

... and both are wrong.

initramfs != initrd, plus you specified -c to cpio, which is wrong (-H newc is correct).

You have to account for the differences between initramfs and initrd, e.g. no pivot_root in initramfs.

-hpa