[yocto] unionfs, initrd, switch_root ...

Chris Tapp opensource at keylevel.com
Wed Oct 19 14:50:56 PDT 2011


I'm booting using the rootfs produced by bitbake as in initrd. This  
works nicely and gives a read-only boot device and a system that runs  
from RAM.

What I want to do now is allow changes to be made to some files (e.g.  
network configuration) and have these saved on the boot device so that  
they can be restored at startup. To do this I plan to use unionfs to  
join / and something like /var/tmp/ufs. e.g.

mkdir /var/tmp/ufs
mount -t unionfs -o dirs=/var/tmp/ufs=rw:/=ro unionfs /media/union

This all works as expected. However, I now need to make /media/union  
the system root so that the system sees the ufs union copies of files.  
I think I need to 'switch_root'. However,

switch_root /media/union /sbin/init 3

gives errors like:

switch_root: failed to mount moving /proc to /media/union/proc: No  
such file or directory

This is where I get lost and I can't seem to find anything on the web  
that helps. A 'grep' of meta hasn't thrown anything up that helps -  
does anyone have a good web reference I can go and read? Lots of  
learning to do...

Chris Tapp

opensource at keylevel.com
www.keylevel.com






More information about the yocto mailing list