[ramips] add ALL5002 userspace support
[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_word "$1")"
13
14         [ "$ARGC" -gt 1 ] && return 1
15
16         case "$board" in
17         3g-6200n | \
18         all0256n | \
19         all5002 | \
20         bc2 | \
21         dir-300-b1 | \
22         dir-600-b1 | \
23         dir-600-b2 | \
24         esr-9753 | \
25         fonera20n | \
26         freestation5 | \
27         hw550-3g | \
28         mofi3500-3gn | \
29         nbg-419n | \
30         nw718 | \
31         omni-emb | \
32         psr-680w | \
33         rt-g32-b1 | \
34         rt-n10-plus | \
35         rt-n15 | \
36         rt-n56u | \
37         sl-r7205 | \
38         w306r-v20 |\
39         w502u |\
40         wr6202 |\
41         v22rw-2x2 | \
42         wl341v3 | \
43         wl-330n | \
44         wl-351 | \
45         wli-tx4-ag300n | \
46         whr-g300n |\
47         ur-336un |\
48         wr512-3gn)
49                 [ "$magic" != "2705" ] && {
50                         echo "Invalid image type."
51                         return 1
52                 }
53                 return 0
54                 ;;
55         esac
56
57         echo "Sysupgrade is not yet supported on $board."
58         return 1
59 }
60
61 platform_do_upgrade() {
62         local board=$(ramips_board_name)
63
64         case "$board" in
65         *)
66                 default_do_upgrade "$ARGV"
67                 ;;
68         esac
69 }
70
71 disable_watchdog() {
72         killall watchdog
73         ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
74                 echo 'Could not disable watchdog'
75                 return 1
76         }
77 }
78
79 append sysupgrade_pre_upgrade disable_watchdog