ramips: add user space support for the DIR-645
[openwrt/openwrt.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 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" != "27051956" ] && {
55 echo "Invalid image type."
56 return 1
57 }
58 return 0
59 ;;
60 dir-645)
61 [ "$magic" != "5ea3a417" ] && {
62 echo "Invalid image type."
63 return 1
64 }
65 return 0
66 ;;
67 esac
68
69 echo "Sysupgrade is not yet supported on $board."
70 return 1
71 }
72
73 platform_do_upgrade() {
74 local board=$(ramips_board_name)
75
76 case "$board" in
77 *)
78 default_do_upgrade "$ARGV"
79 ;;
80 esac
81 }
82
83 disable_watchdog() {
84 killall watchdog
85 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
86 echo 'Could not disable watchdog'
87 return 1
88 }
89 }
90
91 append sysupgrade_pre_upgrade disable_watchdog