root@WR3000H:~# ls -l /sys/class/net/*/of_node
lrwxrwxrwx 1 root root 0 Dec 22 20:19 /sys/class/net/eth0/of_node -> ../../../../../firmware/devicetree/base/ethernet@15100000/mac@0
lrwxrwxrwx 1 root root 0 Dec 22 20:16 /sys/class/net/eth1/of_node -> ../../../../../firmware/devicetree/base/ethernet@15100000/mac@1
root@WR3000H:~# ls -l /sys/class/net/*/phydev/of_node
ls: /sys/class/net/*/phydev/of_node: No such file or directory
root@WR3000H:~# hexdump /sys/class/net/eth1/phydev/of_node/phy-handle
hexdump: /sys/class/net/eth1/phydev/of_node/phy-handle: No such file or directory
hexdump: /sys/class/net/eth1/phydev/of_node/phy-handle: Bad file descriptor
root@WR3000H:~# hexdump /sys/class/net/eth1/phys_*
hexdump: /sys/class/net/eth1/phys_port_id: Not supported
hexdump: /sys/class/net/eth1/phys_port_name: Not supported
hexdump: /sys/class/net/eth1/phys_switch_id: Not supported
wan interface sys entries
root@WR3000H:~# ls -la /sys/class/net/eth1/
drwxr-xr-x 5 root root 0 Dec 22 19:17 .
drwxr-xr-x 4 root root 0 Dec 22 19:17 ..
-r--r--r-- 1 root root 4096 Dec 22 20:16 addr_assign_type
-r--r--r-- 1 root root 4096 Dec 22 20:16 addr_len
-r--r--r-- 1 root root 4096 Dec 22 20:15 address
-r--r--r-- 1 root root 4096 Dec 22 20:16 broadcast
-rw-r--r-- 1 root root 4096 Dec 22 20:16 carrier
-r--r--r-- 1 root root 4096 Dec 22 20:16 carrier_changes
-r--r--r-- 1 root root 4096 Dec 22 20:16 carrier_down_count
-r--r--r-- 1 root root 4096 Dec 22 20:16 carrier_up_count
-r--r--r-- 1 root root 4096 Dec 22 20:16 dev_id
-r--r--r-- 1 root root 4096 Dec 22 20:16 dev_port
lrwxrwxrwx 1 root root 0 Dec 22 20:15 device -> ../../../15100000.ethernet
-r--r--r-- 1 root root 4096 Dec 22 20:16 dormant
-r--r--r-- 1 root root 4096 Dec 22 20:16 duplex
-rw-r--r-- 1 root root 4096 Dec 22 20:16 flags
-rw-r--r-- 1 root root 4096 Dec 22 20:16 gro_flush_timeout
-rw-r--r-- 1 root root 4096 Dec 22 20:16 ifalias
-r--r--r-- 1 root root 4096 Dec 22 20:16 ifindex
-r--r--r-- 1 root root 4096 Dec 22 20:16 iflink
-r--r--r-- 1 root root 4096 Dec 22 20:16 link_mode
-rw-r--r-- 1 root root 4096 Dec 22 20:16 mtu
-r--r--r-- 1 root root 4096 Dec 22 20:16 name_assign_type
-rw-r--r-- 1 root root 4096 Dec 22 20:16 netdev_group
lrwxrwxrwx 1 root root 0 Dec 22 20:16 of_node -> ../../../../../firmware/devicetree/base/ethernet@15100000/mac@1
-r--r--r-- 1 root root 4096 Dec 22 20:15 operstate
-r--r--r-- 1 root root 4096 Dec 22 20:16 phys_port_id
-r--r--r-- 1 root root 4096 Dec 22 20:16 phys_port_name
-r--r--r-- 1 root root 4096 Dec 22 20:16 phys_switch_id
drwxr-xr-x 2 root root 0 Dec 22 20:16 power
-rw-r--r-- 1 root root 4096 Dec 22 20:16 proto_down
drwxr-xr-x 4 root root 0 Dec 22 19:17 queues
-r--r--r-- 1 root root 4096 Dec 22 20:16 speed
drwxr-xr-x 2 root root 0 Dec 22 20:16 statistics
lrwxrwxrwx 1 root root 0 Dec 22 20:16 subsystem -> ../../../../../class/net
-rw-r--r-- 1 root root 4096 Dec 22 20:16 threaded
-rw-r--r-- 1 root root 4096 Dec 22 20:16 tx_queue_len
-r--r--r-- 1 root root 4096 Dec 22 20:16 type
-rw-r--r-- 1 root root 4096 Dec 22 20:16 uevent
ra0/ra1/ra2/rax0/rax1/rax2/apcli0/apclix0 are network devices created by Ralink/Mediatek wifi drivers that to the system looks like an ordinary ethernet since all the wifi processing is done by their os-agnostic drivers - they work on Linux, Windows, wxWorks, BSD...
Yeah, I think I miss something.
I am going to leave the project aside for a week to rest and get back ideas and strength (I will not have the laboratory to test). I take this opportunity to wish you all happy holidays.
A new exploration reveals a driver "Realtek RTL8221B PHY" working in mdio-bus 0x06 with gmii combined with nhat
root@WR3000H:/sys/devices/platform/15100000.ethernet# ls -la /sys/devices/platform/15100000*/
/sys/devices/platform/15100000.ethernet/:
drwxr-xr-x 5 root root 0 Dec 23 10:03 .
drwxr-xr-x 42 root root 0 Dec 23 10:03 ..
lrwxrwxrwx 1 root root 0 Dec 23 12:04 driver -> ../../../bus/platform/drivers/mtk_soc_eth
-rw-r--r-- 1 root root 4096 Dec 23 12:04 driver_override
drwxr-xr-x 3 root root 0 Dec 23 12:04 mdio_bus
-r--r--r-- 1 root root 4096 Dec 23 12:04 modalias
drwxr-xr-x 4 root root 0 Dec 23 10:03 net
lrwxrwxrwx 1 root root 0 Dec 23 12:04 of_node -> ../../../firmware/devicetree/base/ethernet@15100000
drwxr-xr-x 2 root root 0 Dec 23 12:04 power
lrwxrwxrwx 1 root root 0 Dec 23 12:04 subsystem -> ../../../bus/platform
-rw-r--r-- 1 root root 4096 Dec 23 12:04 uevent
/sys/devices/platform/15100000.hnat/:
drwxr-xr-x 3 root root 0 Dec 23 10:03 .
drwxr-xr-x 42 root root 0 Dec 23 10:03 ..
lrwxrwxrwx 1 root root 0 Dec 23 12:04 driver -> ../../../bus/platform/drivers/mediatek_soc_hnat
-rw-r--r-- 1 root root 4096 Dec 23 12:04 driver_override
-r--r--r-- 1 root root 4096 Dec 23 12:04 modalias
lrwxrwxrwx 1 root root 0 Dec 23 12:04 of_node -> ../../../firmware/devicetree/base/hnat@15000000
drwxr-xr-x 2 root root 0 Dec 23 12:04 power
lrwxrwxrwx 1 root root 0 Dec 23 12:04 subsystem -> ../../../bus/platform
-rw-r--r-- 1 root root 4096 Dec 23 12:04 uevent
root@WR3000H:/sys/devices/platform/15100000.ethernet# ls -la mdio_bus/mdio-bus/
drwxr-xr-x 4 root root 0 Dec 23 12:06 .
drwxr-xr-x 3 root root 0 Dec 23 12:04 ..
lrwxrwxrwx 1 root root 0 Dec 23 12:06 device -> ../../../15100000.ethernet
drwxr-xr-x 3 root root 0 Dec 23 12:06 mdio-bus:06
lrwxrwxrwx 1 root root 0 Dec 23 12:06 of_node -> ../../../../../firmware/devicetree/base/ethernet@15100000/mdio-bus
drwxr-xr-x 2 root root 0 Dec 23 12:06 power
lrwxrwxrwx 1 root root 0 Dec 23 12:06 subsystem -> ../../../../../class/mdio_bus
-rw-r--r-- 1 root root 4096 Dec 23 12:06 uevent
root@WR3000H:/sys/devices/platform/15100000.ethernet# ls -la mdio_bus/mdio-bus/mdio-bus\:06/
drwxr-xr-x 3 root root 0 Dec 23 12:06 .
drwxr-xr-x 4 root root 0 Dec 23 12:06 ..
lrwxrwxrwx 1 root root 0 Dec 23 12:06 driver -> ../../../../../../bus/mdio_bus/drivers/Realtek RTL8221B PHY
lrwxrwxrwx 1 root root 0 Dec 23 12:06 of_node -> ../../../../../../firmware/devicetree/base/ethernet@15100000/mdio-bus/phy@1
-r--r--r-- 1 root root 4096 Dec 23 12:06 phy_has_fixups
-r--r--r-- 1 root root 4096 Dec 23 12:06 phy_id
-r--r--r-- 1 root root 4096 Dec 23 12:06 phy_interface
drwxr-xr-x 2 root root 0 Dec 23 12:06 power
lrwxrwxrwx 1 root root 0 Dec 23 12:06 subsystem -> ../../../../../../bus/mdio_bus
-rw-r--r-- 1 root root 4096 Dec 23 12:06 uevent
Input U-Boot's IP address: 192.168.1.112
Input TFTP server's IP address: 192.168.1.88
Input IP netmask: 255.255.255.0
Input file name: cudy.bin
Using ethernet@15100000 device
TFTP from server 192.168.1.88; our IP address is 192.168.1.112
Filename 'cudy.bin'.
Load address: 0x46000000
Loading: ####################################....
done
Bytes transferred = 19795484 (12e0e1c hex)
Saving Environment to MTD... Erasing on MTD device 'nmbm0'... OK
Writing to MTD device 'nmbm0'... OK
OK
*** Loaded 19795484 (0x12e0e1c) bytes at 0x46000000 ***
Erasing from 0x0 to 0x12fffff, size 0x1300000 ... OK
Writing from 0x46000000 to 0x0, size 0x12e0e1c ... OK
Verifying from 0x0 to 0x12e0e1b, size 0x12e0e1c ... OK
*** Single image upgrade completed! ***
keep press reset (until all led flash-one led keep-one led keep,one led flash)
-> TFTP recovery.bin(WR3000H-R63-2.2.7-20240906-085755-sysupgrade.bin) (192.168.0.88->192.168.112)
*** Upgrading oem fit Firmware ***
Using ethernet@15100000 device
TFTP from server 192.168.1.88; our IP address is 192.168.1.112
Filename 'recovery.bin'.
Load address: 0x46000000
Loading: ###################################...
done
Bytes transferred = 19664413 (12c0e1d hex)
rsa verify ok
## Copying 'ubi' subimage from FIT image at 46200800 ...
crc32+ Erasing from 0x0 to 0x10bffff, size 0x10c0000 ... OK
Writing from 0x462008a0 to 0x0, size 0x10c0000 ... OK
Verifying from 0x0 to 0x10bffff, size 0x10c0000 ... OK
*** oem fit Firmware upgrade completed! ***
Rebooting ...
resetting ...
I order to speed testing I build my own BL2 and FIP to flash into BL and FIP partitions. I can boot from tftp and boot the original firmware too from ubi.
git clone https://github.com/mtk-openwrt/u-boot.git
cd u-boot/
make mt7981_spim_nand_rfb_defconfig
make CROSS_COMPILE=aarch64-linux-gnu-
cd ..
git clone https://github.com/mtk-openwrt/arm-trusted-firmware.git
cd arm-trusted-firmware
make -f Makefile CROSS_COMPILE=aarch64-linux-gnu- PLAT=mt7981 BOOT_DEVICE=spim-nand BOARD_BGA=1 BL33=../u-boot/u-boot.bin OVERRIDE_FIP_BASE=0x3c0000 all fip
cd ..
cp arm-trusted-firmware/build/mt7981/release/fip.bin mt7981.fip
cp arm-trusted-firmware/build/mt7981/release/bl2.img mt7981-bl2.img
mtk_uartboot -s /dev/ttyUSB0 -a -p mt7981-ram-ddr3-bl2.bin -f mt7981.fip
OMG it was really fun! Now it's working!
I wrote to cudy support and they send me the original DTS https://pastebin.com/ekAe6ZVp I'ts not different from the decompiled version from @zekica but it help me to got more perspective and make leds work properly adn add some gpio.
I have a problem trying to do a sysupgrade, somehow is searching the wrong partition.
Could not open mtd device: firmware
root@wrt2:/tmp# sysupgrade -v openwrt-mediatek-filogic-cudy_wr3000h-v1-squashfs-
sysupgrade.bin
verifying sysupgrade tar file integrity
Fri Jan 10 19:13:39 CET 2025 upgrade: Saving config files...
etc/config
…
…
Fri Jan 10 19:13:40 CET 2025 upgrade: Commencing upgrade. Closing all shell sessions.
Fri Jan 10 19:13:40 CET 2025 upgrade: Commencing upgrade. Closing all shell sessions.
Hangup
-ash: can't set tty process group: Not a tty
[1]+ Hangup sysupgrade -v openwrt-mediatek-filogic-cudy_wr3000h-v1-squashfs-sysupgrade.bin
root@wrt2:/tmp# Watchdog handover: fd=3
- watchdog -
Watchdog does not have CARDRESET support
[ 9443.353255] mt798x-wmac 18000000.wifi phy0-ap0: left allmulticast mode
[ 9443.359848] mt798x-wmac 18000000.wifi phy0-ap0: left promiscuous mode
[ 9443.366436] br-lan: port 5(phy0-ap0) entered disabled state
[ 9443.454432] br-lan: port 7(phy1-mesh0) entered disabled state
Fri Jan 10 19:13:40 CET 2025 upgrade: Sending TERM to remaining processes ...
Fri Jan 10 19:13:40 CET 2025 upgrade: Sending signal TERM to hostapd (1514)
Fri Jan 10 19:13:40 CET 2025 upgrade: Sending signal TERM to wpa_supplicant (1515)
Fri Jan 10 19:13:40 CET 2025 upgrade: Sending signal TERM to hostapd (1563)
Fri Jan 10 19:13:40 CET 2025 upgrade: Sending signal TERM to wpa_supplicant (1566)
[ 9443.519557] br-lan: port 7(phy1-mesh0) entered blocking state
[ 9443.525341] br-lan: port 7(phy1-mesh0) entered forwarding state
[ 9443.565220] br-lan: port 7(phy1-mesh0) entered disabled state
[ 9443.603275] mt798x-wmac 18000000.wifi phy1-mesh0 (unregistering): left allmulticast mode
[ 9443.611367] mt798x-wmac 18000000.wifi phy1-mesh0 (unregistering): left promiscuous mode
[ 9443.619392] br-lan: port 7(phy1-mesh0) entered disabled state
[ 9443.932993] mt798x-wmac 18000000.wifi phy1-ap0: left allmulticast mode
[ 9443.939531] mt798x-wmac 18000000.wifi phy1-ap0: left promiscuous mode
[ 9443.946024] br-lan: port 6(phy1-ap0) entered disabled state
Fri Jan 10 19:13:44 CET 2025 upgrade: Sending KILL to remaining processes ...
[ 9453.643108] stage2 (4083): drop_caches: 3
Fri Jan 10 19:13:50 CET 2025 upgrade: Switching to ramdisk...
[ 9454.949710] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" stops
[ 9454.962658] UBIFS (ubi0:2): un-mount UBI device 0
Fri Jan 10 18:13:52 UTC 2025 upgrade: Performing system upgrade...
[ 9455.004252] do_stage2 (4083): drop_caches: 3
Could not open mtd device: firmware
Can't open device for writi[ 9455.016397] reboot: Restarting system
ng!
cat: write
REBOOT