5ebf42a85d02e6ac5c5405de2ac29f60604baa05
[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 carambola | \
23 dir-300-b1 | \
24 dir-600-b1 | \
25 dir-600-b2 | \
26 dir-615-h1 | \
27 dir-620-a1 | \
28 dap-1350 | \
29 esr-9753 | \
30 fonera20n | \
31 freestation5 | \
32 hw550-3g | \
33 mofi3500-3gn | \
34 nbg-419n | \
35 nw718 | \
36 omni-emb | \
37 psr-680w | \
38 rt-g32-b1 | \
39 rt-n10-plus | \
40 rt-n15 | \
41 rt-n56u | \
42 sl-r7205 | \
43 w306r-v20 |\
44 w502u |\
45 wr6202 |\
46 v22rw-2x2 | \
47 wl341v3 | \
48 wl-330n | \
49 wl-351 | \
50 wli-tx4-ag300n | \
51 whr-g300n |\
52 ur-336un |\
53 wr512-3gn)
54 [ "$magic" != "2705" ] && {
55 echo "Invalid image type."
56 return 1
57 }
58 return 0
59 ;;
60 esac
61
62 echo "Sysupgrade is not yet supported on $board."
63 return 1
64 }
65
66 platform_do_upgrade() {
67 local board=$(ramips_board_name)
68
69 case "$board" in
70 *)
71 default_do_upgrade "$ARGV"
72 ;;
73 esac
74 }
75
76 disable_watchdog() {
77 killall watchdog
78 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
79 echo 'Could not disable watchdog'
80 return 1
81 }
82 }
83
84 append sysupgrade_pre_upgrade disable_watchdog