Long story short, I would like to plug an USB pendrive to my Debian system (which is installed on the NAND memory on an ARM board) and overwrite the NAND with the image that's on the USB pendrive while the system is running. Is this possible? Unfortunately I can't boot from USB, so I somehow have to do this like an "open-heart surgery"
Edit: some additional info
Maybe it could be useful to add some additional info: I have to update 200+ boards. The actual procedure is:
- shutdown the board
- open the case
- insert a microSD (with a Debian installation) in the board's slot and a USB pendrive (with the new board's NAND image) in a board's USB port
- power on the board
- the board will boot the Debian installation on the microSD which will automatically copy the image that's on the USB stick to the board's NAND with a simple dd command:
gunzip -c /mnt/pendrive/hda.img.gz | dd of=/dev/nandand when finished, the board will power off
- when the board powers off, disconnect the microSD and the USB pendrive
- re-assemble the case
- power on the board with the updated Debian installation
This procedure is necessary because the microSD slot is not accessible from the outside. Do this once... no problem. Do it 200+ times? Gosh!
I would like to speed up this process and also make it super simple so also a normal user could update the board. If something goes wrong no problem, I don't need backups, I have no data on the board, just the software that I'm distributing.
My goal is to have a new procedure which does something like this:
- The board is powered on and Debian is running
- I plug in the pendrive
- A script on the pendrive is launched. The script does a
gunzip -c /mnt/pendrive/hda.img.gz | dd of=/dev/nandand when finished it powers off the board
- On the next power on, the updated Debian will boot from the NAND
This simpler proocedure would allow me to distribute some USB pendrives so that the users can update the boards without the need to bring to me all the 200+ boards. If this process somewhere fails and the Debian installation gets corrupted, the user just brings to me that board, and I'll follow the actual procedure.
Note that the board doesn't have Internet access, so I can't remotely login and launch updates.