Back-Up and Restore a BSP 5.0

From WIKI SECO

Back-Up and restore of a Bootable SD

There are two kinds of backup:

  • Complete backup of a removable device: creation of an image of the whole SD memory device, containing the partition table of the device, the u-boot with the relative environment and all the present partitions.
    The advantages of this kind of backup is to quickly replicate the system in another memory device;
    The disadvantages is the incompatibility with other SD Vendors, with regards to the original SD (geometry and size issues).
  • Partial backup plus archiving of the partition's content: creation of an image of the u-boot and relative environment only and the archive through tar.gz of the entire content of the partition.
    This is a slower procedure compared with the previous because the creation of another bootable SD card requires the creation of a partition table and partition into the new SD device.
    The advantage is that it is independent of the SD Vendor.

Back-Up and restore of a Bootable eMMC

Bootable eMMC structure.png
Figure: Bootable eMMC structure

A bootable eMMC has a defined format:

  • The first KB contains the partition table of the device.
  • The next partition contains the u-boot and the related environment. This is approximately 1 MB.
  • The next partition is the boot partition which contains the dtb file and zImage. This is approximately 10 MB.
  • The fourth partition is the filesystem partition.

We consider the eMMC device mapped by the kernel as /dev/mmcblkx, where x is a number starting from 0 (usually, for the eMMC it is 0). To find the virtual device associated with the eMMC card execute the command:

 
# df -h 
or 
# sudo fdisk -l

(for more details about these commands, see a general linux manual) With /dev/mmcblk0p1, we refer to the first partition of the eMMC device.
All the commands listed below must be performed as a super user. So the first operation to perform is to open a terminal console and to login as a super user.

 
# sudo su

(insert the password if required).
Note:For all the backup/restore procedures, the user need to start the board with a bootable SD card in order to use the eMMC device as a generic storage device and not as the system device.
For the creation of a bootable SD card, please refer to Creating a BSP 5.0 Bootable SD. So, all the procedures explained below must be performed on the board with the system started from the bootable SD card.

Note: The SD to use for this scope must be greater than the eMMC, in size, plus about 2GB for the system. So we recommend to use a 8GB SD card for a 4GB eMMC. For greater size of the eMMC, an another way is to use an external device (for example a USB device memory) as storage device.
At this point, you can continue with the following tasks / procedures.