95cad633a56a4e9f1c40e14fba14c84835eac96d
[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 3g300m | \
20 a5-v11 | \
21 air3gii | \
22 ai-br100 |\
23 all0239-3g | \
24 all0256n | \
25 all5002 | \
26 all5003 | \
27 ar725w | \
28 asl26555 | \
29 awapn2403 | \
30 awm002-evb | \
31 awm003-evb | \
32 bc2 | \
33 broadway | \
34 carambola | \
35 d105 | \
36 dap-1350 | \
37 dcs-930 | \
38 dir-300-b1 | \
39 dir-300-b7 | \
40 dir-320-b1 | \
41 dir-600-b1 | \
42 dir-600-b2 | \
43 dir-615-d | \
44 dir-615-h1 | \
45 dir-620-a1 | \
46 dir-620-d1 | \
47 dir-810l | \
48 e1700 | \
49 esr-9753 | \
50 f7c027 | \
51 fonera20n | \
52 freestation5 | \
53 hg255d | \
54 hlk-rm04 | \
55 ht-tm02 | \
56 hw550-3g | \
57 ip2202 | \
58 m3 | \
59 m4 | \
60 mlw221 | \
61 mofi3500-3gn | \
62 mpr-a1 | \
63 mpr-a2 | \
64 mzk-w300nh2 | \
65 nbg-419n | \
66 nw718 | \
67 omni-emb | \
68 omni-emb-hpm | \
69 omni-plug | \
70 psr-680w | \
71 px4885 | \
72 rp-n53 | \
73 rt-g32-b1 | \
74 rt-n10-plus | \
75 rt-n13u | \
76 rt-n14u | \
77 rt-n15 | \
78 rt-n56u | \
79 rut5xx | \
80 sl-r7205 | \
81 tew-691gr | \
82 tew-692gr | \
83 ur-326n4g |\
84 ur-336un |\
85 v22rw-2x2 | \
86 vocore | \
87 w150m | \
88 w306r-v20 |\
89 w502u |\
90 whr-g300n |\
91 whr-600d |\
92 whr-1166d |\
93 wsr-600 |\
94 wl-330n | \
95 wl-330n3g | \
96 wl-351 | \
97 wl341v3 | \
98 wli-tx4-ag300n | \
99 wmr300 |\
100 wnce2001 | \
101 wr512-3gn |\
102 wr6202 |\
103 wr8305rt |\
104 wrtnode |\
105 wt1520 |\
106 wt3020 |\
107 x5 |\
108 x8 |\
109 y1 |\
110 y1s |\
111 zbt-wa05)
112 [ "$magic" != "27051956" ] && {
113 echo "Invalid image type."
114 return 1
115 }
116 return 0
117 ;;
118 wsr-1166)
119 [ "$magic" != "48445230" ] && {
120 echo "Invalid image type."
121 return 1
122 }
123 return 0
124 ;;
125 ar670w)
126 [ "$magic" != "6d000080" ] && {
127 echo "Invalid image type."
128 return 1
129 }
130 return 0
131 ;;
132 cy-swr1100 |\
133 dir-610-a1 |\
134 dir-645)
135 [ "$magic" != "5ea3a417" ] && {
136 echo "Invalid image type."
137 return 1
138 }
139 return 0
140 ;;
141 br-6475nd)
142 [ "$magic" != "43535953" ] && {
143 echo "Invalid image type."
144 return 1
145 }
146 return 0
147 ;;
148 c20i)
149 [ "$magic" != "03000000" ] && {
150 echo "Invalid image type."
151 return 1
152 }
153 return 0
154 ;;
155 esac
156
157 echo "Sysupgrade is not yet supported on $board."
158 return 1
159 }
160
161 platform_do_upgrade() {
162 local board=$(ramips_board_name)
163
164 case "$board" in
165 *)
166 default_do_upgrade "$ARGV"
167 ;;
168 esac
169 }
170
171 disable_watchdog() {
172 killall watchdog
173 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
174 echo 'Could not disable watchdog'
175 return 1
176 }
177 }
178
179 append sysupgrade_pre_upgrade disable_watchdog