source: freewrt/scripts/flash.sh@ f855d85

Last change on this file since f855d85 was 842eca6, checked in by Thorsten Glaser <tg@…>, 19 years ago

do not even TEMPT people like aep (Arvid Picciani) to make
these scripts +x, please just call them with sh…

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

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