gre: Support fqdn as remote tunnel endpoint
[openwrt/openwrt.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 3g150b|\
18 3g300m|\
19 3g-6200n|\
20 3g-6200nl|\
21 a5-v11|\
22 ai-br100|\
23 air3gii|\
24 all0239-3g|\
25 all0256n|\
26 all5002|\
27 all5003|\
28 ar725w|\
29 asl26555|\
30 awapn2403|\
31 awm002-evb|\
32 awm003-evb|\
33 bc2|\
34 broadway|\
35 carambola|\
36 cf-wr800n|\
37 cs-qr10|\
38 d105|\
39 dap-1350|\
40 db-wrt01|\
41 dcs-930|\
42 dcs-930l-b1|\
43 dir-300-b1|\
44 dir-300-b7|\
45 dir-320-b1|\
46 dir-600-b1|\
47 dir-600-b2|\
48 dir-615-d|\
49 dir-615-h1|\
50 dir-620-a1|\
51 dir-620-d1|\
52 dir-810l|\
53 duzun-dm06|\
54 e1700|\
55 esr-9753|\
56 ex2700|\
57 f7c027|\
58 firewrt|\
59 fonera20n|\
60 freestation5|\
61 gl-mt300a|\
62 gl-mt300n|\
63 gl-mt750|\
64 hc5*61|\
65 hg255d|\
66 hlk-rm04|\
67 hpm|\
68 ht-tm02|\
69 hw550-3g|\
70 ip2202|\
71 jhr-n805r|\
72 jhr-n825r|\
73 jhr-n926r|\
74 linkits7688|\
75 linkits7688d|\
76 m2m|\
77 m3|\
78 m4|\
79 mac1200rv2|\
80 microwrt|\
81 miniembplug|\
82 miniembwifi|\
83 miwifi-mini|\
84 miwifi-nano|\
85 mlw221|\
86 mlwg2|\
87 mofi3500-3gn|\
88 mpr-a1|\
89 mpr-a2|\
90 mr-102n|\
91 mt7628|\
92 mzk-750dhp|\
93 mzk-dp150n|\
94 mzk-ex300np|\
95 mzk-ex750np|\
96 mzk-w300nh2|\
97 mzk-wdpr|\
98 nbg-419n|\
99 newifi-d1|\
100 nixcore|\
101 nw718|\
102 oy-0001|\
103 pbr-d1|\
104 pbr-m1|\
105 psg1208|\
106 psg1218|\
107 psr-680w|\
108 px-4885|\
109 re6500|\
110 rp-n53|\
111 rt5350f-olinuxino|\
112 rt5350f-olinuxino-evb|\
113 rt-g32-b1|\
114 rt-n10-plus|\
115 rt-n13u|\
116 rt-n14u|\
117 rt-n15|\
118 rt-n56u|\
119 rut5xx|\
120 sap-g3200u3|\
121 sk-wb8|\
122 sl-r7205|\
123 tew-691gr|\
124 tew-692gr|\
125 tew-714tru|\
126 timecloud|\
127 tiny-ac|\
128 ur-326n4g|\
129 ur-336un|\
130 v22rw-2x2|\
131 vocore|\
132 w150m|\
133 w306r-v20|\
134 w502u|\
135 wf-2881|\
136 whr-1166d|\
137 whr-300hp2|\
138 whr-600d|\
139 whr-g300n|\
140 widora-neo|\
141 witi|\
142 wizfi630a|\
143 wl-330n|\
144 wl-330n3g|\
145 wl-341v3|\
146 wl-351|\
147 wli-tx4-ag300n|\
148 wmr-300|\
149 wnce2001|\
150 wndr3700v5|\
151 wr512-3gn|\
152 wr6202|\
153 wrh-300cr|\
154 wrtnode|\
155 wrtnode2r |\
156 wrtnode2p |\
157 wsr-600|\
158 wt1520|\
159 wt3020|\
160 wzr-agl300nh|\
161 x5|\
162 x8|\
163 y1|\
164 y1s|\
165 zbt-ape522ii|\
166 zbt-cpe102|\
167 zbt-wa05|\
168 zbt-we826|\
169 zbt-wg2626|\
170 zbt-wg3526|\
171 zbt-wr8305rt|\
172 zte-q7|\
173 youku-yk1)
174 [ "$magic" != "27051956" ] && {
175 echo "Invalid image type."
176 return 1
177 }
178 return 0
179 ;;
180 ar670w)
181 [ "$magic" != "6d000080" ] && {
182 echo "Invalid image type."
183 return 1
184 }
185 return 0
186 ;;
187 br-6475nd)
188 [ "$magic" != "43535953" ] && {
189 echo "Invalid image type."
190 return 1
191 }
192 return 0
193 ;;
194 c20i|\
195 c50)
196 [ "$magic" != "03000000" ] && {
197 echo "Invalid image type."
198 return 1
199 }
200 return 0
201 ;;
202 cy-swr1100|\
203 dch-m225|\
204 dir-610-a1|\
205 dir-645|\
206 dir-860l-b1)
207 [ "$magic" != "5ea3a417" ] && {
208 echo "Invalid image type."
209 return 1
210 }
211 return 0
212 ;;
213 wsr-1166)
214 [ "$magic" != "48445230" ] && {
215 echo "Invalid image type."
216 return 1
217 }
218 return 0
219 ;;
220 ubnt-erx)
221 nand_do_platform_check "$board" "$1"
222 return $?;
223 ;;
224 esac
225
226 echo "Sysupgrade is not yet supported on $board."
227 return 1
228 }
229
230 platform_nand_pre_upgrade() {
231 local board=$(ramips_board_name)
232
233 case "$board" in
234 ubnt-erx)
235 platform_upgrade_ubnt_erx "$ARGV"
236 ;;
237 esac
238 }
239
240 platform_pre_upgrade() {
241 local board=$(ramips_board_name)
242
243 case "$board" in
244 ubnt-erx)
245 nand_do_upgrade "$ARGV"
246 ;;
247 esac
248 }
249
250 platform_do_upgrade() {
251 local board=$(ramips_board_name)
252
253 case "$board" in
254 *)
255 default_do_upgrade "$ARGV"
256 ;;
257 esac
258 }
259
260 disable_watchdog() {
261 killall watchdog
262 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
263 echo 'Could not disable watchdog'
264 return 1
265 }
266 }
267
268 blink_led() {
269 . /etc/diag.sh; set_state upgrade
270 }
271
272 append sysupgrade_pre_upgrade disable_watchdog
273 append sysupgrade_pre_upgrade blink_led