filogic: add support for Netgear EAX17
authorJascha Sundaresan <[email protected]>
Thu, 18 Sep 2025 18:32:41 +0000 (22:32 +0400)
committerHauke Mehrtens <[email protected]>
Sun, 23 Nov 2025 23:57:19 +0000 (00:57 +0100)
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]>
Link: https://github.com/openwrt/openwrt/pull/20354
Signed-off-by: Hauke Mehrtens <[email protected]>
include/image-commands.mk
scripts/gen_netgear_rootfs_node.sh [new file with mode: 0755]
target/linux/generic/backport-6.12/010-v6.19-nvmem-layouts-u-boot-env-add-optional-env-size-property.patch [new file with mode: 0644]
target/linux/mediatek/dts/mt7981b-netgear-eax17.dts [new file with mode: 0644]
target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
target/linux/mediatek/filogic/base-files/etc/board.d/02_network
target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
target/linux/mediatek/filogic/config-6.12
target/linux/mediatek/image/filogic.mk

index a9a3d1324152ebef39740cf32c474e6ee5c22b6d..feeeb5b0745f39d9a1384888fc5c326225b68eea 100644 (file)
@@ -430,7 +430,7 @@ define Build/initrd_compression
        $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd)
 endef
 
-define Build/fit
+define Build/fit-its
        $(if $(findstring with-rootfs,$(word 3,$(1))), \
                $(call locked,dd if=$(IMAGE_ROOTFS) of=$(IMAGE_ROOTFS).pagesync bs=4096 conv=sync, \
                  gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME)))))
@@ -452,12 +452,20 @@ define Build/fit
                $(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
                -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
                -A $(LINUX_KARCH) -v $(LINUX_VERSION)
+endef
+
+define Build/fit-image
        $(call locked,PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
                -E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f [email protected] [email protected], \
          gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))))
        @mv [email protected] $@
 endef
 
