I found this simple example of an initramfs from the Gentoo Wiki:
#!/bin/busybox sh # Mount the /proc and /sys filesystems. mount -t proc none /proc mount -t sysfs none /sys # Do your stuff here. echo "This script just mounts and boots the rootfs, nothing else!" # Mount the root filesystem. mount -o ro /dev/sda1 /mnt/root # Clean up. umount /proc umount /sys # Boot the real thing. exec switch_root /mnt/root /sbin/init
/sys. At the end, before
switch_root, it unmounts them. However, in
man switch_root I read:
switch_root moves already mounted /proc, /dev, /sys and /run to newroot and makes newroot the new root filesystem and starts init process
- Why does this initramfs example unmount
switch_rootis supposed to move them?
sysfsis mounted to
/sys; where did
sysfscome from and why is it named different?
- I have seen an example with
/dev, so how do I know which directories to mount?