Backup and deploy
We have been asked the questions by many individual users as well as some commercial users that "i have setup my own server on rock pro and running well, now i want to backup in case i lose data in the future" or "we have developed our own application and setup the environment now we want to install the same environment to 100 rock pro, how to do that". So we write this. This how-to tells you how to backup and restore the same firmware to your boards step by step. This how-to works for rock/rock pro/rock2 square. You should know before read this. This how-to works under Linux.
We use rkflashtool to backup each partition of the image, install it if you haven't.
sudo apt-get install libusb-1.0-0-dev git clone https://github.com/linux-rockchip/rkflashtool cd rkflashtool make
Put your device into Loader Mode and run the following command
sudo ./rkflashtool p > parameter.bak #fetch parameters
open parameter file and check out all the partitions. It's like this mtdparts=rk29xxnand:0x00008000@0x00002000(boot),-@0x0000A000(linuxroot)
sudo ./rkflashtool r boot > boot.img.bak sudo ./rkflashtool r linuxroot > linuxroot.ext4.bak # This will take a long time
Now you have parameter, boot, linuxroot partition backup.
By default, linuxroot partition is very large(~8GB for rock pro), we can shrink it if the partition is not fully used. We can use gparted to shrink the rootfs.
sudo apt-get install gparted sudo gparted linuxroot.ext4.bak
And click Apply button to start shrink. Sometimes the gparted reports shrink failed but the actual size changed.
For one device, to restore is easy, just write back what we backup.
sudo ./rkflashtool P < parameter.bak sudo ./rkflashtool r boot < boot.img.bak sudo ./rkflashtool r linuxroot < linuxroot.ext4.bak
If you have 100 devices and want to restore, you can repeat above for 100 times but we have another way - pack the partitions to a rockchip format firmware and use RKbatchtool to flash each board automatically.