ramips: add support for Netgear R7450
[openwrt/openwrt.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 dlink,dir-1960-a1|\
57 dlink,dir-2640-a1|\
58 dlink,dir-2660-a1|\
59 dlink,dir-853-a3|\
60 hiwifi,hc5962|\
61 jcg,q20|\
62 linksys,e5600|\
63 linksys,ea7300-v1|\
64 linksys,ea7300-v2|\
65 linksys,ea7500-v2|\
66 linksys,ea8100-v1|\
67 linksys,ea8100-v2|\
68 netgear,r6220|\
69 netgear,r6260|\
70 netgear,r6350|\
71 netgear,r6700-v2|\
72 netgear,r6800|\
73 netgear,r6850|\
74 netgear,r6900-v2|\
75 netgear,r7200|\
76 netgear,r7450|\
77 netgear,wac104|\
78 netgear,wac124|\
79 netis,wf2881|\
80 sercomm,na502|\
81 xiaomi,mi-router-3g|\
82 xiaomi,mi-router-3-pro|\
83 xiaomi,mi-router-4|\
84 xiaomi,mi-router-ac2100|\
85 xiaomi,redmi-router-ac2100)
86 nand_do_upgrade "$1"
87 ;;
88 iodata,wn-ax1167gr2|\
89 iodata,wn-ax2033gr|\
90 iodata,wn-dx1167r|\
91 iodata,wn-dx2033gr)
92 iodata_mstc_upgrade_prepare "0xfe75"
93 nand_do_upgrade "$1"
94 ;;
95 iodata,wn-dx1200gr)
96 iodata_mstc_upgrade_prepare "0x1fe75"
97 nand_do_upgrade "$1"
98 ;;
99 ubnt,edgerouter-x|\
100 ubnt,edgerouter-x-sfp)
101 platform_upgrade_ubnt_erx "$1"
102 ;;
103 zyxel,nr7101)
104 fw_setenv CheckBypass 0
105 fw_setenv Image1Stable 0
106 CI_KERNPART="Kernel"
107 nand_do_upgrade "$1"
108 ;;
109 zyxel,wap6805)
110 local kernel2_mtd="$(find_mtd_part Kernel2)"
111 [ "$(hexdump -n 4 -e '"%x"' $kernel2_mtd)" = "56190527" ] &&\
112 [ "$(hexdump -n 4 -s 104 -e '"%x"' $kernel2_mtd)" != "0" ] &&\
113 dd bs=4 count=1 seek=26 conv=notrunc if=/dev/zero of=$kernel2_mtd 2>/dev/null &&\
114 echo "Kernel2 sequence number was reset to 0"
115 CI_KERNPART="Kernel"
116 nand_do_upgrade "$1"
117 ;;
118 *)
119 default_do_upgrade "$1"
120 ;;
121 esac
122 }