[BusyBox] urgent help at change_root inside of initrd
Erik Andersen
andersen at codepoet.org
Fri Feb 15 05:30:04 UTC 2002
On Fri Feb 15, 2002 at 11:52:47AM +0100, Stephan Linz wrote:
> Hi Folks,
>
> since the last two days I've tried to make a so named "change_root" mechanism
> with support of kernels sysctrl (/proc/sys/kernel/real-root-dev) inside of a
> minimal initrd image. I use kernel 2.2.19 so I can't use the newer
> "pivot_root" mechanism. In kernel documentation initrd.txt says I have to
> write the major-minor code of the new root FS into the virtuell file
> /proc/sys/kernel/real-root-dev, but nothing is going on. Here my boot
> strategy (all things at x86 plattform):
>
> BIOS boots from first master IDE device (LILO). LILO loads kernel and initrd
> image. Kernel mounts initrd image as first root FS in ramdisk(/dev/ram0); in
> lilo.conf is standing: append="root=/dev/ram init=/linuxrc rw". Initrd image
Lose the root=/dev/ram init=/linuxrc stuff. The initrd will do
what you want without that...
> covers a small busybox, /linuxrc is a shellscript and has to mount /dev/hda1,
> extract the real root FS from a tarball to /dev/ram1, unmount /dev/hda1 and
> mount /dev/ram1 as new root FS. So at the end of /linuxrc I write:
>
> mount -t proc /proc /proc
> echo 0x101 >/proc/sys/kernel/real-root-dev
> exec /sbin/init
Drop the mount /proc and the exec. Just leave the echo, and let
the /linuxrc script exit, at which point the kernel will mount
/dev/ram1 as root, remount your initrd as /initrd in your new
root (if you have that directory), and exec /sbin/init on
/dev/ram1 (which is now your root device)
-Erik
--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
More information about the busybox
mailing list