summaryrefslogtreecommitdiff
path: root/schulung_tools/notes/initrd.txt
diff options
context:
space:
mode:
Diffstat (limited to 'schulung_tools/notes/initrd.txt')
-rw-r--r--schulung_tools/notes/initrd.txt41
1 files changed, 41 insertions, 0 deletions
diff --git a/schulung_tools/notes/initrd.txt b/schulung_tools/notes/initrd.txt
new file mode 100644
index 0000000..e88b20b
--- /dev/null
+++ b/schulung_tools/notes/initrd.txt
@@ -0,0 +1,41 @@
+#
+# For both initrd variants it is assumed the root filesystem files are
+# located at /home/devel/rootfs ...
+#
+
+
+# To create the archive-based initial ramdisk:
+
+cd /home/devel/rootfs
+find . | cpio -o -H newc | gzip -9c > ../initrd.cpio.gz
+
+
+# To create the image-based initial ramdisk:
+
+dd if=/dev/zero of=initrd.img bs=4M count=1
+/sbin/mkfs.ext2 initrd.img
+sudo mount -o loop initrd.img /mnt
+sudo cp -a /home/devel/rootfs/. /mnt/
+sudo umount /mnt
+gzip -9 initrd.img
+
+
+#
+# The image-based initial ramdisk is the old way of doing things. It
+# really has no advantages. But it does have disadvantages:
+#
+# - the size if limited by the image
+# - the size is limited by the kernel configurations
+# (CONFIG_BLK_DEV_RAM, CONFIG_BLK_DEV_RAM_SIZE)
+# - the kernel root= parameter must be set to /dev/ram0
+# - the real root filesystem must unmount it after pivot_root
+# (which means the real root filesystem has knowledge of an initrd)
+#
+# The archive-based initial ramdisk has the following differences/advantages:
+#
+# - very simple to create (no root rights required!)
+# - uses exactly as much RAM as needed (grows dynamically)
+# - does not require any special boot arguments
+# - does not need to be "cleaned up" after switch_root
+# (the real root filesystem has no knowledge that an initrd existed)
+#