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