From 9ec997b85009e5357d5f21ad579578d068af8fb7 Mon Sep 17 00:00:00 2001 From: Russell Senior Date: Tue, 1 Apr 2025 05:07:01 -0700 Subject: [PATCH 01/14] iproute2: update to v6.14.0 $ git log --no-merges --oneline v6.13.0..v6.14.0 fea1086c (tag: v6.14.0) v6.14.0 afbfd2f2 tc: nat: ffs should operation on host byte ordered data 667817b4 tc: nat: Fix mask calculation e3f9681d ss: mptcp: subflow: display seq counters as decimal 5e113aba man: document tunnel options in ip-route.8.in 48717184 README.devel: clarify patch rules and syntax 99c119a0 ss: Tone down cgroup path resolution 41710ace uapi: update bpf.h 1db4f568 ip: vxlan: Support IFLA_VXLAN_RESERVED_BITS fe4100df iproute2: add 'ip monitor acaddress' support d009b68f Update kernel headers 0bd19d46 iprule: Add flow label support 35ae138e ip: route: Add IPv6 flow label support 3f8c7e7c tc: fq: add support for TCA_FQ_OFFLOAD_HORIZON attribute 49b8a727 Update kernel headers 19514606 iproute2: add 'ip monitor maddress' support 93360313 Update kernel headers 1f0f9deb ip: link: rmnet: add support for flag handling Signed-off-by: Russell Senior --- package/network/utils/iproute2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 8cf77b36ab..6a172d2abe 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 -PKG_VERSION:=6.13.0 +PKG_VERSION:=6.14.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 -PKG_HASH:=a43aa43338d882b44d01e549f3f105a92ae9feea32a82fae45a88e7a49302819 +PKG_HASH:=a6d23588150096591c3d00fc27a324a82ee71d7a1a9eea78df5df17ad9b8461f PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 From aedd5b92785a1e2c15b6686298e42f62fe1bcac0 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 24 Mar 2025 22:58:49 +0200 Subject: [PATCH 02/14] rkbin: drop TFA_MAKE_FLAGS The rkbin package doesn't compile anything, so TFA_MAKE_FLAGS is unused. Suggested-by: Tianling Shen Signed-off-by: Stijn Tintel --- package/boot/rkbin/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/package/boot/rkbin/Makefile b/package/boot/rkbin/Makefile index fef19de7dc..d895c06547 100644 --- a/package/boot/rkbin/Makefile +++ b/package/boot/rkbin/Makefile @@ -71,9 +71,6 @@ TFA_TARGETS:= \ rk3568-e25 \ rk3588 -TFA_MAKE_FLAGS+= \ - $(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") - ifeq ($(BUILD_VARIANT),rk3308-rock-pi-s) TPL_FILE:=rk3308_ddr_589MHz_uart0_m0_v2.07.bin define Download/rk3308-tpl-rock-pi-s From 06c4e8a262e4618e61866ed92e296e46a1b6b671 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 25 Mar 2025 00:20:32 +0200 Subject: [PATCH 03/14] include/trusted-firmware-a.mk: support LTS releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TF-A LTS releases have an lts- prefix in their version tag. Introduce a PKG_LTS variable to support these. As the non-LTS tarbals do not contain the version prefix in the directory, we need different PKG_BUILD_DIR for each variant: ➜ tar --list --file dl/trusted-firmware-a-v2.12.tar.gz | head -n1 trusted-firmware-a-2.12/ ➜ tar --list --file dl/trusted-firmware-a-lts-v2.12.1.tar.gz | head -n1 trusted-firmware-a-lts-v2.12.1/ Signed-off-by: Stijn Tintel --- include/trusted-firmware-a.mk | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk index c329b76c56..422fc54e84 100644 --- a/include/trusted-firmware-a.mk +++ b/include/trusted-firmware-a.mk @@ -1,12 +1,20 @@ PKG_NAME ?= trusted-firmware-a PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a -ifndef PKG_SOURCE_PROTO -PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://codeload.github.com/TrustedFirmware-A/trusted-firmware-a/tar.gz/v$(PKG_VERSION)? +PKG_LTS ?= + +ifneq ($(PKG_LTS),) +PKG_VERSION_PREFIX:=lts-v +PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION_PREFIX)$(PKG_VERSION) +else +PKG_VERSION_PREFIX:=v +PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) endif -PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +ifndef PKG_SOURCE_PROTO +PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION_PREFIX)$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/TrustedFirmware-A/trusted-firmware-a/tar.gz/$(PKG_VERSION_PREFIX)$(PKG_VERSION)? +endif PKG_TARGETS := bin PKG_FLAGS:=nonshared @@ -83,7 +91,7 @@ define Build/Compile/Trusted-Firmware-A OPENSSL_DIR=$(STAGING_DIR_HOST) \ $(if $(DTC),DTC="$(DTC)") \ PLAT=$(PLAT) \ - BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ + BUILD_STRING="OpenWrt $(PKG_VERSION_PREFIX)$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ $(TFA_MAKE_FLAGS) endef From b1a2ebbd43cbbc0ce54438cf06dd11b24d1c7e74 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 18 Mar 2025 10:53:46 +0200 Subject: [PATCH 04/14] arm-trusted-firmware-rockchip: bump to 2.12.1 LTS And remove no-warn-rwx-segments hack, as this is no longer needed and actually causes build to fail. See also commit c117d7a37a74 ("include/trusted-firmware-a.mk: remove the no-warn-rwx-segments hack"). Signed-off-by: Stijn Tintel --- package/boot/arm-trusted-firmware-rockchip/Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/package/boot/arm-trusted-firmware-rockchip/Makefile b/package/boot/arm-trusted-firmware-rockchip/Makefile index 9073afe365..b517c9e37d 100644 --- a/package/boot/arm-trusted-firmware-rockchip/Makefile +++ b/package/boot/arm-trusted-firmware-rockchip/Makefile @@ -7,10 +7,11 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2.10 +PKG_VERSION:=2.12.1 PKG_RELEASE:=1 +PKG_LTS:=1 -PKG_HASH:=88215a62291b9ba87da8e50b077741103cdc08fb6c9e1ebd34dfaace746d3201 +PKG_HASH:=c0d432a851da452d927561feaf45f569c1cde57985782beadfe29e616e260440 PKG_MAINTAINER:=Sarah Maedel @@ -37,9 +38,6 @@ TFA_TARGETS:= \ rk3328 \ rk3399 -TFA_MAKE_FLAGS+= \ - $(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") - ifeq ($(BUILD_VARIANT),rk3399) M0_GCC_NAME:=gcc-arm M0_GCC_RELEASE:=11.2-2022.02 From c891ad99f8de6cfee754eb38ec9c8deceed49912 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 18 Mar 2025 10:56:25 +0200 Subject: [PATCH 05/14] arm-trusted-firmware-rockchip: support rk3588 ATF supports rk3588 since version 2.12, so let's enable it in arm-trusted-firmware-rockchip. We still need the TPL to initialize RAM, but keeping rk3588 in rkbin would cause a duplicate package name, so rename rk3588 to rk3588-tpl in rkbin. Finally, point uboot-rockchip for rk3588 to bl31 built by this package, and add a dependency on the new trusted-firmware-a-rk3588-tpl pacakge. While this doesn't necessarily add features, we now no longer rely on the rk3588_bl31_v1.45.elf blob provided by Rockchip, which is always a good thing. Tested on Radxa ROCK 5B+. Signed-off-by: Stijn Tintel --- package/boot/arm-trusted-firmware-rockchip/Makefile | 8 +++++++- package/boot/rkbin/Makefile | 7 ++++--- package/boot/uboot-rockchip/Makefile | 6 ++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/package/boot/arm-trusted-firmware-rockchip/Makefile b/package/boot/arm-trusted-firmware-rockchip/Makefile index b517c9e37d..7ed8e9d328 100644 --- a/package/boot/arm-trusted-firmware-rockchip/Makefile +++ b/package/boot/arm-trusted-firmware-rockchip/Makefile @@ -34,9 +34,15 @@ define Trusted-Firmware-A/rk3399 PLAT:=rk3399 endef +define Trusted-Firmware-A/rk3588 + BUILD_SUBTARGET:=armv8 + PLAT:=rk3588 +endef + TFA_TARGETS:= \ rk3328 \ - rk3399 + rk3399 \ + rk3588 ifeq ($(BUILD_VARIANT),rk3399) M0_GCC_NAME:=gcc-arm diff --git a/package/boot/rkbin/Makefile b/package/boot/rkbin/Makefile index d895c06547..86b440692a 100644 --- a/package/boot/rkbin/Makefile +++ b/package/boot/rkbin/Makefile @@ -57,9 +57,8 @@ define Trusted-Firmware-A/rk3568-e25 TPL:=rk35/rk3568_ddr_1560MHz_uart2_m0_115200_v1.21.bin endef -define Trusted-Firmware-A/rk3588 +define Trusted-Firmware-A/rk3588-tpl BUILD_SUBTARGET:=armv8 - ATF:=rk35/rk3588_bl31_v1.45.elf TPL:=rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin endef @@ -69,7 +68,7 @@ TFA_TARGETS:= \ rk3566 \ rk3568 \ rk3568-e25 \ - rk3588 + rk3588-tpl ifeq ($(BUILD_VARIANT),rk3308-rock-pi-s) TPL_FILE:=rk3308_ddr_589MHz_uart0_m0_v2.07.bin @@ -109,7 +108,9 @@ endef define Package/trusted-firmware-a/install $(INSTALL_DIR) $(STAGING_DIR_IMAGE) +ifneq ($(ATF),) $(CP) $(PKG_BUILD_DIR)/bin/$(ATF) $(STAGING_DIR_IMAGE)/ +endif $(CP) $(PKG_BUILD_DIR)/bin/$(TPL) $(STAGING_DIR_IMAGE)/ endef diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index ed93b63c34..a9367539aa 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -247,8 +247,10 @@ endef define U-Boot/rk3588/Default BUILD_SUBTARGET:=armv8 - DEPENDS:=+PACKAGE_u-boot-$(1):trusted-firmware-a-rk3588 - ATF:=rk3588_bl31_v1.45.elf + DEPENDS:= \ + +PACKAGE_u-boot-$(1):trusted-firmware-a-rk3588 \ + +PACKAGE_u-boot-$(1):trusted-firmware-a-rk3588-tpl + ATF:=rk3588_bl31.elf TPL:=rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin endef From 99ea96c297305c632a23e966df6aea1bfac241f9 Mon Sep 17 00:00:00 2001 From: Fil Dunsky Date: Tue, 11 Mar 2025 06:57:43 +0700 Subject: [PATCH 06/14] mediatek: filogic: add support for Huasifei WH3000 **Huasifei WH3000 eMMC / Fudy MT3000** Portable Wi-Fi 6 travel router based on MediaTek MT7981A SoC. MT7981B+MT7976CN+RTL8221B Dual Core 1.3GHZ **Specifications** SoC: Filogic 820 MT7981A (1.3GHz) RAM: DDR4 1GB Flash: eMMC 8GB WiFi: 2.4GHz and 5GHz with 3 antennas Ethernet: 1x WAN (10/100/1000M) 1x LAN (10/100/1000/2500M) USB: 1x USB 3.0 port Two buttons: power/reset and mode (BTN_0) LEDS: blue, red, blue+red=pink UART: 3.3V, TX, RX, GND / 115200 8N1 **Installation via U-Boot rescue** 1. Set static IP 192.168.1.2 on your computer and default route as 192.168.1.1 2. Connect to the WAN port and hold the reset button while booting the device. 3. Wait for the LED to blink 5 times, and release the reset button. 4. Open U-boot web page on your browser at http://192.168.1.1 5. Select the OpenWRT sysupgrade image, upload it, and start the upgrade. 6. Wait for the router to flash the new firmware. 7. Wait for the router to reboot itself. **Installation via sysupgrade** Just flash sysupgrade file via [LuCI upgrade page](http://192.168.1.1/cgi-bin/luci/admin/system/flash) without saving the settings. **Installation via SSH** Upload the file to the router `/tmp` directory, `ssh root@192.168.1.1` and issue a command: ``` sysupgrade -n /tmp/openwrt-mediatek-filogic-huasifei_wh3000-emmc-squashfs-sysupgrade.bin ``` **Factory MAC** You can find your Factory MAC which is mentioned on the box at `/dev/mmcblck0p2` partition `factory` starting from `0x4` ``` dd if=/dev/mmcblk0p2 bs=1 skip=4 count=6 | hexdump -C ``` **Enlarging a partition** Though device has 8GB eMMC, it uses only 2GB `/dev/mmcblck0p6` as `rootfs` for `/rom` and `/overlay` leaving `/dev/mmcblck0p7` as empty unused space. ``` sgdisk -p /dev/mmcblk0 ``` ``` Disk /dev/mmcblk0: 15269888 sectors, 7.3 GiB Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 2BD17853-102B-4500-AA1A-8A21D4D7984D Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 14942174 Partitions will be aligned on 1024-sector boundaries Total free space is 11197 sectors (5.5 MiB) Number Start (sector) End (sector) Size Code Name 1 8192 9215 512.0 KiB 8300 u-boot-env 2 9216 13311 2.0 MiB 8300 factory 3 13312 21503 4.0 MiB 8300 fip 4 21504 29695 4.0 MiB 8300 config 5 29696 62463 16.0 MiB 8300 kernel 6 62464 4256767 2.0 GiB 8300 rootfs 7 4257792 14940159 5.1 GiB 8300 ``` You can fix that by loading into `initramfs-kernel`, deleting empty `mmcblck0p7` partition and resizing `mmcblck0p6` ``` sysupgrade -F /tmp/openwrt-initramfs-kernel.bin ``` Install and run cfdisk ``` opkg update && opkg install cfdisk cfdisk /dev/mmcblck0 ``` - Select `mmcblck0p7` -> Delete - Select `mmcblck0p6` -> Resize -> Write -> yes -> Quit You will not see any difference in `cat /proc/partitions` after that but just flash a `sysupgrade` and you'll get the whole 7.3GB space for the `/overlay`. Co-developed-by: hecatae Signed-off-by: Fil Dunsky Link: https://github.com/openwrt/openwrt/pull/18220 Signed-off-by: Hauke Mehrtens --- .../uboot-envtools/files/mediatek_filogic | 1 + .../mediatek/dts/mt7981b-huasifei-wh3000.dts | 190 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 3 + .../filogic/base-files/etc/board.d/02_network | 3 +- .../base-files/lib/upgrade/platform.sh | 2 + target/linux/mediatek/image/filogic.mk | 15 ++ 6 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts diff --git a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic index a31413ed02..5cc8525577 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic @@ -60,6 +60,7 @@ glinet,gl-mt2500|\ glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ +huasifei,wh3000|\ nradio,c8-668gl) local envdev=$(find_mmc_part "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x80000" diff --git a/target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts new file mode 100644 index 0000000000..c12367b84a --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "Huasifei WH3000"; + compatible = "huasifei,wh3000", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &wlan_led; + led-failsafe = &wlan_led; + led-upgrade = &wlan_led; + }; + + chosen { + bootargs = "root=PARTLABEL=rootfs rootwait"; + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-mode { + label = "mode"; + linux,code = ; + linux,input-type = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wan_led: led-0 { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + wlan_led: led-1 { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x40000000>; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; + phy-mode = "2500base-x"; + phy-handle = <&phy1>; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + nvmem-cells = <&macaddr_factory_4 3>; + nvmem-cell-names = "mac-address"; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + }; +}; + +&mdio_bus { + phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <1>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + realtek,aldps-enable; + }; +}; + +&mmc0 { + bus-width = <8>; + cap-mmc-highspeed; + max-frequency = <52000000>; + no-sd; + no-sdio; + non-removable; + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + vmmc-supply = <®_3p3v>; + status = "okay"; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + + partitions { + block-partition-factory { + partname = "factory"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; + }; +}; + +&pio { + mmc0_pins_default: mmc0-pins-default { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_uhs: mmc0-pins-uhs { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + status = "okay"; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_4 1>; + nvmem-cell-names = "mac-address"; + }; +}; + +&xhci { + status = "okay"; +}; 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 b63e33d68a..cc5333af26 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 @@ -69,6 +69,9 @@ glinet,gl-xe3000) ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wifi2g" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wifi5g" "phy1-ap0" ;; +huasifei,wh3000) + ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx" + ;; mercusys,mr90x-v1|\ mercusys,mr90x-v1-ubi) ucidef_set_led_netdev "lan-0" "lan-0" "green:lan-0" "lan0" "link tx rx" 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 9ff1aaf4f8..64712a7cc7 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 @@ -67,7 +67,8 @@ mediatek_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "sfp1 wan" ;; bananapi,bpi-r3-mini|\ - edgecore,eap111) + edgecore,eap111|\ + huasifei,wh3000) ucidef_set_interfaces_lan_wan eth0 eth1 ;; bananapi,bpi-r4) 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 97c7ceba5a..f266b3d462 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -104,6 +104,7 @@ platform_do_upgrade() { glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ + huasifei,wh3000|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ smartrg,sdg-8622|\ @@ -243,6 +244,7 @@ platform_copy_config() { glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ + huasifei,wh3000|\ jdcloud,re-cp-03|\ nradio,c8-668gl|\ smartrg,sdg-8612|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 3a6e1ef71c..414f90a8dc 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -958,6 +958,21 @@ define Device/h3c_magic-nx30-pro endef TARGET_DEVICES += h3c_magic-nx30-pro +define Device/huasifei_wh3000 + DEVICE_VENDOR := Huasifei + DEVICE_MODEL := WH3000 + DEVICE_DTS := mt7981b-huasifei-wh3000 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \ + kmod-usb3 f2fsck mkf2fs + SUPPORTED_DEVICES += huasifei,wh3000-emmc + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += huasifei_wh3000 + define Device/jcg_q30-pro DEVICE_VENDOR := JCG DEVICE_MODEL := Q30 PRO From 14a88ba520b44cf22216d1819d936cea1ec509a9 Mon Sep 17 00:00:00 2001 From: George Sapkin Date: Sat, 5 Apr 2025 01:37:32 +0300 Subject: [PATCH 07/14] tools/expat: bump to 2.7.1 to fix several CVEs Addresses CVE-2024-8176 and CVE-2024-50602. Changelog: https://github.com/libexpat/libexpat/blob/R_2_7_1/expat/Changes Fixes: https://github.com/openwrt/packages/issues/26255 Fixes: https://github.com/advisories/GHSA-9hcv-xw76-m4h6 Fixes: https://github.com/advisories/GHSA-79wf-qgrg-2p6c Signed-off-by: George Sapkin Link: https://github.com/openwrt/openwrt/pull/18421 Signed-off-by: Hauke Mehrtens --- tools/expat/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/expat/Makefile b/tools/expat/Makefile index d48837233f..941f0c3fbf 100644 --- a/tools/expat/Makefile +++ b/tools/expat/Makefile @@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=expat PKG_CPE_ID:=cpe:/a:libexpat:libexpat -PKG_VERSION:=2.6.3 +PKG_VERSION:=2.7.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_HASH:=17aa6cfc5c4c219c09287abfc10bc13f0c06f30bb654b28bfe6f567ca646eb79 +PKG_HASH:=0cce2e6e69b327fc607b8ff264f4b66bdf71ead55a87ffd5f3143f535f15cfa2 PKG_SOURCE_URL:=https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$(PKG_VERSION)) HOST_BUILD_PARALLEL:=1 From d8002cb627edcbef27dedf9768a45ab0435ac55e Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 22 Mar 2025 17:33:39 +0000 Subject: [PATCH 08/14] mediatek: add support for netis NX31 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds support for netis NX31 router. Specification ------------- - SoC : MediaTek MT7981BA dual-core ARM Cortex-A53 1.3 GHz - RAM : 256 MiB DDR3 - Flash : SPI-NAND 128 MiB (ESMT) - WLAN : MediaTek MT7976CN dual-band WiFi 6 - 2.4 GHz : b/g/n/ax, MIMO 2x2 - 5 GHz : a/n/ac/ax, MIMO 2x2 - Ethernet : 10/100/1000 Mbps x3 (LAN, MediaTek MT7531AE) 10/100/1000 Mbps x1 (WAN, SoC internal phy) - USB : No - Buttons : Mesh, Reset - LEDs : 1x Power (blue), unmanaged 1x Status (blue), gpio-controlled 1x WiFi 2.4 GHz (blue), gpio-controlled 1x WiFi 5 GHz (blue), gpio-controlled 3x LAN activity (blue), switch-controlled 1x WAN activity (blue), gpio-controlled - Power : 12 VDC, 1 A Installation ------------ 1. Connect to the router using ssh (user: admin, pass: web interface password) 2. Make mtd backup: cat /dev/mtd0 | gzip -1 -c > /tmp/mtd0_spi0.0.bin.gz cat /dev/mtd1 | gzip -1 -c > /tmp/mtd1_BL2.bin.gz cat /dev/mtd2 | gzip -1 -c > /tmp/mtd2_u-boot-env.bin.gz cat /dev/mtd3 | gzip -1 -c > /tmp/mtd3_Factory.bin.gz cat /dev/mtd4 | gzip -1 -c > /tmp/mtd4_FIP.bin.gz cat /dev/mtd5 | gzip -1 -c > /tmp/mtd5_ubi.bin.gz 3. Download mtd backup from the /tmp dir of the router to your PC using scp protocol 4. Upload OpenWrt 'bl31-uboot.fip', 'preloader.bin' images to the /tmp dir of the router using scp protocol 5. Write FIP and BL2 (replace bootloader): mtd write /tmp/openwrt-mediatek-filogic-netis_nx31-bl31-uboot.fip FIP mtd write /tmp/openwrt-mediatek-filogic-netis_nx31-preloader.bin BL2 6. Place OpenWrt 'openwrt-mediatek-filogic-netis_nx31-initramfs-recovery.itb' image on the tftp server (IP: 192.168.1.254) 7. Erase 'ubi' partition and reboot the router: mtd erase ubi reboot 8. U-Boot automatically boot OpenWrt recovery image from tftp server to the RAM 9. Upload OpenWrt 'sysupgrade.itb' image to the /tmp dir of the router (IP: 192.168.1.1) using scp protocol 10. Connect to the router using ssh and run: sysupgrade -n openwrt-mediatek-filogic-netis_nx31-squashfs-sysupgrade.itb Return to stock --------------- 1. Unpack stock BL2 and FIP partitions backup 2. Upload stock BL2 and FIP partitions backup to the /tmp dir of the router using scp protocol 3. Connect to the router using ssh and run: apk update && apk add kmod-mtd-rw insmod mtd-rw i_want_a_brick=1 mtd unlock BL2 mtd unlock FIP 4. Restore backup: mtd write /tmp/mtd4_FIP.bin FIP mtd write /tmp/mtd1_BL2.bin BL2 5. Erase ubi and reboot: mtd erase ubi reboot 6. Power off the router 7. Press Reset button and power on the router. Release the button after ~10 sec 8. Navigate to U-Boot recovery web server (http://192.168.1.1/) and upload the OEM firmware Recovery -------- 1. Place OpenWrt 'openwrt-mediatek-filogic-netis_nx31-initramfs-recovery.itb' image on the tftp server (IP: 192.168.1.254) 2. Press “Reset” button and power on the router. After ~10 sec release the button. 3. Use OpenWrt initramfs system for recovery MAC addresses ------------- +---------+-------------------+-----------+ | | MAC | Algorithm | +---------+-------------------+-----------+ | LAN | dc:xx:xx:d1:xx:18 | label | | WAN | dc:xx:xx:d1:xx:1a | label+2 | | WLAN 2g | de:xx:xx:11:xx:19 | | | WLAN 5g | de:xx:xx:71:xx:19 | | +---------+-------------------+-----------+ The LAN MAC was found in 'Factory', 0x1fef20 The WAN MAC was found in 'Factory', 0x1fef26 The WLAN 2g/5g MAC prototype was found in 'Factory', 0x4 Signed-off-by: Mikhail Zhilkin Link: https://github.com/openwrt/openwrt/pull/18324 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-mediatek/Makefile | 13 + .../patches/445-add-netis-nx31.patch | 334 ++++++++++++++++++ .../uboot-envtools/files/mediatek_filogic | 1 + .../linux/mediatek/dts/mt7981b-netis-nx31.dts | 301 ++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 3 + .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 8 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 25 ++ 9 files changed, 687 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/445-add-netis-nx31.patch create mode 100644 target/linux/mediatek/dts/mt7981b-netis-nx31.dts diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index dbba460338..9741ca0bfd 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -315,6 +315,18 @@ define U-Boot/mt7981_jcg_q30-pro DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 endef +define U-Boot/mt7981_netis_nx31 + NAME:=netis NX31 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=netis_nx31 + UBOOT_CONFIG:=mt7981_netis_nx31 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 +endef + define U-Boot/mt7981_nokia_ea0326gmp NAME:=Nokia EA0326GMP BUILD_SUBTARGET:=filogic @@ -864,6 +876,7 @@ UBOOT_TARGETS := \ mt7981_glinet_gl-xe3000 \ mt7981_h3c_magic-nx30-pro \ mt7981_jcg_q30-pro \ + mt7981_netis_nx31 \ mt7981_nokia_ea0326gmp \ mt7981_openwrt_one-snand \ mt7981_openwrt_one-nor \ diff --git a/package/boot/uboot-mediatek/patches/445-add-netis-nx31.patch b/package/boot/uboot-mediatek/patches/445-add-netis-nx31.patch new file mode 100644 index 0000000000..55a94189d3 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/445-add-netis-nx31.patch @@ -0,0 +1,334 @@ +--- /dev/null ++++ b/configs/mt7981_netis_nx31_defconfig +@@ -0,0 +1,106 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981-netis_nx31" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_PRE_CON_BUF_ADDR=0x4007ef00 ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-netis_nx31.dtb" ++CONFIG_LOGLEVEL=7 ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_CPU=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_CMD_STRINGS=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_UUID=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="defenvs/netis_nx31_env" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NETCONSOLE=y ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CLK=y ++CONFIG_GPIO_HOG=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++# CONFIG_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_SERIAL_RX_BUFFER=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y +--- /dev/null ++++ b/arch/arm/dts/mt7981-netis_nx31.dts +@@ -0,0 +1,162 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2025 ++ * Author: Mikhail Zhilkin ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "netis NX31"; ++ compatible = "netis,nx31", "mediatek,mt7981"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ button-0 { ++ label = "mesh"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button-1 { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ label = "blue:wlan2g"; ++ gpios = <&gpio 5 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-1 { ++ label = "blue:status"; ++ gpios = <&gpio 7 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-2 { ++ label = "blue:wan"; ++ gpios = <&gpio 8 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led-3 { ++ label = "blue:wlan5g"; ++ gpios = <&gpio 34 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "2500base-x"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <2500>; ++ full-duplex; ++ }; ++}; ++ ++&pinctrl { ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "BL2"; ++ reg = <0x0 0x100000>; ++ }; ++ ++ partition@100000 { ++ label = "u-boot-env (unused)"; ++ reg = <0x100000 0x80000>; ++ }; ++ ++ partition@160000 { ++ label = "Factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "FIP"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "ubi"; ++ reg = <0x580000 0x7a80000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/defenvs/netis_nx31_env +@@ -0,0 +1,57 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootcmd=run check_buttons ; if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-netis_nx31-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-netis_nx31-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-netis_nx31-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-netis_nx31-squashfs-sysupgrade.itb ++bootled_status=blue:status ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_status on ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_status on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led bootled_status off ++boot_recovery=led $bootled_status on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led bootled_status off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_status on ; while true ; do run boot_tftp ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++check_buttons=if button reset ; then run boot_tftp ; fi ++ethaddr_factory=mtd read Factory 0x40080000 0x1e0000 0x20000 && env readmem -b ethaddr 0x4009ef20 0x6 ; setenv ethaddr_factory ++part_default=production ++part_recovery=recovery ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase FIP && mtd write FIP $loadaddr ++mtd_write_bl2=mtd erase BL2 && mtd write BL2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" diff --git a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic index 5cc8525577..78e0ca5723 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic @@ -40,6 +40,7 @@ h3c,magic-nx30-pro|\ jcg,q30-pro|\ mercusys,mr90x-v1-ubi|\ netcore,n60|\ +netis,nx31|\ nokia,ea0326gmp|\ qihoo,360t7|\ routerich,ax3000-ubootmod|\ diff --git a/target/linux/mediatek/dts/mt7981b-netis-nx31.dts b/target/linux/mediatek/dts/mt7981b-netis-nx31.dts new file mode 100644 index 0000000000..82f666df79 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-netis-nx31.dts @@ -0,0 +1,301 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "netis NX31"; + compatible = "netis,nx31", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac0; + + led-boot = &led_status_blue; + led-failsafe = &led_status_blue; + led-running = &led_status_blue; + led-upgrade = &led_status_blue; + + serial0 = &uart0; + }; + + chosen { + rootdisk = <&ubi_fit_volume>; + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-0 { + label = "mesh"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + button-1 { + label = "reset"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_status_blue: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led-2 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + led-3 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_1fef20 0>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_1fef26 0>; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <0x1f>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand@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>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4e 0x41 0x4e 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env (unused)"; + reg = <0x100000 0x80000>; + read-only; + }; + + partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + + macaddr_factory_1fef20: macaddr@1fef20 { + compatible = "mac-base"; + reg = <0x1fef20 0x6>; + #nvmem-cell-cells = <1>; + }; + + macaddr_factory_1fef26: macaddr@1fef26 { + compatible = "mac-base"; + reg = <0x1fef26 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x7a80000>; + compatible = "linux,ubi"; + + volumes { + ubi_fit_volume: ubi-volume-fit { + volname = "fit"; + }; + + ubi_ubootenv: ubi-volume-ubootenv { + volname = "ubootenv"; + }; + + ubi_ubootenv2: ubi-volume-ubootenv2 { + volname = "ubootenv2"; + }; + }; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&ubi_ubootenv { + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + }; +}; + +&ubi_ubootenv2 { + nvmem-layout { + compatible = "u-boot,env-redundant-bool"; + }; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_factory_0>; +}; 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 cc5333af26..4bbe7bc3c3 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 @@ -85,6 +85,9 @@ netcore,n60) netgear,wax220) ucidef_set_led_netdev "eth0" "LAN" "green:lan" "eth0" ;; +netis,nx31) + ucidef_set_led_netdev "wan" "wan" "blue:wan" "eth1" "link tx rx" + ;; nokia,ea0326gmp) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" "link" ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" "link" 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 64712a7cc7..4ac767c36a 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 @@ -11,6 +11,7 @@ mediatek_setup_interfaces() abt,asr3000|\ cmcc,rax3000m|\ h3c,magic-nx30-pro|\ + netis,nx31|\ nokia,ea0326gmp|\ zbtlink,zbt-z8103ax) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1 diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 061cbf975c..a8e57d2c6b 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -129,6 +129,14 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress ;; + netis,nx31) + addr=$(mtd_get_mac_binary "Factory" 0x4) + addr=$(macaddr_unsetbit $(macaddr_setbit_la $addr) 25) + addr_2g=$(macaddr_unsetbit $(macaddr_unsetbit $addr 26) 27) + addr_5g=$(macaddr_setbit $(macaddr_setbit $addr 26) 27) + [ "$PHYNBR" = "0" ] && echo "$addr_2g" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && echo "$addr_5g" > /sys${DEVPATH}/macaddress + ;; nokia,ea0326gmp) addr=$(cat /sys/class/net/eth0/address) [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress 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 f266b3d462..7b472fff03 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -81,6 +81,7 @@ platform_do_upgrade() { mediatek,mt7981-rfb|\ mediatek,mt7988a-rfb|\ mercusys,mr90x-v1-ubi|\ + netis,nx31|\ nokia,ea0326gmp|\ openwrt,one|\ netcore,n60|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 414f90a8dc..2be85dad56 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1305,6 +1305,31 @@ define Device/netgear_wax220 endef TARGET_DEVICES += netgear_wax220 +define Device/netis_nx31 + DEVICE_VENDOR := netis + DEVICE_MODEL := NX31 + DEVICE_DTS := mt7981b-netis-nx31 + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGES := sysupgrade.itb + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.itb := append-kernel | \ + fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | \ + append-metadata + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot netis_nx31 +endef +TARGET_DEVICES += netis_nx31 + define Device/nokia_ea0326gmp DEVICE_VENDOR := Nokia DEVICE_MODEL := EA0326GMP From 367e5c00bd95951278585ee74aa17734732f4eb8 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 12 Jan 2025 01:40:19 +0900 Subject: [PATCH 09/14] uboot-ath79: build U-Boot/qca9558_nec_aterm for NEC Aterm WG2200HP Enable building U-Boot/qca9558_nec_aterm profile for NEC Aterm WG2200HP. This model has almost the same hardware as the other Aterm devices based on Qualcomm Atheros QCA9558. Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17584 Signed-off-by: Hauke Mehrtens --- package/boot/uboot-ath79/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/boot/uboot-ath79/Makefile b/package/boot/uboot-ath79/Makefile index 52ca1c6c01..8f12505777 100644 --- a/package/boot/uboot-ath79/Makefile +++ b/package/boot/uboot-ath79/Makefile @@ -28,7 +28,7 @@ endef define U-Boot/qca9558_nec_aterm NAME:=NEC Aterm series (QCA9558) BUILD_SUBTARGET:= generic - BUILD_DEVICES:=nec_wg1400hp nec_wg1800hp nec_wg1800hp2 + BUILD_DEVICES:=nec_wg1400hp nec_wg1800hp nec_wg1800hp2 nec_wg2200hp UBOOT_CONFIG:=nec_qca9558_aterm endef From 76e0338247ff538247c83ff00b68eed4a65fba57 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Fri, 3 Jan 2025 17:37:29 +0900 Subject: [PATCH 10/14] ath79: update dtsi/dts for NEC Aterm devices based on QCA9558 Add more DT labels and move a USB hub node to dts files of Aterm devices as a preparation for adding support of Aterm WG2200HP. Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17584 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/qca9558_nec_aterm.dtsi | 18 ++++-------------- .../linux/ath79/dts/qca9558_nec_wg1400hp.dts | 10 ++++++++++ .../linux/ath79/dts/qca9558_nec_wg1800hp.dts | 10 ++++++++++ .../linux/ath79/dts/qca9558_nec_wg1800hp2.dts | 10 ++++++++++ 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/target/linux/ath79/dts/qca9558_nec_aterm.dtsi b/target/linux/ath79/dts/qca9558_nec_aterm.dtsi index 441d906f44..d650927195 100644 --- a/target/linux/ath79/dts/qca9558_nec_aterm.dtsi +++ b/target/linux/ath79/dts/qca9558_nec_aterm.dtsi @@ -26,7 +26,7 @@ label-mac-device = ð0; }; - i2c { + i2c: i2c { compatible = "i2c-gpio"; pinctrl-names = "default"; @@ -51,7 +51,7 @@ }; }; - keys { + keys: keys { compatible = "gpio-keys"; pinctrl-names = "default"; pinctrl-0 = <&jtag_disable_pins>; @@ -240,7 +240,7 @@ reg = <0x030000 0x010000>; read-only; - nvmem-layout { + nvmem_art: nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; @@ -327,7 +327,7 @@ &pcie0 { status = "okay"; - wifi@0,0 { + wifi: wifi@0,0 { compatible = "pci168c,003c"; reg = <0x0000 0 0 0 0>; nvmem-cells = <&cal_art_5000>, <&macaddr_config_12>; @@ -349,16 +349,6 @@ &usb0 { status = "okay"; - #address-cells = <1>; - #size-cells = <0>; - - /delete-node/ port@1; - - /* NEC uPD720114 */ - hub@1 { - compatible = "usb0409,005a"; - reg = <1>; - }; }; &wmac { diff --git a/target/linux/ath79/dts/qca9558_nec_wg1400hp.dts b/target/linux/ath79/dts/qca9558_nec_wg1400hp.dts index bfcac09d55..bfa6bf9eea 100644 --- a/target/linux/ath79/dts/qca9558_nec_wg1400hp.dts +++ b/target/linux/ath79/dts/qca9558_nec_wg1400hp.dts @@ -10,3 +10,13 @@ ð0 { pll-data = <0x5a000000 0x00000101 0x00001616>; }; + +&usb0 { + /delete-node/ port@1; + + /* NEC uPD720114 */ + hub@1 { + compatible = "usb0409,005a"; + reg = <1>; + }; +}; diff --git a/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts b/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts index 47679c5869..ffcabaee3c 100644 --- a/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts +++ b/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts @@ -10,3 +10,13 @@ ð0 { pll-data = <0x5a000000 0x00000101 0x00001616>; }; + +&usb0 { + /delete-node/ port@1; + + /* NEC uPD720114 */ + hub@1 { + compatible = "usb0409,005a"; + reg = <1>; + }; +}; diff --git a/target/linux/ath79/dts/qca9558_nec_wg1800hp2.dts b/target/linux/ath79/dts/qca9558_nec_wg1800hp2.dts index 39dec5b2c4..8e7654cb14 100644 --- a/target/linux/ath79/dts/qca9558_nec_wg1800hp2.dts +++ b/target/linux/ath79/dts/qca9558_nec_wg1800hp2.dts @@ -10,3 +10,13 @@ ð0 { pll-data = <0x96000000 0x00000101 0x00001616>; }; + +&usb0 { + /delete-node/ port@1; + + /* NEC uPD720114 */ + hub@1 { + compatible = "usb0409,005a"; + reg = <1>; + }; +}; From f76185c3f3c0896fce5d120df8eeb55cc952002c Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Fri, 3 Jan 2025 17:41:46 +0900 Subject: [PATCH 11/14] ath79: add support for NEC Aterm WG2200HP NEC Aterm WG2200HP is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on QCA9558. Specification: - SoC : Qualcomm Atheros QCA9558 - RAM : DDR2 128 MiB (2x ESMT M14D5121632A) - Flash : SPI-NOR 16 MiB (Macronix MX25L12835FM2I-10G) - WLAN : 2.4/5 GHz - 2.4 GHz : 3T3R (Qualcomm Atheros QCA9558 (SoC)) - 5 GHz : 4T4R (Qualcomm Atheros QCA9984) - Ethernet : 5x 10/100/1000 Mbps - switch : Qualcomm Atheros QCA8337 - LEDs/Keys (GPIO) : 12x/4x - UART : through-hole on PCB - assignment : 3.3V, GND, NC, TX, RX from tri-angle marking - settings : 9600n8 - USB : 1x USB 2.0 Type-A - Power : 12 VDC, 1.5 A (Max: 20 W) - Stock OS : NetBSD based Flash instruction using initramfs-factory.bin image: 1. Connect and open serial console 2. Power on WG2200HP and interrupt bootloader by ESC key 3. Login to the bootloader CLI with a password "chiron" 4. Start TFTP server by "tftpd" command 5. Upload initramfs-factory.bin via tftp from your computer example (Windows): tftp -i 192.168.0.1 PUT initramfs-factory.bin 6. Boot initramfs image by "boot" command 7. On the initramfs image, back up the stock bootloader and firmware if needed 8. Upload (or download) uboot.bin and sysupgrade.bin image to the device 9. Rplace the bootloader with a uboot.bin image mtd write bootloader 10. Perform sysupgrade with a sysupgrade.bin image 11. Wait ~120 seconds to complete flashing Notes: - All LEDs are connected to the Diodes PI4IOE5V9539LE I2C Expander chip. (compatible with NXP PCA9539) - The stock bootloader requires an unknown filesystem on firmware area in the flash. Booting of OpenWrt from that filesystem cannot be handled, so the bootloader needs to be replaced to mainline U-Boot before OpenWrt installation. - The data length of blocks in firmware image will be checked (4M < threshold < 6M) on the stock WebUI of all versions, and initramfs-factory.bin image of OpenWrt has the larger block data for initramfs image. So that image cannot be applied to the stock WebUI at all. MAC addresses: LAN : 98:F1:99:xx:xx:7C (config, 0x6 (hex)) WAN : 98:F1:99:xx:xx:7D (config, 0xc (hex)) 2.4 GHz: 98:F1:99:xx:xx:7E (config, 0x0 (hex)) 5 GHz : 98:F1:99:xx:xx:7F (config, 0x12 (hex)) Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/17584 Signed-off-by: Hauke Mehrtens --- .../linux/ath79/dts/qca9558_nec_wg2200hp.dts | 57 +++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 1 + target/linux/ath79/image/generic.mk | 10 ++++ .../linux/ath79/image/lzma-loader/src/board.c | 7 ++- 4 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 target/linux/ath79/dts/qca9558_nec_wg2200hp.dts diff --git a/target/linux/ath79/dts/qca9558_nec_wg2200hp.dts b/target/linux/ath79/dts/qca9558_nec_wg2200hp.dts new file mode 100644 index 0000000000..91ffe6d84c --- /dev/null +++ b/target/linux/ath79/dts/qca9558_nec_wg2200hp.dts @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_nec_aterm.dtsi" + +/ { + compatible = "nec,wg2200hp", "qca,qca9558"; + model = "NEC Aterm WG2200HP"; +}; + +&i2c { + /delete-node/ gpio@20; + + /* Diodes PI4IOE5V9539LE */ + gpio1: gpio@76 { + compatible = "nxp,pca9539"; + reg = <0x76>; + reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + gpio-controller; + #gpio-cells = <2>; + }; +}; + +&keys { + /delete-node/ button-eco; +}; + +&nvmem_art { + precal_art_5000: pre-calibration@5000 { + reg = <0x5000 0x2f20>; + }; +}; + +&phy0 { + qca,ar8327-initvals = < + 0x04 0x80000080 /* PORT0_PAD_MODE_CTRL */ + 0x08 0x00000000 /* PORT5_PAD_MODE_CTRL */ + 0x0c 0x07600000 /* PORT6_PAD_MODE_CTRL */ + 0x10 0x812613a0 /* POWER_ON_STRAP */ + 0x50 0xcc36cc36 /* LED_CTRL0 */ + 0x54 0xca36ca36 /* LED_CTRL1 */ + 0x58 0xc936c936 /* LED_CTRL2 */ + 0x5c 0x03ffff00 /* LED_CTRL3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x0000007e /* PORT6_STATUS */ + 0xe0 0xc74164de /* SGMII_CONTROL */ + >; +}; + +ð0 { + pll-data = <0x76000000 0x00000101 0x00001616>; +}; + +&wifi { + compatible = "pci168c,0046"; + nvmem-cells = <&precal_art_5000>, <&macaddr_config_12>; + nvmem-cell-names = "pre-calibration", "mac-address"; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 4da8d36d50..d999784d6a 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -193,6 +193,7 @@ ath79_setup_interfaces() nec,wg1400hp|\ nec,wg1800hp|\ nec,wg1800hp2|\ + nec,wg2200hp|\ tplink,archer-c5-v1|\ tplink,archer-c7-v1|\ tplink,archer-c7-v2|\ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 9c74936053..b74a22ba4d 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2170,6 +2170,16 @@ define Device/nec_wg1800hp2 endef TARGET_DEVICES += nec_wg1800hp2 +define Device/nec_wg2200hp + SOC := qca9558 + DEVICE_MODEL := Aterm WG2200HP + IMAGE_SIZE := 16128k + NEC_FW_TYPE := H055 + $(Device/nec-netbsd-aterm) + DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca9984-ct +endef +TARGET_DEVICES += nec_wg2200hp + define Device/nec_wg800hp SOC := qca9563 DEVICE_VENDOR := NEC diff --git a/target/linux/ath79/image/lzma-loader/src/board.c b/target/linux/ath79/image/lzma-loader/src/board.c index 294ca307d5..7ed414aa90 100644 --- a/target/linux/ath79/image/lzma-loader/src/board.c +++ b/target/linux/ath79/image/lzma-loader/src/board.c @@ -54,7 +54,8 @@ static inline void tlwr1043nd_init(void) {} #if defined(CONFIG_BOARD_MERAKI_MR18) || \ defined(CONFIG_BOARD_NEC_WG1400HP) || \ defined(CONFIG_BOARD_NEC_WG1800HP) || \ - defined(CONFIG_BOARD_NEC_WG1800HP2) + defined(CONFIG_BOARD_NEC_WG1800HP2) || \ + defined(CONFIG_BOARD_NEC_WG2200HP) static int extract_qca955x_sgmii_res_cal(void) { @@ -221,6 +222,7 @@ static inline void huawei_ap_init(void) {} #if defined(CONFIG_BOARD_NEC_WG1400HP) || \ defined(CONFIG_BOARD_NEC_WG1800HP) || \ defined(CONFIG_BOARD_NEC_WG1800HP2) || \ + defined(CONFIG_BOARD_NEC_WG2200HP) || \ defined(CONFIG_BOARD_NEC_WG600HP) || \ defined(CONFIG_BOARD_NEC_WR8750N) || \ defined(CONFIG_BOARD_NEC_WR9500N) @@ -296,7 +298,8 @@ static inline void nec_aterm_init(void) } #elif defined(CONFIG_BOARD_NEC_WG1400HP) || \ defined(CONFIG_BOARD_NEC_WG1800HP) || \ - defined(CONFIG_BOARD_NEC_WG1800HP2) + defined(CONFIG_BOARD_NEC_WG1800HP2) || \ + defined(CONFIG_BOARD_NEC_WG2200HP) #define QCA955X_GMAC_MR_AN_CONTROL_PHY_RESET_MASK BIT(15) #define QCA955X_GMAC_MR_AN_CONTROL_FULL_DUPLEX_MASK BIT(8) From 86eb1c0b5add1e0b493b25508c45b2df9d722c78 Mon Sep 17 00:00:00 2001 From: Ming Kuang Date: Fri, 21 Mar 2025 23:21:05 +0800 Subject: [PATCH 12/14] wifi-scripts: mac80211.sh: add EHT and HE160 support to iw_htmode For WIFI7 devices (such as mt7925e), the dev width is currently always "20 MHz (no HT)" in monitor mode. Add EHT and HE160 support to iw_htmode to fix this issue. Additionally, the following changes are made: 1. Set iw_htmode to 160MHz for VHT160. The reason for the current VHT160 setting is unclear and seems to have been in place for over a decade (ibss_htmode [1]). If anyone knows its impact, please inform me so I can restore it. 2. Modify MHZ to MHz. The original matching table in the current iw tool uses MHz. Although the match is case-insensitive, correcting this won't hurt. [1]: https://github.com/openwrt/openwrt/commit/768d09be8781228d3553142c0f1e1231c6aacc7c Signed-off-by: Ming Kuang Link: https://github.com/openwrt/openwrt/pull/18319 Signed-off-by: Hauke Mehrtens --- .../files/lib/netifd/wireless/mac80211.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 61813ab81b..c9fa2b5fa0 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -740,8 +740,10 @@ mac80211_prepare_vif() { mac80211_prepare_iw_htmode() { case "$htmode" in - VHT20|HT20|HE20) iw_htmode=HT20;; - HT40*|VHT40|VHT160|HE40) + HT20|VHT20|HE20|EHT20) + iw_htmode=HT20 + ;; + HT40*|VHT40|HE40|EHT40) case "$band" in 2g) case "$htmode" in @@ -765,8 +767,11 @@ mac80211_prepare_iw_htmode() { esac [ "$auto_channel" -gt 0 ] && iw_htmode="HT40+" ;; - VHT80|HE80) - iw_htmode="80MHZ" + VHT80|HE80|EHT80) + iw_htmode="80MHz" + ;; + VHT160|HE160|EHT160) + iw_htmode="160MHz" ;; NONE|NOHT) iw_htmode="NOHT" From 84e090086795a45d5580138436ce74b6170584ab Mon Sep 17 00:00:00 2001 From: Matthias Franck Date: Fri, 31 Jan 2025 10:00:46 +0100 Subject: [PATCH 13/14] busybox: use external libtirpc when using glibc In recent glibc versions rpc functionality has been moved to a separate library instead of glibc itself. Depend on this library when rpc functionality is needed and glibc is used. Signed-off-by: Matthias Franck Link: https://github.com/openwrt/openwrt/pull/17796 Signed-off-by: Hauke Mehrtens --- package/utils/busybox/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 7701428570..5e3b4cd74d 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -48,7 +48,7 @@ define Package/busybox/Default MAINTAINER:=Felix Fietkau TITLE:=Core utilities for embedded Linux URL:=http://busybox.net/ - DEPENDS:=+BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter + DEPENDS:=+BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter +(USE_GLIBC&&BUSYBOX_CONFIG_FEATURE_MOUNT_NFS)||(USE_GLIBC&&BUSYBOX_CONFIG_FEATURE_INETD_RPC):libtirpc USERID:=ntp=123:ntp=123 endef @@ -104,6 +104,13 @@ ifeq ($(CONFIG_USE_GLIBC),y) LDLIBS += $(call BUSYBOX_IF_ENABLED,NSLOOKUP,resolv) endif +ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_MOUNT_NFS)$(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_INETD_RPC),) +ifndef CONFIG_USE_MUSL + TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/tirpc + LDLIBS += tirpc +endif +endif + ifeq ($(BUILD_VARIANT),selinux) LDLIBS += selinux sepol endif From d9f30b64ad93d946452dcd69f6c54417f549654b Mon Sep 17 00:00:00 2001 From: Christian Steiner Date: Sun, 30 Mar 2025 13:19:04 +0200 Subject: [PATCH 14/14] realtek: add support for D-Link DGS-1210-26 This patch adds support for D-Link DGS-1210-26 rev. F1 Hardware specification ---------------------- * RTL8382M SoC, 1 MIPS 4KEc core @ 500MHz * 128MB DRAM * 32MB NOR Flash (MX25L25635E) * 24 x 10/100/1000BASE-T ports * 2 x SFP ports * Power LED * Reset button on front panel Installation using OEM webinterface ----------------------------------- 1. Make sure you are running OEM firmware from secondary slot. If not, switch to image2 using the menus System > Firmware Information > Boot from image2 Tools > reboot 2. Upload image squashfs-factory_image1.bin via Tools > Backup / Upgrade Firmware > image1 3. Toggle startup image via System > Firmware Information > Boot from image1 4. Tools > reboot Known working firmware version for this procedure: 6.20.007 Installation using TFTP and serial console ------------------------------------------ 1. Prepare a TFTP server with the OpenWrt *initramfs-kernel.bin and assign it an IP from 10.90.90.0/24 (except 10.90.90.90) 2. Connect the TFTP server to one of switch's ports 3. Connect to the serial console (115200 baud) and power on the switch 4. Press the ESC key once you see "Hit Esc key to stop autoboot" in the console output 5. Press CTRL+C keys to get into the real U-Boot prompt 6. Init the network with the command "rtk network on" 7. Load the OpenWrt image with the command "tftpboot 0x8f000000 :" ( is the TFTP server's IP, e.g. 10.90.90.100; is the name of the image provided by the TFTP server) 8. Boot the OpenWrt image with the command "bootm" 9. Browse to https://192.168.1.1/cgi-bin/luci/admin/system/flash 10. Upload the the OpenWrt *squashfs-sysupgrade.bin to the switch 11. Wait for it to reboot Signed-off-by: Christian Steiner Link: https://github.com/openwrt/openwrt/pull/18378 Signed-off-by: Sander Vanheule --- .../dts/rtl8382_d-link_dgs-1210-26.dts | 145 ++++++++++++++++++ target/linux/realtek/image/rtl838x.mk | 7 + 2 files changed, 152 insertions(+) create mode 100644 target/linux/realtek/dts/rtl8382_d-link_dgs-1210-26.dts diff --git a/target/linux/realtek/dts/rtl8382_d-link_dgs-1210-26.dts b/target/linux/realtek/dts/rtl8382_d-link_dgs-1210-26.dts new file mode 100644 index 0000000000..b0ec1a10f4 --- /dev/null +++ b/target/linux/realtek/dts/rtl8382_d-link_dgs-1210-26.dts @@ -0,0 +1,145 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl838x.dtsi" +#include "rtl83xx_d-link_dgs-1210_common.dtsi" +#include "rtl83xx_d-link_dgs-1210_gpio.dtsi" + +/ { + compatible = "d-link,dgs-1210-26", "realtek,rtl838x-soc"; + model = "D-Link DGS-1210-26"; + + /* Left SFP slot, port 25 */ + i2c0: i2c-gpio-0 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp0: sfp-p25 { + compatible = "sff,sfp"; + i2c-bus = <&i2c0>; + los-gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>; + }; + + /* Right SFP slot, port 26 */ + i2c1: i2c-gpio-1 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp1: sfp-p26 { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + los-gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>; + }; +}; + +ðernet0 { + mdio: mdio-bus { + compatible = "realtek,rtl838x-mdio"; + regmap = <ðernet0>; + #address-cells = <1>; + #size-cells = <0>; + + EXTERNAL_PHY(0) + EXTERNAL_PHY(1) + EXTERNAL_PHY(2) + EXTERNAL_PHY(3) + EXTERNAL_PHY(4) + EXTERNAL_PHY(5) + EXTERNAL_PHY(6) + EXTERNAL_PHY(7) + + INTERNAL_PHY(8) + INTERNAL_PHY(9) + INTERNAL_PHY(10) + INTERNAL_PHY(11) + INTERNAL_PHY(12) + INTERNAL_PHY(13) + INTERNAL_PHY(14) + INTERNAL_PHY(15) + + EXTERNAL_PHY(16) + EXTERNAL_PHY(17) + EXTERNAL_PHY(18) + EXTERNAL_PHY(19) + EXTERNAL_PHY(20) + EXTERNAL_PHY(21) + EXTERNAL_PHY(22) + EXTERNAL_PHY(23) + + INTERNAL_PHY(24) + INTERNAL_PHY(26) + }; +}; + +&switch0 { + ports { + #address-cells = <1>; + #size-cells = <0>; + + SWITCH_PORT(0, 1, qsgmii) + SWITCH_PORT(1, 2, qsgmii) + SWITCH_PORT(2, 3, qsgmii) + SWITCH_PORT(3, 4, qsgmii) + SWITCH_PORT(4, 5, qsgmii) + SWITCH_PORT(5, 6, qsgmii) + SWITCH_PORT(6, 7, qsgmii) + SWITCH_PORT(7, 8, qsgmii) + + SWITCH_PORT(8, 9, internal) + SWITCH_PORT(9, 10, internal) + SWITCH_PORT(10, 11, internal) + SWITCH_PORT(11, 12, internal) + SWITCH_PORT(12, 13, internal) + SWITCH_PORT(13, 14, internal) + SWITCH_PORT(14, 15, internal) + SWITCH_PORT(15, 16, internal) + + SWITCH_PORT(16, 17, qsgmii) + SWITCH_PORT(17, 18, qsgmii) + SWITCH_PORT(18, 19, qsgmii) + SWITCH_PORT(19, 20, qsgmii) + SWITCH_PORT(20, 21, qsgmii) + SWITCH_PORT(21, 22, qsgmii) + SWITCH_PORT(22, 23, qsgmii) + SWITCH_PORT(23, 24, qsgmii) + + port@24 { + reg = <24>; + label = "lan25"; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp0>; + }; + + port@26 { + reg = <26>; + label = "lan26"; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp1>; + }; + + port@28 { + ethernet = <ðernet0>; + reg = <28>; + phy-mode = "internal"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 3763418233..a090390a50 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -59,6 +59,13 @@ define Device/d-link_dgs-1210-20 endef TARGET_DEVICES += d-link_dgs-1210-20 +define Device/d-link_dgs-1210-26 + $(Device/d-link_dgs-1210) + SOC := rtl8382 + DEVICE_MODEL := DGS-1210-26 +endef +TARGET_DEVICES += d-link_dgs-1210-26 + define Device/d-link_dgs-1210-28 $(Device/d-link_dgs-1210) SOC := rtl8382