ramips: enable sysupgrade on the RT-N15 board
[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         bc2 | \
18         dir-300-b1 | \
19         dir-600-b1 | \
20         dir-600-b2 | \
21         fonera20n | \
22         hw550-3g | \
23         mofi3500-3gn | \
24         nbg-419n | \
25         nw718 | \
26         rt-g32-b1 | \
27         rt-n15 | \
28         v22rw-2x2 | \
29         whr-g300n)
30                 [ "$magic" != "2705" ] && {
31                         echo "Invalid image type."
32                         return 1
33                 }
34                 return 0
35                 ;;
36         esac
37
38         echo "Sysupgrade is not yet supported on $board."
39         return 1
40 }
41
42 platform_do_upgrade() {
43         local board=$(ramips_board_name)
44
45         case "$board" in
46         *)
47                 default_do_upgrade "$ARGV"
48                 ;;
49         esac
50 }
51
52 disable_watchdog() {
53         killall watchdog
54         ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
55                 echo 'Could not disable watchdog'
56                 return 1
57         }
58 }
59
60 append sysupgrade_pre_upgrade disable_watchdog