[ar71xx] enable sysupgrade on the WRT160Nl
[openwrt-10.03/.git] / target / linux / ar71xx / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2009 OpenWrt.org
3 #
4
5 . /lib/ar71xx.sh
6
7 PART_NAME=firmware
8 RAMFS_COPY_DATA=/lib/ar71xx.sh
9
10 platform_check_image() {
11         local board=$(ar71xx_board_name)
12         local magic="$(get_magic_word "$1")"
13
14         [ "$ARGC" -gt 1 ] && return 1
15
16         case "$board" in
17         ap83 | mzk-w04nu | mzk-w300nh | tew-632brp | wrt-400n)
18                 [ "$magic" != "2705" ] && {
19                         echo "Invalid image type."
20                         return 1
21                 }
22                 return 0
23                 ;;
24         tl-wr741nd | tl-wr941nd)
25                 [ "$magic" != "0100" ] && {
26                         echo "Invalid image type."
27                         return 1
28                 }
29                 return 0
30                 ;;
31         wrt160nl)
32                 [ "$magic" != "4e4c" ] && {
33                         echo "Invalid image type."
34                         return 1
35                 }
36                 return 0
37                 ;;
38         esac
39
40         echo "Sysupgrade is not yet supported on $board."
41         return 1
42 }
43
44 # use default for platform_do_upgrade()
45
46 disable_watchdog() {
47         killall watchdog
48         ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
49                 echo 'Could not disable watchdog'
50                 return 1
51         }
52 }
53
54 append sysupgrade_pre_upgrade disable_watchdog