summaryrefslogtreecommitdiff
path: root/schulung_tools/notes/initrd.txt
blob: e88b20b3534f30503e603e3fc2321fab2d4e90ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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)
#