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