+define Build/fit
+       $(call Build/fit-its,$(1))
+       $(call Build/fit-image,$(1))
+endef
+
 define Build/libdeflate-gzip
        $(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > [email protected]
        @mv [email protected] $@
diff --git a/scripts/gen_netgear_rootfs_node.sh b/scripts/gen_netgear_rootfs_node.sh
new file mode 100755 (executable)
index 0000000..b9e6b6b
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Author: Jascha Sundaresan <[email protected]>
+#
+# This helper script generates a top-level 'rootfs' node for inclusion
+# in a Flattened Image Tree (FIT) source (.its) file.  The node includes
+# the size and SHA1 hash of a given root filesystem image and is used by
+# certain Netgear devices which expect this metadata at the top level of
+# the FIT structure.
+#
+# The resulting block is written to standard output and can be appended
+# or inserted into an existing .its file by the OpenWrt build system.
+# Example:
+#     scripts/gen_netgear_rootfs_node.sh build_dir/.../root.squashfs > node.txt
+#
+# See also: scripts/mkits.sh, which generates the main FIT .its source.
+
+ROOTFS_FILE="$1"
+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) ">" }'
+)
+cat <<EOF | sed 's/^/\t/'
+rootfs {
+       size = <${ROOTFS_SIZE}>;
+
+       hash-1 {
+               value = ${ROOTFS_SHA1};
+               algo = "sha1";
+       };
+};
+
+EOF
diff --git a/target/linux/generic/backport-6.12/010-v6.19-nvmem-layouts-u-boot-env-add-optional-env-size-property.patch b/target/linux/generic/backport-6.12/010-v6.19-nvmem-layouts-u-boot-env-add-optional-env-size-property.patch
new file mode 100644 (file)
index 0000000..207161a
--- /dev/null
@@ -0,0 +1,62 @@
+From 06e92afca89075628b12c9b4085b4cc7320081ac Mon Sep 17 00:00:00 2001
+From: Jascha Sundaresan <[email protected]>
+Date: Thu, 23 Oct 2025 03:07:41 +0400
+Subject: nvmem: layouts: u-boot-env: add optional "env-size" property
+
+Some devices reserve a larger NVMEM region for the U-Boot environment
+than the actual environment data length used by U-Boot itself. The CRC32
+in the U-Boot header is calculated over the smaller data length, causing
+CRC validation to fail when Linux reads the full partition.
+
+Allow an optional device tree property "env-size" to specify the
+environment data size to use for CRC computation.
+
+v2: add missing $ref line to DT binding
+
+Signed-off-by: Jascha Sundaresan <[email protected]>
+Reviewed-by: Rob Herring (Arm) <[email protected]>
+Signed-off-by: Srinivas Kandagatla <[email protected]>
+---
+ Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml | 7 +++++++
+ drivers/nvmem/layouts/u-boot-env.c                              | 4 +++-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+--- a/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml
++++ b/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml
+@@ -46,6 +46,12 @@ properties:
+     type: object
+     description: Command to use for automatic booting
++  env-size:
++    description:
++      Size in bytes of the environment data used by U-Boot for CRC
++      calculation. If omitted, the full NVMEM region size is used.
++    $ref: /schemas/types.yaml#/definitions/uint32
++
+   ethaddr:
+     type: object
+     description: Ethernet interfaces base MAC address.
+@@ -104,6 +110,7 @@ examples:
+             partition-u-boot-env {
+                 compatible = "brcm,env";
++                env-size = <0x20000>;
+                 ethaddr {
+                 };
+--- a/drivers/nvmem/layouts/u-boot-env.c
++++ b/drivers/nvmem/layouts/u-boot-env.c
+@@ -99,10 +99,12 @@ int u_boot_env_parse(struct device *dev,
+       uint32_t crc32;
+       uint32_t calc;
+       uint8_t *buf;
++      u32 env_size;
+       int bytes;
+       int err;
+-      dev_size = nvmem_dev_size(nvmem);
++      dev_size = device_property_read_u32(dev, "env-size", &env_size) ?
++              nvmem_dev_size(nvmem) : (size_t)env_size;
+       buf = kzalloc(dev_size, GFP_KERNEL);
+       if (!buf) {
diff --git a/target/linux/mediatek/dts/mt7981b-netgear-eax17.dts b/target/linux/mediatek/dts/mt7981b-netgear-eax17.dts
new file mode 100644 (file)
index 0000000..a478d53
--- /dev/null
@@ -0,0 +1,272 @@
+// 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>;
+               };
+
+       };
+
+};
+
+&eth {
+       status = "okay";
+
+       gmac0: mac@0 {
+               status = "disabled";
+       };
+
+       gmac1: mac@1 {
+               compatible = "mediatek,eth-mac";
+               reg = <1>;
+               phy-mode = "gmii";
+               phy-handle = <&int_gbe_phy>;
+
+               nvmem-cells = <&ethaddr 0>;
+               nvmem-cell-names = "mac-address";
+       };
+};
+
+&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 = <52000000>;
+               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>;
+                               compatible = "nvmem-cells";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0x1000>;
+                               };
+                       };
+
+                       partition@380000 {
+                               label = "fip";
+                               reg = <0x380000 0x0200000>;
+                       };
+
+                       partition@580000 {
+                               label = "ubi";
+                               reg = <0x580000 0x5000000>;
+                               compatible = "linux,ubi";
+
+                               volumes {
+                                       ubi-volume-u-boot-env {
+                                               volname = "u-boot-env";
+
+                                               nvmem-layout {
+                                                       compatible = "u-boot,env";
+                                                       env-size = <0x80000>;
+
+                                                       ethaddr: ethaddr {
+                                                               #nvmem-cell-cells = <1>;
+                                                       };
+                                               };
+                                       };
+                               };
+                       };
+
+                       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";
+
+       band@0 {
+               reg = <0>;
+               nvmem-cells = <&ethaddr 2>;
+               nvmem-cell-names = "mac-address";
+       };
+
+       band@1 {
+               reg = <1>;
+               nvmem-cells = <&ethaddr 3>;
+               nvmem-cell-names = "mac-address";
+       };
+};
+
+&pcie {
+       status = "disabled";
+};
index 7afd9927bd2ebe9c38eb75c17f34c378cde358ff..20a53671e7b417566876ebe703e46021f5ae36d4 100644 (file)
@@ -122,6 +122,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"
        ;;
