# # 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 # (an initrd is the root filesystem, i.e. /sbin/init is called) # - 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) # - the kernel calls /init instead of /sbin/init # - /dev/console is required if replacing the built-in initramfs #