ramips: add support for TP-Link TL-MR3420 v5
[openwrt/staging/wigyori.git] / target / linux / ramips / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4
5 PART_NAME=firmware
6
7 platform_check_image() {
8 local board=$(board_name)
9 local magic="$(get_magic_long "$1")"
10
11 [ "$#" -gt 1 ] && return 1
12
13 case "$board" in
14 3g150b|\
15 3g300m|\
16 a5-v11|\
17 ai-br100|\
18 air3gii|\
19 all0239-3g|\
20 all0256n-4M|\
21 all0256n-8M|\
22 all5002|\
23 all5003|\
24 ar725w|\
25 asl26555-8M|\
26 asl26555-16M|\
27 awapn2403|\
28 awm002-evb-4M|\
29 awm002-evb-8M|\
30 bc2|\
31 broadway|\
32 c108|\
33 carambola|\
34 cf-wr800n|\
35 cs-qr10|\
36 d105|\
37 d240|\
38 dap-1350|\
39 db-wrt01|\
40 dcs-930|\
41 dcs-930l-b1|\
42 dir-300-b1|\
43 dir-300-b7|\
44 dir-320-b1|\
45 dir-600-b1|\
46 dir-615-d|\
47 dir-615-h1|\
48 dir-620-a1|\
49 dir-620-d1|\
50 dir-810l|\
51 duzun-dm06|\
52 dwr-512-b|\
53 e1700|\
54 esr-9753|\
55 ew1200|\
56 ex2700|\
57 ex3700|\
58 f7c027|\
59 firewrt|\
60 fonera20n|\
61 freestation5|\
62 gb-pc1|\
63 gl-mt300a|\
64 gl-mt300n|\
65 gl-mt750|\
66 gl-mt300n-v2|\
67 hc5*61|\
68 hc5661a|\
69 hg255d|\
70 hlk-rm04|\
71 hpm|\
72 ht-tm02|\
73 hw550-3g|\
74 ip2202|\
75 jhr-n805r|\
76 jhr-n825r|\
77 jhr-n926r|\
78 k2p|\
79 kn|\
80 kn_rc|\
81 kn_rf|\
82 kng_rc|\
83 linkits7688|\
84 m2m|\
85 m3|\
86 m4-4M|\
87 m4-8M|\
88 mac1200rv2|\
89 microwrt|\
90 miniembplug|\
91 miniembwifi|\
92 miwifi-mini|\
93 miwifi-nano|\
94 mlw221|\
95 mlwg2|\
96 mofi3500-3gn|\
97 mpr-a1|\
98 mpr-a2|\
99 mr-102n|\
100 mt7628|\
101 mzk-750dhp|\
102 mzk-dp150n|\
103 mzk-ex300np|\
104 mzk-ex750np|\
105 mzk-w300nh2|\
106 mzk-wdpr|\
107 nbg-419n|\
108 nbg-419n2|\
109 newifi-d1|\
110 d-team,newifi-d2|\
111 nixcore-x1-8M|\
112 nixcore-x1-16M|\
113 nw718|\
114 omega2|\
115 omega2p|\
116 oy-0001|\
117 pbr-d1|\
118 pbr-m1|\
119 psg1208|\
120 psg1218a|\
121 psg1218b|\
122 psr-680w|\
123 px-4885-4M|\
124 px-4885-8M|\
125 rb750gr3|\
126 re6500|\
127 rp-n53|\
128 rt5350f-olinuxino|\
129 rt5350f-olinuxino-evb|\
130 rt-ac51u|\
131 rt-g32-b1|\
132 rt-n10-plus|\
133 rt-n12p|\
134 rt-n13u|\
135 rt-n14u|\
136 rt-n15|\
137 rt-n56u|\
138 rut5xx|\
139 sap-g3200u3|\
140 sk-wb8|\
141 sl-r7205|\
142 tew-638apb-v2|\
143 tew-691gr|\
144 tew-692gr|\
145 tew-714tru|\
146 timecloud|\
147 tiny-ac|\
148 u25awf-h1|\
149 u7621-06-256M-16M|\
150 u7628-01-128M-16M|\
151 ur-326n4g|\
152 ur-336un|\
153 v22rw-2x2|\
154 vonets,var11n-300|\
155 vocore-8M|\
156 vocore-16M|\
157 vocore2|\
158 vocore2lite|\
159 vr500|\
160 w150m|\
161 w2914nsv2|\
162 w306r-v20|\
163 w502u|\
164 wf-2881|\
165 whr-1166d|\
166 whr-300hp2|\
167 whr-600d|\
168 whr-g300n|\
169 widora-neo|\
170 witi|\
171 wizfi630a|\
172 wl-330n|\
173 wl-330n3g|\
174 wl-341v3|\
175 wl-351|\
176 wl-wn575a3|\
177 wli-tx4-ag300n|\
178 wlr-6000|\
179 wmdr-143n|\
180 wmr-300|\
181 wn3000rpv3|\
182 wnce2001|\
183 wndr3700v5|\
184 wr512-3gn-4M|\
185 wr512-3gn-8M|\
186 wr6202|\
187 wrh-300cr|\
188 wrtnode|\
189 wrtnode2r |\
190 wrtnode2p |\
191 wsr-600|\
192 wt1520-4M|\
193 wt1520-8M|\
194 wt3020-4M|\
195 wt3020-8M|\
196 wzr-agl300nh|\
197 x5|\
198 x8|\
199 y1|\
200 y1s|\
201 we1026-5g-16m|\
202 zbt-ape522ii|\
203 zbt-cpe102|\
204 zbt-wa05|\
205 zbt-we1326|\
206 zbt-we2026|\
207 zbtlink,zbt-we3526|\
208 zbt-we826-16M|\
209 zbt-we826-32M|\
210 zbt-wg2626|\
211 zbt-wg3526-16M|\
212 zbt-wg3526-32M|\
213 zbt-wr8305rt|\
214 zte-q7|\
215 youku-yk1)
216 [ "$magic" != "27051956" ] && {
217 echo "Invalid image type."
218 return 1
219 }
220 return 0
221 ;;
222 3g-6200n|\
223 3g-6200nl|\
224 br-6475nd)
225 [ "$magic" != "43535953" ] && {
226 echo "Invalid image type."
227 return 1
228 }
229 return 0
230 ;;
231
232 ar670w)
233 [ "$magic" != "6d000080" ] && {
234 echo "Invalid image type."
235 return 1
236 }
237 return 0
238 ;;
239 c20|\
240 c20i|\
241 c50|\
242 mr200|\
243 tplink,tl-mr3420-v5|\
244 tl-wr840n-v4|\
245 tl-wr840n-v5|\
246 tl-wr841n-v13)
247 [ "$magic" != "03000000" ] && {
248 echo "Invalid image type."
249 return 1
250 }
251 return 0
252 ;;
253 cy-swr1100|\
254 dch-m225|\
255 dir-610-a1|\
256 dir-645|\
257 dir-860l-b1)
258 [ "$magic" != "5ea3a417" ] && {
259 echo "Invalid image type."
260 return 1
261 }
262 return 0
263 ;;
264 hc5962|\
265 mir3g|\
266 r6220)
267 # these boards use metadata images
268 return 0
269 ;;
270 re350-v1)
271 [ "$magic" != "01000000" ] && {
272 echo "Invalid image type."
273 return 1
274 }
275 return 0
276 ;;
277 ubnt-erx|\
278 ubnt-erx-sfp)
279 nand_do_platform_check "$board" "$1"
280 return $?;
281 ;;
282 wcr-1166ds|\
283 wsr-1166)
284 [ "$magic" != "48445230" ] && {
285 echo "Invalid image type."
286 return 1
287 }
288 return 0
289 ;;
290 esac
291
292 echo "Sysupgrade is not yet supported on $board."
293 return 1
294 }
295
296 platform_nand_pre_upgrade() {
297 local board=$(board_name)
298
299 case "$board" in
300 ubnt-erx|\
301 ubnt-erx-sfp)
302 platform_upgrade_ubnt_erx "$ARGV"
303 ;;
304 esac
305 }
306
307 platform_do_upgrade() {
308 local board=$(board_name)
309
310 case "$board" in
311 hc5962|\
312 mir3g|\
313 r6220|\
314 ubnt-erx|\
315 ubnt-erx-sfp)
316 nand_do_upgrade "$ARGV"
317 ;;
318 *)
319 default_do_upgrade "$ARGV"
320 ;;
321 esac
322 }
323
324 disable_watchdog() {
325 killall watchdog
326 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
327 echo 'Could not disable watchdog'
328 return 1
329 }
330 }
331
332 blink_led() {
333 . /etc/diag.sh; set_state upgrade
334 }
335
336 append sysupgrade_pre_upgrade disable_watchdog
337 append sysupgrade_pre_upgrade blink_led