55807f5f4476312da08dfa196da61d9de4c7a5d5
[openwrt/openwrt.git] / target / linux / mvebu / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2014 OpenWrt.org
3 #
4
5 . /lib/mvebu.sh
6
7 RAMFS_COPY_DATA=/lib/mvebu.sh
8
9 platform_check_image() {
10 local board=$(mvebu_board_name)
11 local magic_long="$(get_magic_long "$1")"
12
13 [ "$#" -gt 1 ] && return 1
14
15 case "$board" in
16 armada-xp-linksys-mamba )
17 [ "$magic_long" != "27051956" -a "$magic_long" != "73797375" ] && {
18 echo "Invalid image type."
19 return 1
20 }
21 return 0;
22 ;;
23 esac
24
25 echo "Sysupgrade is not yet supported on $board."
26 return 1
27 }
28
29 platform_do_upgrade() {
30 local board=$(mvebu_board_name)
31
32 case "$board" in
33 armada-xp-linksys-mamba)
34 platform_do_upgrade_linksys "$ARGV"
35 ;;
36 *)
37 default_do_upgrade "$ARGV"
38 ;;
39 esac
40 }
41
42 disable_watchdog() {
43 killall watchdog
44 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
45 echo 'Could not disable watchdog'
46 return 1
47 }
48 }
49
50 append sysupgrade_pre_upgrade disable_watchdog