From 387e6dd0949887bc1bf96445aaad75e7424850d6 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 24 May 2011 10:34:19 -0300 Subject: [PATCH] bin/fk: little helper script to flash the kernel via SSH or usbboot --- bin/fk | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 bin/fk diff --git a/bin/fk b/bin/fk new file mode 100755 index 0000000..85548e3 --- /dev/null +++ b/bin/fk @@ -0,0 +1,26 @@ +#!/bin/sh -e +if [ "${1#usb}" = "$1" ]; then + if ! ping -c 1 -w 1 "$1" >/dev/null; then + echo "no ping response from $1" 1>&2 + exit 1 + fi + NN=$1 +else + NN=`ifconfig ${1:-usb0} | + sed '/.*inet addr:\([^ ]*\).*/{s//\1/;s/100$/101/;s/200$/202/;p;};d'` +fi +if [ "$NN" ]; then + echo "SCP to $NN" 1>&2 + scp uImage $NN: + ssh $NN 'PATH=$PATH:/usr/sbin; + flash_eraseall /dev/mtd1 && nandwrite -p /dev/mtd1 uImage && + rm -f uImage && sync && sleep 1 && sync && sleep 1 && /sbin/reboot -f' +else + echo "usbboot with idbg" 1>&2 + idbg-nnboot usb + idbg-reset + sleep 3 + usbboot -c "boot;nprog 1024 uImage 0 0 -n" + idbg-nnboot nand + idbg-reset +fi