I am developing an embedded Linux system. The system is usually installed by creating a ISO file which is written to a USB stick the board can boot from.
To make the installation possible to do automatically (say, over night) I would like to be able to do the installation on the board while the old system is running.
My installation has two parts: An initrd file which contains busybox and install scripts, and a .tar.gz archive that has the rest of the root file system to install.
- The bootloader loads the kernel and points it to the initrd, and boots the kernel.
- The initrd install scripts mounts the target drive /dev/sda, formats it, installs the bootloader, and finally copies the root file system from .tar.gz and initrd.
Now I instead want to
- Copy install.iso from host computer to target device. (No problem)
- Do the installation steps as above.
My problem is that I don't know how I should go about replacing the currently running system with my new one. I assume that the currently mounted root (/) would have to be unmounted and replaced by the initrd. But I can't seem to figure out how!
