TS-4100 eMMC Backup/restore ums

From embeddedTS Manuals
Revision as of 14:03, 11 October 2019 by Kris (talk | contribs) (Remove incorrect 7553v2 reference)

U-Boot on the TS-4100 supports the "ums" command to allow the eMMC device (or SD card, or USB device for that matter) to be accessible directly on a host PC via USB mass storage. This method is generally slower than direct access from Linux on the TS-4100 itself, but it allows for direct updating of the flash media.

Note: It is recommended to use a host PC with a native linux install. It has been observed that some VMs fail to correctly pass-through the USB device created in U-Boot for UMS.


In order to use this method, enter the U-Boot shell while connected to the TS-4100 via the USB serial interface. Insert the proper USB cable between the host PC and the USB OTG port, and enter the U-Boot command:

ums 0 mmc 1

The USB mass storage device provided by the TS-4100 will begin to enumerate. The following commands can then be used to set up the eMMC and unpack the latest image on to it. Note that the instructions refer to /dev/sdX, please verify the correct device node that is created on the host and adjust the instructions as necessary.

# Verify nothing else has the disk mounted with 'mount'
# If partitions are mounted automatically, they can be unmounted with
umount /dev/sdX1

mkfs.ext3 /dev/sdX1
mkdir /mnt/emmc
mount /dev/sdX1 /mnt/emmc
wget http://ftp.embeddedarm.com/ftp/ts-socket-macrocontrollers/ts-4100-linux/distributions/debian/ts4100-armhf-stretch-latest.tar.xz
tar -xJf debian/ts4100-armhf-stretch-latest.tar.xz -C /mnt/emmc
umount /mnt/emmc
sync
Note: The ext4 filesystem can be used instead of ext3, but it may require additional options. U-Boot does not support the 64bit addressing added as the default behavior in recent revisions of mkfs.ext4. If using e2fsprogs 1.43 or newer, the options "-O ^64bit,^metadata_csum" must be used with ext4 for proper compatibility. Older versions of e2fsprogs do not need these options passed nor are they needed for ext3.

After the image is written, the files can all be verified on disk against the original files created in the tarball. Reinsert the disk to verify any block cache is gone, then run the following:

mount /dev/sdX1 /mnt/emmc
cd /mnt/emmc/
sudo md5sum --quiet -c md5sums.txt
umount /mnt/emmc
sync

The 'md5sum' command will report any differences between files and their checksums. Any differences are an indication of failure to write data or a damaged disk.


UMS can also be used to create an image from an existing device. However, we recommend using the image prep script to complete this process for its ease of use, removal of temporary or unique files, and generation of MD5 hashes for each file.

Manual process:

dmesg | tail -n 30
# Look for the last /dev/sd* device connected.  This should also match the eMMC
# size of around 3.78GiB.
sudo mkdir /mnt/emmc/
sudo mount /dev/sdX1 /mnt/emmc/
cd /mnt/emmc/
tar -cjf /path/to/ts4100-backup-image.tar.bz2
cd ../
umount /mnt/emmc/
sync