ralink: add support for Kingston MLWG2
[openwrt/svn-archive/archive.git] / target / linux / ramips / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4
5 . /lib/ramips.sh
6
7 PART_NAME=firmware
8 RAMFS_COPY_DATA=/lib/ramips.sh
9
10 platform_check_image() {
11 local board=$(ramips_board_name)
12 local magic="$(get_magic_long "$1")"
13
14 [ "$#" -gt 1 ] && return 1
15
16 case "$board" in
17 3g-6200n | \
18 3g-6200nl | \
19 3g300m | \
20 a5-v11 | \
21 air3gii | \
22 ai-br100 |\
23 all0239-3g | \
24 all0256n | \
25 all5002 | \
26 all5003 | \
27 ar725w | \
28 asl26555 | \
29 awapn2403 | \
30 awm002-evb | \
31 awm003-evb | \
32 bc2 | \
33 broadway | \
34 carambola | \
35 d105 | \
36 dap-1350 | \
37 dcs-930 | \
38 dir-300-b1 | \
39 dir-300-b7 | \
40 dir-320-b1 | \
41 dir-600-b1 | \
42 dir-600-b2 | \
43 dir-615-d | \
44 dir-615-h1 | \
45 dir-620-a1 | \
46 dir-620-d1 | \
47 dir-810l | \
48 e1700 | \
49 esr-9753 | \
50 f7c027 | \
51 fonera20n | \
52 freestation5 | \
53 hg255d | \
54 hlk-rm04 | \
55 ht-tm02 | \
56 hw550-3g | \
57 ip2202 | \
58 m3 | \
59 m4 | \
60 mlw221 | \
61 mlwg2 | \
62 mofi3500-3gn | \
63 mpr-a1 | \
64 mpr-a2 | \
65 mzk-w300nh2 | \
66 nbg-419n | \
67 nw718 | \
68 omni-emb | \
69 omni-emb-hpm | \
70 omni-plug | \
71 psr-680w | \
72 px4885 | \
73 rp-n53 | \
74 rt-g32-b1 | \
75 rt-n10-plus | \
76 rt-n13u | \
77 rt-n14u | \
78 rt-n15 | \
79 rt-n56u | \
80 rut5xx | \
81 sl-r7205 | \
82 tew-691gr | \
83 tew-692gr | \
84 ur-326n4g |\
85 ur-336un |\
86 v22rw-2x2 | \
87 vocore | \
88 w150m | \
89 w306r-v20 |\
90 w502u |\
91 whr-g300n |\
92 whr-600d |\
93 whr-1166d |\
94 wsr-600 |\
95 wl-330n | \
96 wl-330n3g | \
97 wl-351 | \
98 wl341v3 | \
99 wli-tx4-ag300n | \
100 wmr300 |\
101 wnce2001 | \
102 wr512-3gn |\
103 wr6202 |\
104 wr8305rt |\
105 wrtnode |\
106 wt1520 |\
107 wt3020 |\
108 x5 |\
109 x8 |\
110 y1 |\
111 y1s |\
112 zbt-wa05)
113 [ "$magic" != "27051956" ] && {
114 echo "Invalid image type."
115 return 1
116 }
117 return 0
118 ;;
119 wsr-1166)
120 [ "$magic" != "48445230" ] && {
121 echo "Invalid image type."
122 return 1
123 }
124 return 0
125 ;;
126 ar670w)
127 [ "$magic" != "6d000080" ] && {
128 echo "Invalid image type."
129 return 1
130 }
131 return 0
132 ;;
133 cy-swr1100 |\
134 dir-610-a1 |\
135 dir-645)
136 [ "$magic" != "5ea3a417" ] && {
137 echo "Invalid image type."
138 return 1
139 }
140 return 0
141 ;;
142 br-6475nd)
143 [ "$magic" != "43535953" ] && {
144 echo "Invalid image type."
145 return 1
146 }
147 return 0
148 ;;
149 c20i)
150 [ "$magic" != "03000000" ] && {
151 echo "Invalid image type."
152 return 1
153 }
154 return 0
155 ;;
156 esac
157
158 echo "Sysupgrade is not yet supported on $board."
159 return 1
160 }
161
162 platform_do_upgrade() {
163 local board=$(ramips_board_name)
164
165 case "$board" in
166 *)
167 default_do_upgrade "$ARGV"
168 ;;
169 esac
170 }
171
172 disable_watchdog() {
173 killall watchdog
174 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
175 echo 'Could not disable watchdog'
176 return 1
177 }
178 }
179
180 append sysupgrade_pre_upgrade disable_watchdog