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