Root/bin/fk

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

Archive Download this file

Branches:
master



interactive