d7380f02970146081cca2911e0bc94d5a3ce20a5
[openwrt/svn-archive/archive.git] / target / linux / ramips / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4
5 . /lib/ramips.sh
6
7 PART_NAME=firmware
8 RAMFS_COPY_DATA=/lib/ramips.sh
9
10 platform_check_image() {
11 local board=$(ramips_board_name)
12 local magic="$(get_magic_word "$1")"
13
14 [ "$ARGC" -gt 1 ] && return 1
15
16 case "$board" in
17 3g-6200n | \
18 all0239-3g | \
19 all0256n | \
20 all5002 | \
21 bc2 | \
22 dir-300-b1 | \
23 dir-600-b1 | \
24 dir-600-b2 | \
25 dir-615-h1 | \
26 dir-620-a1 | \
27 dap-1350 | \
28 esr-9753 | \
29 fonera20n | \
30 freestation5 | \
31 hw550-3g | \
32 mofi3500-3gn | \
33 nbg-419n | \
34 nw718 | \
35 omni-emb | \
36 psr-680w | \
37 rt-g32-b1 | \
38 rt-n10-plus | \
39 rt-n15 | \
40 rt-n56u | \
41 sl-r7205 | \
42 w306r-v20 |\
43 w502u |\
44 wr6202 |\
45 v22rw-2x2 | \
46 wl341v3 | \
47 wl-330n | \
48 wl-351 | \
49 wli-tx4-ag300n | \
50 whr-g300n |\
51 ur-336un |\
52 wr512-3gn)
53 [ "$magic" != "2705" ] && {
54 echo "Invalid image type."
55 return 1
56 }
57 return 0
58 ;;
59 esac
60
61 echo "Sysupgrade is not yet supported on $board."
62 return 1
63 }
64
65 platform_do_upgrade() {
66 local board=$(ramips_board_name)
67
68 case "$board" in
69 *)
70 default_do_upgrade "$ARGV"
71 ;;
72 esac
73 }
74
75 disable_watchdog() {
76 killall watchdog
77 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
78 echo 'Could not disable watchdog'
79 return 1
80 }
81 }
82
83 append sysupgrade_pre_upgrade disable_watchdog