381b40e322a08c73d52de944cc12e083e26ff7e2
[openwrt/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
9 platform_check_image() {
10 local board=$(ar71xx_board_name)
11 local magic="$(get_magic_word "$1")"
12
13 [ "$ARGC" -gt 1 ] && return 1
14
15 case "$board" in
16 ap83 | mzk-w04nu | mzk-w300nh | tew-632brp | wrt-400n)
17 [ "$magic" != "2705" ] && {
18 echo "Invalid image type."
19 return 1
20 }
21 return 0
22 ;;
23 tl-wr741nd | tl-wr941nd)
24 [ "$magic" != "0100" ] && {
25 echo "Invalid image type."
26 return 1
27 }
28 return 0
29 ;;
30 esac
31
32 echo "Sysupgrade is not yet supported on $board."
33 return 1
34 }
35
36 # use default for platform_do_upgrade()
37
38 disable_watchdog() {
39 killall watchdog
40 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
41 echo 'Could not disable watchdog'
42 return 1
43 }
44 }
45 append sysupgrade_pre_upgrade disable_watchdog