We have 4 partitions:
- "safe" Linux which we plan to never change (/dev/mtd1)
- jffs2 filesystem for "safe" Linux (/dev/mtd2 ... ideally mounted ro)
- "main" linux which we may occasionally field update (/dev/mtd3)
- jffs2 filesystem for the "main" Linux (/dev/mtd4)
If "something bad" happens and our "main" Linux won't boot, or if we need to upgrade our application (in the "main" Linux filesystem) or the "main" Linux itself, then our device will boot into the "safe" Linux. An application in that "safe" Linux will receive the necessary updates for the "main" Linux and/or filesystem and it wants to install these on the proper partitions. The Linux is delivered as a new vmImage file, and the filesystem is received as a new rootfs.jffs2 file.
- is there a better way to approach this in common practice?
- once received, how should the files be copied? I've tried "flashcp vmImage /dev/mtd1", and while the copy appears to succeed the image won't boot. When I "flashcp" the rootfs.jffs2, then that won't boot because there is "no init". ... so flashcp seems incapable of copying whole partitions. I've tried "dd if=<file> of=</dev/mtdN>" with similar result. I am able to "mount -t jffs2 /dev/mtd4 /mnt; cd /mnt; tar xvf <fs tarball>;cd;umount /mnt" ... but that requires me to generate a tarball of the filesystem.
This must be a fairly common requirement and so I'm wondering how people generally approach it.