Booting from RAMDISK to SD/MMC filesystem

Hey Guys,

I am successfully booting my device in RAMDISK but need to switch to the filesystem stored in my sd card, I issued the commands below and executed the rcS on my sd card. I’ve noticed that not all the startup scripts being executed and un-mounting the old-root, the system giving me a device busy… Any idea how to resolve this?

export rootmnt=/new-root
mkdir $rootmnt
mount -t ext2 /dev/mmcblk0p2 $rootmnt
cd $rootmnt
mkdir -p old-root
pivot_root . old-root
exec chroot . sh -c ‘exec /etc/init.d/rcS’ ${rootmnt}/dev/console 2>&1

My ideal system boot is like this, first boot the device using the ramdisk then after the ramdisk done booting, it will switch to the sd card and run the startup scripts or runlevel 3 to have a full file system.

Regards,

john