"switch_root" did not work

薛正华 zhxue at cnic.cn
Fri Oct 16 05:50:40 UTC 2009


After compile busybox, it generates the following directory: /bin  /sbin  linuxrc.
I copy /etc dir in an example of busybox into my root file system, and then input the following command  to /etc/init.d/rcS file. 
#! /bin/sh
/bin/mount -a
mkdir /mnt
ifconfig eth0 192.168.100.3 netmask 255.255.255.0 up
mount -o nolock 192.168.100.35:/sdb/root /mnt
exec switch_root /mnt /sbin/init


Finally, I put  "/bin  /sbin  linuxrc  /etc " into a directory named rootfs, and I make rootfs as a initrd.img using "dd" command.
The kernel starts properly, and successfully executes all the commands in "/etc/init.d/rcS" file except the last one 
"exec switch_root /mnt /sbin/init ". 

It only prompts using way of command "switch_root", but our command has no syntax error. I am so confused, please help me. 
Thank you.
 




发件人: Vladimir Dronnikov 
发送时间: 2009-10-16  13:33:26 
收件人: 薛正华 
抄送: busybox 
主题: Re: "switch_root" did not work 
 
>
> I put busybox into a initrd.img (ram disk).
Put it clearer: ramdisk, or initrootfs? Do you have /linuxrc? Do you have /init
--
Vladimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20091016/b6651a6c/attachment.htm>


More information about the busybox mailing list