[klibc] run-init in tmpfs

Christian Stenzel christian.stenzel at hs-wismar.de
Fri Mar 11 04:05:18 PST 2011


Dear Sirs,

I've a question belonging to the run-init utility.

I'm trying to boot a full linux system from ram. 
Therefore I provide a kernel and initrd from a tftp server.
The full rootfs is provided through a nfs-server and is at time a
cpio-archive. That archive shall be copied to the local client and
mounted in a tmpfs partition. After that, I want replace the oldroot bei
the root within the tmpfs partition.

Therefore I do the following:
The PXE client boots the kernel (2.6.38-rc6) successfully and a shell
within the initrd is spawned in the "early user space".

After that I type the following:

ifconfig eth0 ip-address
mkdir /mnt
mkdir /newroot
mount -t tmpfs none /newroot
mount -t nfs ip-address_of_nfs_server:/rootfsfolder /mnt -o nolock -n
cd /newroot
cpio -i < /mnt/rootfs.cpio.archive
umount /mnt

Now the whole future rootfs lies under /newroot.

Now I prepare the root switch via run-init:
mount -n -o /sys  /newroot/sys
mount -n -o /dev  /newroot/dev
mount -n -o /proc /newroot/proc

After that 
cat /newroot/proc/mounts said taht everything is mounted below newroot
expect the orignial rootfs.

So I try to invoke run-init now:
exec run-init -c /dev/console /newroot /sbin/init 5

Now I get this error:
run-init: current directory in the same filesystem as the root: error 0
...

I've thought that I can create a new tmpfs under newroot but obviously
this does not work. Is it in principle possible to replace a rootfs by
another tmpfs by calling run-init?

Regards,
Christian Stenzel

















More information about the klibc mailing list