|
我现在想把Centos 5.2(内核2.6)弄成无盘模式启动,
在linux内核启动后,利用gunzip , cpio解压initrdXX.img文件,执行其中的init脚本,在init脚本中加载驱动,挂载文件系统,并转向新的根文件系统。
我在网上搜索得知,linux 2.6 将img文件直接解压到rootfs文件系统中,没有ramdisk,我现在想让linux系统就运行在rootfs最开始设置的rootfs上,并运行rootfs上的/sbin/init初始进程,不进行根系统的切换,请问一下init脚本中还要做switch_root工作吗?如果要做,具体这段代码该怎么写啊?以下为我截取initrd.XX.img文件中init脚本中有关根系统切换的代码:
echo Creatimg root device.
mkrootdev -t ext3 -o defaults, ro sda1
echo Mounting root filesystem
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init
switchroot
如果在该脚本中直接添加/sbin/init 3 ,则会报错:
init:/dev/initctl: No such file or directory
请问以下如何设置img的init脚本? |
|