polarssl: update to version 1.3.14
[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 d105|\
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-600-b2|\
47 dir-615-d|\
48 dir-615-h1|\
49 dir-620-a1|\
50 dir-620-d1|\
51 dir-810l|\
52 e1700|\
53 esr-9753|\
54 f7c027|\
55 firewrt|\
56 fonera20n|\
57 freestation5|\
58 hc5*61|\
59 hg255d|\
60 hlk-rm04|\
61 hpm|\
62 ht-tm02|\
63 hw550-3g|\
64 ip2202|\
65 m2m|\
66 m3|\
67 m4|\
68 microwrt|\
69 miniembplug|\
70 miniembwifi|\
71 miwifi-mini|\
72 mlw221|\
73 mlwg2|\
74 mofi3500-3gn|\
75 mpr-a1|\
76 mpr-a2|\
77 mr-102n|\
78 mzk-dp150n|\
79 mzk-w300nh2|\
80 nbg-419n|\
81 nw718|\
82 oy-0001|\
83 pbr-m1|\
84 psr-680w|\
85 px-4885|\
86 re6500|\
87 rp-n53|\
88 rt5350f-olinuxino|\
89 rt5350f-olinuxino-evb|\
90 rt-g32-b1|\
91 rt-n10-plus|\
92 rt-n13u|\
93 rt-n14u|\
94 rt-n15|\
95 rt-n56u|\
96 rut5xx|\
97 sap-g3200u3|\
98 sl-r7205|\
99 tew-691gr|\
100 tew-692gr|\
101 ur-326n4g|\
102 ur-336un|\
103 v22rw-2x2|\
104 vocore|\
105 w150m|\
106 w306r-v20|\
107 w502u|\
108 whr-1166d|\
109 whr-300hp2|\
110 whr-600d|\
111 whr-g300n|\
112 wizfi630a|\
113 wl-330n|\
114 wl-330n3g|\
115 wl-341v3|\
116 wl-351|\
117 wli-tx4-ag300n|\
118 wmr-300|\
119 wnce2001|\
120 wr512-3gn|\
121 wr6202|\
122 wrtnode|\
123 wsr-600|\
124 wt1520|\
125 wt3020|\
126 wzr-agl300nh|\
127 x5|\
128 x8|\
129 y1|\
130 y1s|\
131 zbt-wa05|\
132 zbt-wr8305rt|\
133 zte-q7)
134 [ "$magic" != "27051956" ] && {
135 echo "Invalid image type."
136 return 1
137 }
138 return 0
139 ;;
140 ar670w)
141 [ "$magic" != "6d000080" ] && {
142 echo "Invalid image type."
143 return 1
144 }
145 return 0
146 ;;
147 br-6475nd)
148 [ "$magic" != "43535953" ] && {
149 echo "Invalid image type."
150 return 1
151 }
152 return 0
153 ;;
154 c20i)
155 [ "$magic" != "03000000" ] && {
156 echo "Invalid image type."
157 return 1
158 }
159 return 0
160 ;;
161 cy-swr1100|\
162 dir-610-a1|\
163 dir-645|\
164 dir-860l-b1)
165 [ "$magic" != "5ea3a417" ] && {
166 echo "Invalid image type."
167 return 1
168 }
169 return 0
170 ;;
171 wsr-1166)
172 [ "$magic" != "48445230" ] && {
173 echo "Invalid image type."
174 return 1
175 }
176 return 0
177 ;;
178 esac
179
180 echo "Sysupgrade is not yet supported on $board."
181 return 1
182 }
183
184 platform_do_upgrade() {
185 local board=$(ramips_board_name)
186
187 case "$board" in
188 *)
189 default_do_upgrade "$ARGV"
190 ;;
191 esac
192 }
193
194 disable_watchdog() {
195 killall watchdog
196 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
197 echo 'Could not disable watchdog'
198 return 1
199 }
200 }
201
202 append sysupgrade_pre_upgrade disable_watchdog