diff options
| author | John Ogness <john.ogness@linutronix.de> | 2019-02-28 16:23:38 +0106 |
|---|---|---|
| committer | John Ogness <john.ogness@linutronix.de> | 2019-02-28 16:23:38 +0106 |
| commit | 6b8e3545c3d46a72e0ebd0f0cc53841e26ceee25 (patch) | |
| tree | 8c4c181c4ce788b91cbf78ec70dc0380cabcd5e4 | |
| parent | b3d61a1713af1c715ff92cb33e0b3e91f3a9213a (diff) | |
notes: initrd.txt: add information about initrd vs initramfs
There are some big differences between initrd and initramfs. This
text document lists them and the advantages/disadvantages.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
| -rw-r--r-- | schulung_tools/notes/initrd.txt | 41 |
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) +# |
