启动执行流程
initrd和 initramfs 中的文件 在系统启动的时候被执行
此两者二者只可取其一或取0
initrd执行流程在内核流程上要早于initramfs.
也就是 1 2 只可取其一或取0,在整个内核流程上如下:
...
initrd执行流程 --- 1
...
initramfs执行流程 --- 2
initrd执行流程
/linuxrc
mount -t proc proc /proc
mount -t sysfs sysfs /sys
insmod xxx
insmod yyy
mdev -s
initramfs执行流程
/init
mount -t proc proc /proc
mount -t sysfs sysfs /sys
insmod xxx
insmod yyy
mdev -s
mount /dev/xxx /mnt
exec switch_root /mnt /sbin/init
文件系统中的文件
最少组成
initrd和 initramfs 里面有一些文件,也可以为空
如果 kernel 中有所有板子或者pc的驱动,那么 initrd和 initramfs 中的文件为空也可以.
通常组成
/dev/null : mknod -m 666 null c 1 3
/dev/console : mknod -m 666 console c 5 1
对应 initrd 为 /linuxrc
对应 initramfs 为 /sbin/init
/etc/initab
/etc/fatab
mdev
对于 initramfs ,要有 switch_root
可 通过 make modules_install INSTALL_MOD_PATH=/path/to/initxxx/
可在 /etc/inittab 中指定 执行 /etc/init.d/rcS,可在 /etc/init.d/rcS 中 执行 insmod xxx
参考