USB Blasting

From embeddedTS Manuals
Revision as of 15:17, 18 August 2011 by Mark (talk | contribs) (Created page with "= Overview = As many uses for our embedded boards require large quantities to be programmed we have added a mechanism for quickly blasting systems. In all of our linuxrc scripts...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Overview

As many uses for our embedded boards require large quantities to be programmed we have added a mechanism for quickly blasting systems. In all of our linuxrc scripts we have added a function that will on boot:

  • Check for a USB drive
  • Turn on red LED
  • If detected load USB and ethernet modules
  • Mount the first partition of the drive
  • Execute tsinit
  • Turn off red LED

Preparing a tsinit USB drive

Example tsinit script

#!/bin/sh

How this works

In all of the linuxrc scripts we have a function to check if there is a USB drive inserted.

if [ "$x" -eq 1 ]; then
  (
        ts7500ctl --redledon
        mount -t tmpfs tmpfs /lib/modules
        tar -x -z -f /modules.tar.gz -C /
        modprobe scsi_mod
        modprobe sd_mod
        modprobe usbcore
        modprobe ehci_hcd
        modprobe usb_storage
        modprobe smscusbnet
        modprobe smsc9500
        modprobe ohci_hcd
        umount /lib/modules
        x=0
        while [ "$x" -lt 150 -a ! -e /sys/block/sda ]; do
                x=$((x+1))
                sleep .1
        done
        mount -o ro /dev/sda1 /mnt/usbdev
        if [ -x /mnt/usbdev/tsinit ]; then 
                /mnt/usbdev/tsinit <$CONSOLE >$CONSOLE 2>&1
        fi
        umount /mnt/usbdev
        ts7500ctl --redledoff
  ) &
fi