Root/bin/fk

Source at commit a400f9a0183af4ddf565a2acb2b08d9418749224 created 12 years 6 months ago.
By Werner Almesberger, labsw/fw/labsw.c: improved debouncing and cleaned up button logic
1#!/bin/sh -e
2if [ "${1#usb}" = "$1" ]; then
3    if ! ping -c 1 -w 1 "$1" >/dev/null; then
4    echo "no ping response from $1" 1>&2
5    exit 1
6    fi
7    NN=$1
8else
9    NN=`ifconfig ${1:-usb0} |
10      sed '/.*inet addr:\([^ ]*\).*/{s//\1/;s/100$/101/;s/200$/202/;p;};d'`
11fi
12if [ "$NN" ]; then
13    echo "SCP to $NN" 1>&2
14    scp uImage $NN:
15    ssh $NN 'PATH=$PATH:/usr/sbin;
16      flash_eraseall /dev/mtd1 && nandwrite -p /dev/mtd1 uImage &&
17      rm -f uImage && sync && sleep 1 && sync && sleep 1 && /sbin/reboot -f'
18else
19    echo "usbboot with idbg" 1>&2
20    idbg-nnboot usb
21    idbg-reset
22    sleep 3
23    usbboot -c "boot;nprog 1024 uImage 0 0 -n"
24    idbg-nnboot nand
25    idbg-reset
26fi
27

Archive Download this file

Branches:
master



interactive