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