lede/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
Marcel Ziswiler 545c2478aa mediatek: add support for Netgear WAX206
Specifications:
* SoC: MediaTek MT7622BV
* RAM: DDR3 512 MiB (Nanya NT5CC256M16ER-EK)
* Flash: SPI-NAND 256 MiB (Toshiba TC58CVG1S3HRAIJ)
* Wi-Fi 2.4/5 GHz 4T4R:
  * 2.4 GHz: MediaTek MT7622BV
  * 5 GHz: MediaTek MT7915AN/MT7975AN
* Ethernet: 4x 10/100/1000 Mbps LAN,
            1x 10/100/1000/2500 Mbps WAN (Realtek RTL8221B PHY)
* Switch: MediaTek MT7531AE
* LEDs/Keys: 8/1 (Power, Internet, LAN1, LAN2, LAN3, LAN4,
             Wifin and Wifia dual-colour LEDs + Reset pin)
* UART: Marked J19 on board VCC GND TX RX, beginning from "1". 3.3v,
        115200n8
* Power: 12 VDC, 2.5 A

Installation:
* Flash the factory image through the stock web interface, or TFTP to
  the bootloader. NMRP can be used to TFTP without opening the case.
* U-Boot allows booting an initramfs image via TFTP as follows:
  setenv ipaddr 192.168.1.1
  setenv serverip 192.168.1.100
  tftpboot openwrt-mediatek-mt7622-netgear_wax206-initramfs-recovery.itb
  bootm

Known Limitations:
* The 2.5G WAN port labeled 'wan' only works for speeds up to 1G at the
  moment. If connected to a multi-gig port the speed has to be manually
  set to 1G/full either for the switch port or in OpenWrt. For example
  add the following to /etc/rc.local to set it on boot:
  /usr/sbin/ethtool -s wan speed 1000 duplex full

Revert to stock firmware:
* Flash the stock firmware to the bootloader using TFTP/NMRP.

References to WAX206 GPL source:
https://www.downloads.netgear.com/files/GPL/WAX206_V1.0.4.0_Source.rar

* openwrt/target/linux/mediatek/dts/mt7622-netgear-wax206.dts
  DTS file for this device.
* openwrt/target/linux/mediatek/image/mt7622.mk
  Image creation code for this device

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
[fix WAN port, adjust partition layout and image creation]
Signed-off-by: Thomas Kupper <thomas.kupper@gmail.com>
2023-02-20 23:29:12 +08:00

103 lines
1.8 KiB
Bash
Executable File

REQUIRE_IMAGE_METADATA=1
platform_do_upgrade() {
local board=$(board_name)
local file_type=$(identify $1)
case "$board" in
bananapi,bpi-r64)
local rootdev="$(cmdline_get_var root)"
rootdev="${rootdev##*/}"
rootdev="${rootdev%p[0-9]*}"
case "$rootdev" in
mmc*)
CI_ROOTDEV="$rootdev"
CI_KERNPART="production"
emmc_do_upgrade "$1"
;;
*)
CI_KERNPART="fit"
nand_do_upgrade "$1"
;;
esac
;;
buffalo,wsr-2533dhp2)
local magic="$(get_magic_long "$1")"
# use "mtd write" if the magic is "DHP2 (0x44485032)"
# or "DHP3 (0x44485033)"
if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then
buffalo_upgrade_ubinized "$1"
else
CI_KERNPART="firmware"
nand_do_upgrade "$1"
fi
;;
elecom,wrc-x3200gst3|\
mediatek,mt7622-rfb1-ubi|\
netgear,wax206|\
totolink,a8000ru|\
xiaomi,redmi-router-ax6s)
nand_do_upgrade "$1"
;;
linksys,e8450-ubi)
CI_KERNPART="fit"
nand_do_upgrade "$1"
;;
linksys,e8450)
if grep -q mtdparts=slave /proc/cmdline; then
PART_NAME=firmware2
else
PART_NAME=firmware1
fi
default_do_upgrade "$1"
;;
*)
default_do_upgrade "$1"
;;
esac
}
PART_NAME=firmware
platform_check_image() {
local board=$(board_name)
local magic="$(get_magic_long "$1")"
[ "$#" -gt 1 ] && return 1
case "$board" in
buffalo,wsr-2533dhp2)
buffalo_check_image "$board" "$magic" "$1" || return 1
;;
elecom,wrc-x3200gst3|\
mediatek,mt7622-rfb1-ubi|\
netgear,wax206|\
totolink,a8000ru|\
xiaomi,redmi-router-ax6s)
nand_do_platform_check "$board" "$1"
;;
*)
[ "$magic" != "d00dfeed" ] && {
echo "Invalid image type."
return 1
}
return 0
;;
esac
return 0
}
platform_copy_config() {
case "$(board_name)" in
bananapi,bpi-r64)
export_bootdevice
export_partdevice rootdev 0
if echo $rootdev | grep -q mmc; then
emmc_copy_config
fi
;;
esac
}