ramips: add support for Linksys EA7500 v2
[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 mikrotik,routerboard-750gr3|\
31 mikrotik,routerboard-m11g|\
32 mikrotik,routerboard-m33g)
33 [ -z "$(rootfs_type)" ] && mtd erase firmware
34 ;;
35 asus,rt-ac65p|\
36 asus,rt-ac85p)
37 echo "Backing up firmware"
38 dd if=/dev/mtd4 bs=1024 count=4096 > /tmp/backup_firmware.bin
39 dd if=/dev/mtd5 bs=1024 count=52224 >> /tmp/backup_firmware.bin
40 mtd -e firmware2 write /tmp/backup_firmware.bin firmware2
41 ;;
42 esac
43
44 case "$board" in
45 asus,rt-ac65p|\
46 asus,rt-ac85p|\
47 hiwifi,hc5962|\
48 linksys,ea7500-v2|\
49 netgear,r6220|\
50 netgear,r6260|\
51 netgear,r6350|\
52 netgear,r6700-v2|\
53 netgear,r6800|\
54 netgear,r6850|\
55 netis,wf2881|\
56 xiaomi,mir3g|\
57 xiaomi,mir3p)
58 nand_do_upgrade "$1"
59 ;;
60 iodata,wn-ax1167gr2|\
61 iodata,wn-ax2033gr|\
62 iodata,wn-dx1167r)
63 iodata_mstc_upgrade_prepare
64 nand_do_upgrade "$1"
65 ;;
66 ubnt,edgerouter-x|\
67 ubnt,edgerouter-x-sfp)
68 platform_upgrade_ubnt_erx "$1"
69 ;;
70 *)
71 default_do_upgrade "$1"
72 ;;
73 esac
74 }