mvebu: add sysupgrade support for clearfog
[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-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-shelby|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 armada-388-clearfog)
24 platform_check_image_clearfog "$ARGV"
25 return $?
26 ;;
27 esac
28
29 echo "Sysupgrade is not yet supported on $board."
30 return 1
31 }
32
33 platform_do_upgrade() {
34 local board=$(mvebu_board_name)
35
36 case "$board" in
37 armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-shelby|armada-xp-linksys-mamba)
38 platform_do_upgrade_linksys "$ARGV"
39 ;;
40 armada-388-clearfog)
41 platform_do_upgrade_clearfog "$ARGV"
42 ;;
43 *)
44 default_do_upgrade "$ARGV"
45 ;;
46 esac
47 }
48 platform_copy_config() {
49 local board=$(mvebu_board_name)
50
51 case "$board" in
52 armada-388-clearfog)
53 platform_copy_config_clearfog "$ARGV"
54 ;;
55 esac
56 }
57
58 disable_watchdog() {
59 killall watchdog
60 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
61 echo 'Could not disable watchdog'
62 return 1
63 }
64 }
65
66 append sysupgrade_pre_upgrade disable_watchdog