Hardware -------- SOC: MediaTek MT7981 RAM: 512MB DDR4 FLASH: 128MB SPI-NAND WIFI: Mediatek MT7915 (integrated) 2x2 802.11ax 2.4 / 5 GHz ETH: Mediatek MT7981 internal 1 GbE PHY UART: 3V3 115200 8N1 (Pinout silkscreened / Do not connect VCC)
Installation ------------ 1. Download the OpenWrt initramfs image. Copy the image to a TFTP server 2. Connect the TFTP server to the EAX17. Conect to the serial console, interrupt the autoboot process by pressing '0' when prompted. 3. Download & Boot the OpenWrt initramfs image. $ tftpboot openwrt.bin $ bootm 4. Wait for OpenWrt to boot. Transfer the sysupgrade image to the device using scp and install using sysupgrade. $ sysupgrade -n <path-to-sysupgrade.bin> Signed-off-by: Jascha Sundaresan <[email protected]> --- include/image-commands.mk | 1 + scripts/mkits.sh | 32 ++- .../mediatek/dts/mt7981b-netgear-eax17.dts | 241 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 11 + .../filogic/base-files/etc/board.d/02_network | 17 ++ .../filogic/base-files/etc/init.d/eax17-ledq | 26 ++ .../base-files/etc/uci-defaults/99-eax17-ledq | 6 + .../base-files/lib/upgrade/platform.sh | 11 + target/linux/mediatek/image/filogic.mk | 34 +++ 9 files changed, 378 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/dts/mt7981b-netgear-eax17.dts create mode 100644 target/linux/mediatek/filogic/base-files/etc/init.d/eax17-ledq create mode 100644 target/linux/mediatek/filogic/base-files/etc/uci-defaults/99-eax17-ledq diff --git a/include/image-commands.mk b/include/image-commands.mk index 7b2b346aa6..b0c71909fc 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -439,6 +439,7 @@ define Build/fit -d $(KERNEL_BUILD_DIR)/image-$$(basename $(word 2,$(1))), \ -d $(word 2,$(1)))) \ $(if $(findstring with-rootfs,$(word 3,$(1))),-r $(IMAGE_ROOTFS)) \ + $(if $(findstring with-netgear-rootfs-node,$(word 3,$(1))),-R $(KERNEL_BUILD_DIR)/root.squashfs) \ $(if $(findstring with-initrd,$(word 3,$(1))), \ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \ -i $(KERNEL_BUILD_DIR)/initrd$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))).cpio$(strip $(call Build/initrd_compression)))) \ diff --git a/scripts/mkits.sh b/scripts/mkits.sh index 46ab5ee023..047034d5ab 100755 --- a/scripts/mkits.sh +++ b/scripts/mkits.sh @@ -31,6 +31,7 @@ usage() { printf "\n\t-n ==> fdt unit-address 'address'" printf "\n\t-d ==> include Device Tree Blob 'dtb'" printf "\n\t-r ==> include RootFS blob 'rootfs'" + printf "\n\t-R ==> include Netgear style top level RootFS blob 'rootfs'" printf "\n\t-H ==> specify hash algo instead of SHA1" printf "\n\t-l ==> legacy mode character (@ etc otherwise -)" printf "\n\t-o ==> create output file 'its_file'" @@ -49,7 +50,7 @@ LOADABLES= DTOVERLAY= DTADDR= -while getopts ":A:a:c:C:D:d:e:f:i:k:l:n:o:O:v:r:s:H:" OPTION +while getopts ":A:a:c:C:D:d:e:f:i:k:l:n:o:O:v:r:R:s:H:" OPTION do case $OPTION in A ) ARCH=$OPTARG;; @@ -67,6 +68,7 @@ do o ) OUTPUT=$OPTARG;; O ) DTOVERLAY="$DTOVERLAY ${OPTARG}";; r ) ROOTFS=$OPTARG;; + R ) ROOTFS_FILE=$OPTARG;; s ) FDTADDR=$OPTARG;; H ) HASH=$OPTARG;; v ) VERSION=$OPTARG;; @@ -156,6 +158,32 @@ if [ -n "${ROOTFS}" ]; then LOADABLES="${LOADABLES:+$LOADABLES, }\"rootfs${REFERENCE_CHAR}${ROOTFSNUM}\"" fi +if [ -f "${ROOTFS_FILE}" ]; then + ROOTFS_SIZE=$(stat -c %s ${ROOTFS_FILE}) + + ROOTFS_SHA1=$( + sha1sum "${ROOTFS_FILE}" | \ + awk '{ + print "<0x" substr($0, 1, 8) \ + " 0x" substr($0, 9, 8) \ + " 0x" substr($0, 17, 8) \ + " 0x" substr($0, 25, 8) \ + " 0x" substr($0, 33, 8) ">" + }' + ) + + TOP_LEVEL_ROOTFS=" + rootfs { + size = <${ROOTFS_SIZE}>; + + hash-1 { + value = ${ROOTFS_SHA1}; + algo = \"sha1\"; + }; + }; +" +fi + # add DT overlay blobs FDTOVERLAY_NODE="" OVCONFIGS="" @@ -222,6 +250,8 @@ ${FDTOVERLAY_NODE} ${ROOTFS_NODE} }; +${TOP_LEVEL_ROOTFS} + configurations { default = \"${CONFIG}\"; ${CONFIG} { diff --git a/target/linux/mediatek/dts/mt7981b-netgear-eax17.dts b/target/linux/mediatek/dts/mt7981b-netgear-eax17.dts new file mode 100644 index 0000000000..d33ccd13bf --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-netgear-eax17.dts @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include "mt7981b.dtsi" + +/ { + model = "Netgear EAX17"; + compatible = "netgear,eax17", "mediatek,mt7981-spim-snand-rfb"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_red; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x20000000>; + device_type = "memory"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = <KEY_RESTART>; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = <KEY_WPS_BUTTON>; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_POWER; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_power_red: power_red { + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_POWER; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led_rlink_red: rlink_red { + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_LAN; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + }; + + led_rlink_green: rlink_green { + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_LAN; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led_clink_red: clink_red { + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_WAN; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + led_clink_green: clink_green { + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WAN; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_wps_green: wps_green { + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WPS; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + led_lan_speed_fast: lan_speed_fast { + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_STATUS; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + led_lan_speed_slow: lan_speed_slow { + color = <LED_COLOR_ID_YELLOW>; + function = LED_FUNCTION_STATUS; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + }; + +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + status = "disabled"; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + }; +}; + + +&crypto { + status = "okay"; +}; + +&pio { + spi_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = <MTK_DRIVE_8mA>; + bias-pull-up = <MTK_PUPD_SET_R1R0_11>; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = <MTK_DRIVE_8mA>; + bias-pull-down = <MTK_PUPD_SET_R1R0_11>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand_flash: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <20000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions { + #address-cells = <1>; + #size-cells = <1>; + compatible = "fixed-partitions"; + + partition@0 { + label = "bl2"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "factory"; + reg = <0x180000 0x200000>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + + partition@380000 { + label = "fip"; + reg = <0x380000 0x0200000>; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x5000000>; + }; + + partition@5580000 { + label = "facenv"; + reg = <0x5580000 0x200000>; + }; + + partition@5780000 { + label = "rae"; + reg = <0x5780000 0x600000>; + }; + + partition@5D80000 { + label = "pot"; + reg = <0x5D80000 0x020000>; + }; + + partition@5DA0000 { + label = "log"; + reg = <0x5DA0000 0x040000>; + }; + + }; + }; +}; + +&xhci { + status = "disabled"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&pcie { + status = "disabled"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 7e4512f30f..785ddecffa 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -115,6 +115,17 @@ netcore,n60-pro) ucidef_set_led_netdev "wanact" "WANACT" "mdio-bus:06:green:wan" "eth1" "tx rx" ucidef_set_led_netdev "wanlink" "WANLINK" "blue:wan" "eth1" "link" ;; +netgear,eax17) + ucidef_set_led_default power_green "Power (green)" green:power 1 + ucidef_set_led_default power_red "Power (red)" red:power 0 + ucidef_set_led_default rlink_red "Client (red)" red:lan 0 + ucidef_set_led_default clink_red "Router (red)" red:wan 0 + ucidef_set_led_wps wps_green "WPS (green)" green:wps + ucidef_set_led_netdev lan_speed_fast "LAN Link (green)" green:status eth0 + uci -q set system.lan_speed_fast.mode='link' + ucidef_set_led_netdev lan_speed_slow "LAN Activity (yellow)" yellow:status eth0 + uci -q set system.lan_speed_slow.mode='tx rx' + ;; netgear,wax220) ucidef_set_led_netdev "eth0" "LAN" "green:lan" "eth0" ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 95af3b04e3..c242397ca6 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -99,6 +99,13 @@ mediatek_setup_interfaces() cudy,ap3000outdoor-v1|\ cudy,ap3000-v1|\ cudy,re3000-v1|\ + netgear,eax17|\ + netgear,eax11v3|\ + netgear,eax15v3|\ + netgear,eax14v3|\ + netgear,eax12v2|\ + netgear,eax16|\ + netgear,eax19|\ netgear,wax220|\ openfi,6c|\ ubnt,unifi-6-plus|\ @@ -212,6 +219,16 @@ mediatek_setup_macs() label_mac=$(get_mac_binary "/tmp/tp_data/default-mac" 0) lan_mac=$label_mac ;; + netgear,eax17|\ + netgear,eax11v3|\ + netgear,eax15v3|\ + netgear,eax14v3|\ + netgear,eax12v2|\ + netgear,eax16|\ + netgear,eax19) + lan_mac=$(grep -aoE '([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}' /dev/ubi0_0 | head -n1) + label_mac=$lan_mac + ;; netgear,wax220) lan_mac=$(mtd_get_mac_ascii u-boot-env mac) label_mac=$lan_mac diff --git a/target/linux/mediatek/filogic/base-files/etc/init.d/eax17-ledq b/target/linux/mediatek/filogic/base-files/etc/init.d/eax17-ledq new file mode 100644 index 0000000000..4fdab0ebb8 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/init.d/eax17-ledq @@ -0,0 +1,26 @@ +#!/bin/sh /etc/rc.common +# SPDX-License-Identifier: (GPL-2.0 OR MIT) + +START=69 +USE_PROCD=1 +NAME=eax17-ledq +start_service() { + procd_open_instance + procd_set_param command /bin/sh -c ' +GOOD=-60; OK=-75; BAD=-90 +on(){ echo 1 > "/sys/class/leds/$1/brightness"; } +off(){ echo 0 > "/sys/class/leds/$1/brightness"; } +set_color(){ g="green:$1"; r="red:$1"; case "$2" in off)off "$g";off "$r";; green)on "$g";off "$r";; amber)on "$g";on "$r";; red)off "$g";on "$r";; esac; } +uplink_iface(){ iw dev 2>/dev/null | awk "/Interface/{i=\$2} /type managed/ {print i; exit}"; } +best_client_dbm(){ for i in $(iw dev 2>/dev/null | awk "/Interface/{i=\$2} /type AP/ {print i}"); do iw dev "$i" station dump 2>/dev/null | awk "/signal:/ {print \$2}"; done | sort -nr | head -n1; } +quality(){ v=$1; [ -z "$v" ] && { echo off; return; }; [ "$v" -ge "$GOOD" ] && { echo green; return; }; [ "$v" -ge "$OK" ] && { echo amber; return; }; [ "$v" -ge "$BAD" ] && { echo red; return; }; echo red; } +while :; do + uplink_dbm=$(iw dev "$(uplink_iface)" link 2>/dev/null | awk "/signal:/ {print \$2}") + set_color wan "$(quality "$uplink_dbm")" + set_color lan "$(quality "$(best_client_dbm)")" + sleep 2 +done' + procd_set_param respawn 2000 1 0 + procd_close_instance +} + diff --git a/target/linux/mediatek/filogic/base-files/etc/uci-defaults/99-eax17-ledq b/target/linux/mediatek/filogic/base-files/etc/uci-defaults/99-eax17-ledq new file mode 100644 index 0000000000..ba61b18f68 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/uci-defaults/99-eax17-ledq @@ -0,0 +1,6 @@ +#!/bin/sh +# SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/etc/init.d/eax17-ledq enable +/etc/init.d/eax17-ledq start +exit 0 diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 0e2e84c791..1e9d278c1e 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -227,6 +227,17 @@ platform_do_upgrade() { CI_ROOT_UBIPART=ubi nand_do_upgrade "$1" ;; + netgear,eax17) + echo "UPGRADING SECOND SLOT" + CI_KERNPART="kernel2" + CI_ROOTPART="rootfs2" + nand_do_flash_file "$1" || nand_do_upgrade_failed + echo "UPGRADING PRIMARY SLOT" + CI_KERNPART="kernel" + CI_ROOTPART="rootfs" + nand_do_flash_file "$1" || nand_do_upgrade_failed + nand_do_upgrade_success + ;; *) nand_do_upgrade "$1" ;; diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 908c63ef66..5c8d306df8 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1718,6 +1718,40 @@ define Device/netcore_n60-pro endef TARGET_DEVICES += netcore_n60-pro +define Device/netgear_eax17 + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := EAX17 + DEVICE_ALT0_VENDOR := NETGEAR + DEVICE_ALT0_MODEL := EAX11 + DEVICE_ALT0_VARIANT := v3 + DEVICE_ALT1_VENDOR := NETGEAR + DEVICE_ALT1_MODEL := EAX15 + DEVICE_ALT1_VARIANT := v3 + DEVICE_ALT2_VENDOR := NETGEAR + DEVICE_ALT2_MODEL := EAX14 + DEVICE_ALT2_VARIANT := v3 + DEVICE_ALT3_VENDOR := NETGEAR + DEVICE_ALT3_MODEL := EAX12 + DEVICE_ALT3_VARIANT := v2 + DEVICE_ALT4_VENDOR := NETGEAR + DEVICE_ALT4_MODEL := EAX16 + DEVICE_ALT5_VENDOR := NETGEAR + DEVICE_ALT5_MODEL := EAX19 + DEVICE_DTS := mt7981b-netgear-eax17 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + KERNEL = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-netgear-rootfs-node + KERNEL_IN_UBI := 1 + IMAGE_SIZE := 81920k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += netgear_eax17 + define Device/netgear_wax220 DEVICE_VENDOR := NETGEAR DEVICE_MODEL := WAX220 -- 2.39.5 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
