TS-4900 Production

From embeddedTS Manuals
Revision as of 10:43, 29 September 2015 by Mark (talk | contribs)

The TS-4900 includes a hook in u-boot to look for a usb mass storage device, and execute from the first partition a /tsinit.ub script. This can be used to program sd/emmc/sata/u-boot for your final production process.

The USB blasting image can be downloaded [ here]. This includes a basic linux kernel, and a small initramfs that will mount the usb drive at /mnt/usb/, and execute /mnt/usb/blast.sh. Our default blast.sh will look for these files:

  • sdimage.tar.bz2
  • emmcimage.tar.bz2
  • sataimage.tar.bz2 (dual/quad only)
  • sdimage.dd.bz2
  • emmcimage.dd.bz2
  • sataimage.dd.bz2 (dual/quad only)
  • u-boot.imx
  • env.txt
Note: These can be symlinks if the images are the same.

The sd/emmc/sata images with tar.bz2 files will create a single partition regardless of the previous contentx, make an ext4 filesystem, and extract hte contents of the tar to the root of this new partition. If there is an md5sums.txt in the root of the filesystem, it will verify the contents. See the next section for more information.

The images with .dd will write the image directly to the media byte for byte. To have the data verified create a ".dd.md5" of the relevant file with "md5sum sdimage.dd > sdimage.dd.md5" and it will be verified after writing. The md5sum should not be created from the file after it is compressed.

The u-boot.imx file will be written to the SPI flash. Make sure this is the version that matches your processor. If you are uncertain, please contact support. This will also verify the U-Boot after writing if there is a u-boot.imx.md5 file.

The env.txt file will be written to the u-boot environment. If this file is present then the existing contents of the u-boot environment in the spi flash will be erased, and these written instead. This file expects the format to be

<variable 1> <value 1>
<variable 2> <value 2>

As an example, to change bootcmd and always boot to emmc, first create a "env.txt" with these contents:

bootcmd run emmcboot;

The usbprod command can be removed from your production for a small speedup in startup time, but it will not allow future updates to happen through usb. If you want to boot straight to emmc, but retain this functionality:

bootcmd run usbprod; run emmcboot;

When it starts programming the red LED will blink. When it is finished, red will turn off and green will blink. The blast.sh script includes all of this logic, and can be customized for the users application to pull the image instead from http/nfs on the local network.

(Optional) Add md5sum verification to your image


If your image includes a "md5sums.txt" in the rootfs, that image will be verified after writing. This script can be used to add an md5sums.txt into your image.

#!/bin/bash
for img in *.tar.bz2; 
	do mkdir tmp >/dev/null 2>&1
	tar --numeric-owner -xf $img -C tmp/
	cd tmp/
	rm md5sums.txt > /dev/null 2>&1
	rm ../md5sums.txt > /dev/null 2>&1
	find . -type f -print0 | xargs -0 md5sum >> ../md5sums.txt
	mv ../md5sums.txt .
	mkdir ../out/ >/dev/null 2>&1
	tar --numeric-owner -cjf ../out/"$img" *
	cd ../
	rm -rf tmp/
done

Save this script into a "addmd5sums.sh", put it and your image(s) (tar.bz2) in a directory. These should be the only files in the directory.

sudo ./addmd5sums
ls out/

The images in out will include the md5sums.txt.