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