2009/10/16 薛正华 <[email protected]>:
> I put busybox into a initrd.img (ram disk). After linux kernel starts,
> it switches root file system to that of initrd.img, and it works well. Now,
> I want to switch root file system to NFS, and I used the following busybox
> command in the initrd enviroment.
>
> "exec switch_root /mnt /sbin/init ",
>
> But it prompted usage information  of switch_root, and did not execute the
> command.
>
> I noticed that switch_root can only be executed by process init, and I put
> the command "exec switch_root /mnt /sbin/init" into /etc/init.d/rcS, but
> after linux starts, it still prompts usage information of switch_root, and
> did not switch to my new root file system.

switch_root can only be called from process 1 (init).  /etc/init.d/rcS
is never process 1 in most systemV (and busybox) init environments.
That means you're "init" script has to call the switch_root.  In other
words,. you have a script that looks something like:

#!/bin/sh

modprobe e1000
ifconfig eth0 192.168.1.2 netmask 255.255.255.0
mount 192.168.1.1:/rootfs /mnt
switch_root /mnt


There's a lot more to it than that, but that's the basic idea.

Matt
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to