3513ff4196b49683b7ea2ce8281d424267948b06
[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_long "$1")"
13
14 [ "$ARGC" -gt 1 ] && return 1
15
16 case "$board" in
17 3g-6200n | \
18 3g-6200nl | \
19 3g300m | \
20 w150m | \
21 air3gii | \
22 all0239-3g | \
23 all0256n | \
24 all5002 | \
25 all5003 | \
26 asl26555 | \
27 bc2 | \
28 broadway | \
29 carambola | \
30 d105 | \
31 dir-300-b1 | \
32 dir-600-b1 | \
33 dir-600-b2 | \
34 dir-615-h1 | \
35 dir-615-d | \
36 dir-620-a1 | \
37 dir-620-d1 | \
38 dap-1350 | \
39 esr-9753 | \
40 f7c027 | \
41 fonera20n | \
42 rt-n13u | \
43 freestation5 | \
44 hw550-3g | \
45 hg255d | \
46 mofi3500-3gn | \
47 mpr-a2 | \
48 mzk-w300nh2 | \
49 nbg-419n | \
50 nw718 | \
51 omni-emb | \
52 omni-emb-hpm | \
53 psr-680w | \
54 rt-g32-b1 | \
55 rt-n10-plus | \
56 rt-n15 | \
57 rt-n56u | \
58 sl-r7205 | \
59 tew-691gr | \
60 tew-692gr | \
61 w306r-v20 |\
62 w502u |\
63 wr6202 |\
64 v22rw-2x2 | \
65 wl341v3 | \
66 wl-330n | \
67 wl-330n3g | \
68 wl-351 | \
69 wnce2001 | \
70 wli-tx4-ag300n | \
71 whr-g300n |\
72 ur-326n4g |\
73 ur-336un |\
74 wr512-3gn)
75 [ "$magic" != "27051956" ] && {
76 echo "Invalid image type."
77 return 1
78 }
79 return 0
80 ;;
81 dir-645)
82 [ "$magic" != "5ea3a417" ] && {
83 echo "Invalid image type."
84 return 1
85 }
86 return 0
87 ;;
88 esac
89
90 echo "Sysupgrade is not yet supported on $board."
91 return 1
92 }
93
94 platform_do_upgrade() {
95 local board=$(ramips_board_name)
96
97 case "$board" in
98 *)
99 default_do_upgrade "$ARGV"
100 ;;
101 esac
102 }
103
104 disable_watchdog() {
105 killall watchdog
106 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
107 echo 'Could not disable watchdog'
108 return 1
109 }
110 }
111
112 append sysupgrade_pre_upgrade disable_watchdog