index d9388bd756d85c4445818f5e7576009980705a02..54a68bf57f36f5116ed9db9d49a78c489174c66b 100644 (file)
@@ -106,6 +106,7 @@ mediatek_setup_interfaces()
        cudy,ap3000outdoor-v1|\
        cudy,ap3000-v1|\
        cudy,re3000-v1|\
+       netgear,eax17|\
        netgear,wax220|\
        openfi,6c|\
        ubnt,unifi-6-plus|\
index 498cee3fe337256ac2a0aa17f149a61bb745bd50..3d9307249d63a2b308afe76d962cc44897b8c043 100755 (executable)
@@ -189,6 +189,17 @@ platform_do_upgrade() {
                CI_UBIPART="ubi0"
                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
+               ;;
        tplink,fr365-v1)
                CI_UBIPART="ubi"
                CI_KERNPART="kernel"
index 45e8617f0df274373a89863f2ab04e61c2bf44ca..9928fb309086051db1483bc17bd2429b91663c24 100644 (file)
@@ -337,8 +337,10 @@ CONFIG_NVMEM_AN8855_EFUSE=y
 CONFIG_NVMEM_BLOCK=y
 CONFIG_NVMEM_LAYOUTS=y
 CONFIG_NVMEM_LAYOUT_ADTRAN=y
+CONFIG_NVMEM_LAYOUT_U_BOOT_ENV=y
 CONFIG_NVMEM_MTK_EFUSE=y
 CONFIG_NVMEM_SYSFS=y
+CONFIG_NVMEM_U_BOOT_ENV=y
 CONFIG_OF=y
 CONFIG_OF_ADDRESS=y
 CONFIG_OF_DYNAMIC=y
index b3b6d787d40c3bc8b37fec301937f5df41064743..62a46fbc78503c8bf9ef43499916cd747d065cbc 100644 (file)
@@ -8,6 +8,15 @@ define Image/Prepare
        echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark
 endef
 
+define Build/fit-with-netgear-top-level-rootfs-node
+       $(call Build/fit-its,$(1))
+       $(TOPDIR)/scripts/gen_netgear_rootfs_node.sh $(KERNEL_BUILD_DIR)/root.squashfs > [email protected]
+       awk '/configurations/ { system("cat [email protected]") } 1' [email protected] > [email protected]
+       @mv -f [email protected] [email protected]
+       @rm -f [email protected]
+       $(call Build/fit-image,$(1))
+endef
+
 define Build/mt7981-bl2
        cat $(STAGING_DIR_IMAGE)/mt7981-$1-bl2.img >> $@
 endef
@@ -1981,6 +1990,48 @@ 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
+  NETGEAR_ENC_MODEL := EAX17
+  NETGEAR_ENC_REGION := US
+  NETGEAR_ENC_HW_ID_LIST := 1010000013120000_NETGEAR
+  NETGEAR_ENC_MODEL_LIST := EAX17;EAX11v3;EAX15v3;EAX14v3;EAX12v2;EAX16;EAX19
+  DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
+  KERNEL = kernel-bin | lzma | \
+       fit-with-netgear-top-level-rootfs-node lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+  KERNEL_IN_UBI := 1
+  IMAGE_SIZE := 81920k
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+  IMAGES += factory.img
+  # Padding to 10M seems to be required by OEM web interface
+  IMAGE/factory.img := sysupgrade-tar | \
+         pad-to 10M | check-size | netgear-encrypted-factory
+endef
+TARGET_DEVICES += netgear_eax17
+
 define Device/netgear_wax220
   DEVICE_VENDOR := NETGEAR
   DEVICE_MODEL := WAX220