NOTE:  The TS-7800-V2 is in active development preparing for its debut into the Engineering Sampling Program -- This article *is* out of date and will be updated very soon!  Please contact our support team if you have a TS-7800-V2 and are not certain whether this article pertains to your specific software load.  Thank you!

Recovering (or making a change where the eMMC is rendered un-bootable and must be reloaded) the TS-7800-V2 can be a little tricky if the developer is unfamiliar with (or lacks the resources for) a network boot.  This guide intends to assist with this by providing a means to boot the TS-7800-V2 to USB media.

Preparing the USB media

First, obtain a suitably sized USB mass storage device.  These instructions were tested using 8GB media.  Insert the USB device into a Linux Desktop PC or attach it to a Linux VM.

Next, make sure the USB device is appropriately partitioned and formatted.  This is done using standard fdisk and mkfs tools.  Be sure the USB device has exactly one partition and is formatted at least to ext2 (ext3 or ext4 can work but there are certain defaults in newer OSes such as 64-bit partitioning that can cause conflicts with U-Boot).

Before going further, be sure to know the device node that your USB device appeared as; whether it is /dev/sdb, or if it is some other name.  Substitute the correct name for all references to /dev/sdb below.  Using the wrong name might cause you to accidentally erase your own hard drive - be smart don't just copy and paste!

For example:

wget  # download the usb boot image.

sudo fdisk -l /dev/sdb    # Lists the partitions currently on the media attached to /dev/sdb.  You may need to delete and re-create partitions to make room.

sudo umount /dev/sdb*  # unmount all partitions of the USB media.

sudo mkfs.ext4 /dev/sdb1 # erases the first partition and formats it to use the ext4 filesystem.  You may need to use ext2 instead if ext4 does not work.

mkdir mnt

sudo mount /dev/sdb1 mnt  # mount the first partition of the USB media.

sudo tar -xJf ts7800v2_usb-04oct2017.tar.xz -C mnt/ --numeric-owner  # this will probably take a long time.  There may be some warnings about time stamps.


sudo umount mnt

Once the above is done, remove the USB device from the desktop PC and insert it into the top USB port on the TS-7800-V2.

Booting to USB

Connect console and network to the TS-7800-V2.  Using your preferred terminal emulator (PuTTY, KiTTY, Hyperterm, etc.) open a window for the serial port attached to console, then connect power to the TS-7800-V2 (Note that at the time of writing this, the TS-7800-V2 may experience a failure to enable the serial ports in the FPGA.  If you experience this, it can be worked around by connecting the power input before plugging in the USB console cable.)  Break into U-Boot by pressing any key during the countdown that is displayed on startup.  Once at the prompt, paste (or type) the following script into the console one line at a time.  It is important not to paste more than one line at a time or pasted text may be lost and commands may be corrupted or run out of order.  It is also important that this script be run exactly as presented here.

U-Boot USB Boot script:
mw 0xf1018014 0 1; mw 0xf101816c 0x2000 1; mw 0xf1018170 0x2000 1;
env set usbType 3;env set usbActive 1; usb start; usb dev 0
env set loadaddr 0x2000000;env set fdtaddr 0x1000000;
env set image_name /boot/zImage;env set fdtfile /boot/armada-38x.dtb;
ext4load usb 0:1 $loadaddr $image_name;ext4load usb 0:1 $fdtaddr $fdtfile
setenv bootargs root=/dev/sda1 rw rootwait console=ttyS0,115200
bootz  $loadaddr - $fdtaddr;

If at any point during entry of the above script there is an error, STOP and evaluate the error or warning.  An error will generally mean something has gone wrong and proceeding may worsen the condition that caused the error.  Be sure to read and understand the output (if any) that is returned when running these commands.

If all of the above is entered successfully, the device will begin booting upon completion of the final line.  The login name is "root" and there is no password.  The device is now ready to run from USB or to update, upgrade, or replace the filesystem on the eMMC device. 

Re-imaging the eMMC media

Once booted from USB, the eMMC device may be re-partitioned according to your specification.  These instructions presume a single partition encompassing most of the eMMC media will suffice for most applications.  The commands should be run in order, and should any errors be encountered, STOP and read the error.  Generally the presence of an error indicates the operation cannot be completed as intended until the error has been resolved and the command that produced the error is run again without producing an error.

These are the commands to run, note any information following a # need not be entered as these are notes exclusively for your benefit.  If it's not already set, now is also a good time to set the RTC date on the SBC.  Note:  fdisk is menu-driven, be sure to follow the prompts when deleting old partitions on mmcblk0.

fdisk /dev/mmcblk0
d # follow prompts, delete all partitions
16383 # note: this value may change in the future, but is currently very important to avoid filesystem corruption due to a bug in U-Boot.
<enter> press enter to accept default partition end size
w  #this will exit fdisk
mkfs.ext4 /dev/mmcblk0p1
date -s "Wed Oct 4 15:00:00 PDT 2017"   ### set the clock here, substitute the date and time values for the real date and time.
mkdir mnt   may already exist, if so this error is OK.

mount /dev/mmcblk0p1 mnt
tar -xJf  ts7800v2_emmc-04oct2017.tar.xz -C mnt/  be careful, some of these command switches are Capital Letters!
umount mnt

Setting up U-Boot to boot the new eMMC image

Once the eMMC has been imaged, U-Boot's boot scripts may need to be updated.  Issue the reboot command and break back into the u-Boot console.  Once there, enter this sequence of commands.  As before, it is important they are exactly correct, so be sure to paste no more than one line at a time and proof-read before pressing enter.  If there are any errors, STOP and examine carefully to determine what went wrong.

Note:  The bolded text below is all one line.

mw 0xf1018014 0 1; mw 0xf101816c 0x2000 1; mw 0xf1018170 0x2000 1;
env set usbType 3;env set usbActive 1; usb start; usb dev 0
env set loadaddr 0x2000000;env set fdtaddr 0x1000000;
env set image_name /boot/zImage;env set fdtfile /boot/armada-38x.dtb;
ext4load mmc 0:1 $loadaddr $image_name;ext4load mmc 0:1 $fdtaddr $fdtfile
setenv bootargs root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200
env set bootcmd mw 0xf1018014 0 1\; mw 0xf101816c 0x2000 1\; mw 0xf1018170 0x2000 1\;ext4load mmc 0:1 \$loadaddr \$image_name\;ext4load mmc 0:1 \$fdtaddr \$fdtfile\;bootz \$loadaddr - \$fdtaddr\;
env save

Once the final line is entered, the device will reboot and load the Debian OS from the eMMC device.  The USB media device may be removed from the system and stored for safe-keeping.