[ar71xx] fix sysupgrade
[openwrt.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         esac
32
33         echo "Sysupgrade is not yet supported on $board."
34         return 1
35 }
36
37 # use default for platform_do_upgrade()
38
39 disable_watchdog() {
40         killall watchdog
41         ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
42                 echo 'Could not disable watchdog'
43                 return 1
44         }
45 }
46
47 append sysupgrade_pre_upgrade disable_watchdog