ramips: add support for Xiaomi MiWiFi Mini devices
[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 d105 | \
37 dap-1350 | \
38 dcs-930 | \
39 dir-300-b1 | \
40 dir-300-b7 | \
41 dir-320-b1 | \
42 dir-600-b1 | \
43 dir-600-b2 | \
44 dir-615-d | \
45 dir-615-h1 | \
46 dir-620-a1 | \
47 dir-620-d1 | \
48 dir-810l | \
49 e1700 | \
50 esr-9753 | \
51 f7c027 | \
52 fonera20n | \
53 freestation5 | \
54 firewrt |\
55 hg255d | \
56 hlk-rm04 | \
57 ht-tm02 | \
58 hw550-3g | \
59 ip2202 | \
60 m2m | \
61 m3 | \
62 m4 | \
63 mlw221 | \
64 mlwg2 | \
65 mofi3500-3gn | \
66 mpr-a1 | \
67 mpr-a2 | \
68 mzk-w300nh2 | \
69 nbg-419n | \
70 nw718 | \
71 omni-emb | \
72 omni-emb-hpm | \
73 omni-plug | \
74 psr-680w | \
75 px4885 | \
76 rp-n53 | \
77 rt-g32-b1 | \
78 rt-n10-plus | \
79 rt-n13u | \
80 rt-n14u | \
81 rt-n15 | \
82 rt-n56u | \
83 rut5xx | \
84 sl-r7205 | \
85 tew-691gr | \
86 tew-692gr | \
87 ur-326n4g |\
88 ur-336un |\
89 v22rw-2x2 | \
90 vocore | \
91 w150m | \
92 w306r-v20 |\
93 w502u |\
94 whr-g300n |\
95 whr-600d |\
96 whr-1166d |\
97 wsr-600 |\
98 wl-330n | \
99 wl-330n3g | \
100 wl-351 | \
101 wl341v3 | \
102 wli-tx4-ag300n | \
103 wmr300 |\
104 wnce2001 | \
105 wr512-3gn |\
106 wr6202 |\
107 wr8305rt |\
108 wrtnode |\
109 wt1520 |\
110 wt3020 |\
111 x5 |\
112 x8 |\
113 xiaomi-miwifi-mini |\
114 y1 |\
115 y1s |\
116 zbt-wa05)
117 [ "$magic" != "27051956" ] && {
118 echo "Invalid image type."
119 return 1
120 }
121 return 0
122 ;;
123 wsr-1166)
124 [ "$magic" != "48445230" ] && {
125 echo "Invalid image type."
126 return 1
127 }
128 return 0
129 ;;
130 ar670w)
131 [ "$magic" != "6d000080" ] && {
132 echo "Invalid image type."
133 return 1
134 }
135 return 0
136 ;;
137 cy-swr1100 |\
138 dir-610-a1 |\
139 dir-645 |\
140 dir-860l-b1)
141 [ "$magic" != "5ea3a417" ] && {
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 esac
162
163 echo "Sysupgrade is not yet supported on $board."
164 return 1
165 }
166
167 platform_do_upgrade() {
168 local board=$(ramips_board_name)
169
170 case "$board" in
171 *)
172 default_do_upgrade "$ARGV"
173 ;;
174 esac
175 }
176
177 disable_watchdog() {
178 killall watchdog
179 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
180 echo 'Could not disable watchdog'
181 return 1
182 }
183 }
184
185 append sysupgrade_pre_upgrade disable_watchdog