source: freewrt/scripts/flash.sh@ 655dec8

Last change on this file since 655dec8 was 4daadd6, checked in by Thorsten Glaser <tg@…>, 19 years ago

ok, while “trace” i̲s̲ a client-side debug option, it was,
according to tha@ who doesn't know the exact purpose
either, still needed – probably to slow down the transfer?

revert -r2280

git-svn-id: svn://www.freewrt.org/trunk/freewrt@2288 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 3.0 KB
Line 
1#!/bin/sh
2# $Id$
3#
4# tftp flash script for wireless routers
5#
6# Copyright (c) 2006, 2007 by Thorsten Glaser <tg@mirbsd.de>
7# Copyright (C) 2006 by Waldemar Brodkorb <wbx@freewrt.org>
8# Copyright (C) 2004 by Oleg I. Vdovikin <oleg@cs.msu.su>
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18# General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
24usage() {
25 cat <<EOF
26Usage: $0 firmware.bin [address]
27
28The following models are supported:
29 asus-wl500g - Asus WL500g
30 asus-wl500g-deluxe - Asus WL500g Deluxe
31 asus-wl500g-premium - Asus WL500g Premium
32 linksys - All Linksys models
33
34IMPORTANT:
35Notes for Linksys routers:
36 be sure you have set boot_wait to yes. Power on your router
37 after executing this script.
38
39Notes for Asus routers:
40 be sure POWER led is flashing (if this is not the case,
41 power off the device, then hold the reset button pushed
42 while powering it on again).
43
441) connect your PC to the LAN port
452) be sure your link is up and has an address in the
46 range 192.168.1.0/24 but other than 192.168.1.1,
47 or specify an IP address where to flash to
48
49EOF
50 exit 1
51}
52
53# find an available tftp client
54tftp=
55for t in tftp atftp; do
56 if which $t >/dev/null 2>&1; then
57 tftp=$t
58 break
59 fi
60done
61if [ -z "$tftp" ]; then
62 echo "no tftp client found! make sure, tftp is in your path"
63 tftp=tftp
64fi
65
66file=${1-/nonexistant}
67ip=${2-192.168.1.1}
68
69test -s "$file" || usage
70
71case $file in
72*\ *)
73 echo Spaces in filenames are not supported.
74 exit 1
75 ;;
76*-asus-wl500g-deluxe-*.bin | *-asus-wl500g-premium-*.bin)
77 echo Flashing $ip using "$file"...
78 printf "rexmt 1\ntrace\nbinary\nput $file\nquit\n" | $tftp $ip
79 echo Please wait 3 minutes and then remove the power.
80 echo This device does not reboot automatically after flashing.
81 ;;
82*-asus-wl500g-*.bin)
83 echo Confirming IP address setting...
84 printf "get ASUSSPACELINK\x01\x01\xa8\xc0 /dev/null\nquit\n" | $tftp $ip
85 echo Flashing $ip using "$file"...
86 printf "binary\nput $file ASUSSPACELINK\nquit\n" | $tftp $ip
87 echo Please wait until leds stops flashing. Device will automatically reboot.
88 ;;
89*-linksys-*.bin)
90 echo Flashing $ip using "$file"...
91 printf "rexmt 1\ntrace\nbinary\nput $file\nquit\n" | $tftp $ip
92 echo Unit will automatically reboot within 3-5 minutes. Do not power off.
93 ;;
94*)
95 echo Unsupported model "'$file'"
96 usage
97 ;;
98esac
99echo After that you can login via: ssh admin@$ip
100echo Default password, unless changed in menuconfig, is: FreeWRT
Note: See TracBrowser for help on using the repository browser.