TS-4900 Production: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 1: Line 1:
The TS i.MX6 boards 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.  Your production would involve plugging in a thumbdrive, powering on the board, waiting 10-15 minutes, and looking for the blinking green LED for a pass, or blinking red for failure.   
The TS i.MX6 boards 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.  Your production would involve plugging in a thumbdrive, powering on the board, waiting 10-15 minutes, and looking for the blinking green LED for a pass, or blinking red for failure.   
The USB blasting image can be downloaded [ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4900-linux/usb-blaster/ts-imx6-usbprod.tar.bz2 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. 


The blast image/scripts requires 10MB, so the thumbdrive needs to just be sized to your disk image.  The thumbdrive can use vfat or fat32.  To create this on your workstation:
The blast image/scripts requires 10MB, so the thumbdrive needs to just be sized to your disk image.  The thumbdrive can use vfat or fat32.  To create this on your workstation:
Line 8: Line 10:
sudo mount /dev/sdc1 /mnt/sd/
sudo mount /dev/sdc1 /mnt/sd/
sudo tar xf /path/to/ts-imx6-usbprod.tar.bz2 -C /mnt/sd/
sudo tar xf /path/to/ts-imx6-usbprod.tar.bz2 -C /mnt/sd/
</source>


# Now you would create your images on the /mnt/sd/, but for
# Now you would create your images on the /mnt/sd/, but for
Line 18: Line 21:
<source lang=bash>
<source lang=bash>


The USB blasting image can be downloaded [ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4900-linux/usb-blaster/ts-imx6-usbprod.tar.bz2 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:
Our default blast.sh will look for these files:
* sdimage.tar.bz2
* sdimage.tar.bz2
* emmcimage.tar.bz2
* emmcimage.tar.bz2

Revision as of 10:53, 29 September 2015

The TS i.MX6 boards 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. Your production would involve plugging in a thumbdrive, powering on the board, waiting 10-15 minutes, and looking for the blinking green LED for a pass, or blinking red for failure.

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.

The blast image/scripts requires 10MB, so the thumbdrive needs to just be sized to your disk image. The thumbdrive can use vfat or fat32. To create this on your workstation:

# This assumes your thumbdrive is /dev/sdc:
sudo mkfs.ext4 /dev/sdc1
sudo mkdir /mnt/sd/
sudo mount /dev/sdc1 /mnt/sd/
sudo tar xf /path/to/ts-imx6-usbprod.tar.bz2 -C /mnt/sd/
  1. Now you would create your images on the /mnt/sd/, but for
  2. an example these steps would write our latest debian image:

sudo wget -O /mnt/sd/emmcimage.tar.bz2 http://ftp.embeddedarm.com/ftp/ts-socket-macrocontrollers/ts-4900-linux/distributions/debian/debian-armhf-jessie-20150526.tar.bz2

  1. You can use a symlink to write the same image to sd

sudo ln -s /mnt/sd/emmcimage.tar.bz2 /mnt/sd/sdimage.tar.bz2 sudo umount /mnt/sd sync

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.}}
{{Note|.dd.bz2 images and .tar.bz2 images cannot be used on the same storage device, though you can different mechanisms on the different storage mediums.}}

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 [https://www.embeddedarm.com/support/contact-us.php?source=menu 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
<pre>
<variable 1> <value 1>
<variable 2> <value 2>
</pre>

As an example, to change bootcmd and always boot to emmc, first create a "env.txt" with these contents:
<pre>
bootcmd run emmcboot;
</pre>
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:
<pre>
bootcmd run usbprod; run emmcboot;
</pre>

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.
<source lang=bash>
#!/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.