52aa789f5b1cb45ded2860b520721e2c230a377d
[openwrt/svn-archive/archive.git] / target / linux / cns21xx / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4
5 . /lib/cns21xx.sh
6
7 PART_NAME=firmware
8 RAMFS_COPY_DATA=/lib/cns21xx.sh
9
10 platform_check_image() {
11 local board=$(get_board_name)
12 local magic="$(get_magic_word "$1")"
13
14 [ "$ARGC" -gt 1 ] && return 1
15
16 case "$board" in
17 nsb3ast)
18 [ "$magic" != "0b1c" ] && {
19 echo "Invalid image type."
20 return 1
21 }
22 return 0
23 ;;
24 ns-k330)
25 [ "$magic" != "0c1c" ] && {
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 disable_watchdog() {
38 killall watchdog
39 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
40 echo 'Could not disable watchdog'
41 return 1
42 }
43 }
44
45 append sysupgrade_pre_upgrade disable_watchdog