OSDN Git Service

ramips: Add support for SERCOMM NA502S
[immortalwrt/immortalwrt.git] / target / linux / ramips / mt7621 / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4
5 PART_NAME=firmware
6 REQUIRE_IMAGE_METADATA=1
7
8 RAMFS_COPY_BIN='fw_printenv fw_setenv'
9 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
10
11 platform_check_image() {
12         return 0
13 }
14
15 platform_do_upgrade() {
16         local board=$(board_name)
17
18         case "$board" in
19         alfa-network,quad-e4g)
20                 [ "$(fw_printenv -n dual_image 2>/dev/null)" = "1" ] &&\
21                 [ -n "$(find_mtd_part backup)" ] && {
22                         PART_NAME=backup
23                         if [ "$(fw_printenv -n bootactive 2>/dev/null)" = "1" ]; then
24                                 fw_setenv bootactive 2 || exit 1
25                         else
26                                 fw_setenv bootactive 1 || exit 1
27                         fi
28                 }
29                 ;;
30         ampedwireless,ally-00x19k|\
31         ampedwireless,ally-r1900k)
32                 if [ "$(fw_printenv --lock / -n bootImage 2>/dev/null)" != "0" ]; then
33                         fw_setenv --lock / bootImage 0 || exit 1
34                 fi
35                 ;;
36         mikrotik,routerboard-750gr3|\
37         mikrotik,routerboard-760igs|\
38         mikrotik,routerboard-m11g|\
39         mikrotik,routerboard-m33g)
40                 [ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware
41                 ;;
42         asus,rt-ac65p|\
43         asus,rt-ac85p)
44                 echo "Backing up firmware"
45                 dd if=/dev/mtd4 bs=1024 count=4096  > /tmp/backup_firmware.bin
46                 dd if=/dev/mtd5 bs=1024 count=52224 >> /tmp/backup_firmware.bin
47                 mtd -e firmware2 write /tmp/backup_firmware.bin firmware2
48                 ;;
49         esac
50
51         case "$board" in
52         ampedwireless,ally-00x19k|\
53         ampedwireless,ally-r1900k|\
54         asus,rt-ac65p|\
55         asus,rt-ac85p|\
56         beeline,smartbox-flash|\
57         dlink,dir-1960-a1|\
58         dlink,dir-2640-a1|\
59         dlink,dir-2660-a1|\
60         dlink,dir-853-a3|\
61         hiwifi,hc5962|\
62         iptime,a3004t|\
63         iptime,ax2004m|\
64         iptime,t5004|\
65         jcg,q20|\
66         linksys,e5600|\
67         linksys,ea6350-v4|\
68         linksys,ea7300-v1|\
69         linksys,ea7300-v2|\
70         linksys,ea7500-v2|\
71         linksys,ea8100-v1|\
72         linksys,ea8100-v2|\
73         netgear,r6220|\
74         netgear,r6260|\
75         netgear,r6350|\
76         netgear,r6700-v2|\
77         netgear,r6800|\
78         netgear,r6850|\
79         netgear,r6900-v2|\
80         netgear,r7200|\
81         netgear,r7450|\
82         netgear,wac104|\
83         netgear,wac124|\
84         netis,wf2881|\
85         raisecom,msg1500-x-00|\
86         sercomm,na502|\
87         sercomm,na502s|\
88         xiaomi,mi-router-3g|\
89         xiaomi,mi-router-3-pro|\
90         xiaomi,mi-router-4|\
91         xiaomi,mi-router-ac2100|\
92         xiaomi,mi-router-cr6606|\
93         xiaomi,mi-router-cr6608|\
94         xiaomi,mi-router-cr6609|\
95         xiaomi,redmi-router-ac2100)
96                 nand_do_upgrade "$1"
97                 ;;
98         iodata,wn-ax1167gr2|\
99         iodata,wn-ax2033gr|\
100         iodata,wn-dx1167r|\
101         iodata,wn-dx2033gr)
102                 iodata_mstc_upgrade_prepare "0xfe75"
103                 nand_do_upgrade "$1"
104                 ;;
105         iodata,wn-dx1200gr)
106                 iodata_mstc_upgrade_prepare "0x1fe75"
107                 nand_do_upgrade "$1"
108                 ;;
109         ubnt,edgerouter-x|\
110         ubnt,edgerouter-x-sfp)
111                 platform_upgrade_ubnt_erx "$1"
112                 ;;
113         zyxel,nr7101)
114                 fw_setenv CheckBypass 0
115                 fw_setenv Image1Stable 0
116                 CI_KERNPART="Kernel"
117                 nand_do_upgrade "$1"
118                 ;;
119         zyxel,wap6805)
120                 local kernel2_mtd="$(find_mtd_part Kernel2)"
121                 [ "$(hexdump -n 4 -e '"%x"' $kernel2_mtd)" = "56190527" ] &&\
122                 [ "$(hexdump -n 4 -s 104 -e '"%x"' $kernel2_mtd)" != "0" ] &&\
123                 dd bs=4 count=1 seek=26 conv=notrunc if=/dev/zero of=$kernel2_mtd 2>/dev/null &&\
124                 echo "Kernel2 sequence number was reset to 0"
125                 CI_KERNPART="Kernel"
126                 nand_do_upgrade "$1"
127                 ;;
128         *)
129                 default_do_upgrade "$1"
130                 ;;
131         esac
132 }