Difference between revisions of "USB Blasting"

From Technologic Systems Manuals
(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...")
(No difference)

Revision as of 14:17, 18 August 2011

1 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

2 Preparing a tsinit USB drive

2.1 Example tsinit script

#!/bin/sh

3 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