Patch existing OpenWRT firmware (sysupgrade.itb) to use the USB3 on the MT7981 to connect to 2500Base-X SFP module.
- CMCC RAX3000M
- 23.05.4
- Install U-Boot Tools and Device Tree Compiler
Debian / Ubuntu: sudo apt install u-boot-tools device-tree-compiler
Arch Linux: sudo pacman -S uboot-tools dtc
Homebrew: brew install u-boot-tools dtc
- Install python3 with hashlib, zlib
- Clone this repository
git clone https://github.com/cyyself/mt7981-usb-sfp-patcher.git
cd mt7981-usb-sfp-patcher
- Patch the firmware
wget https://downloads.openwrt.org/releases/23.05.4/targets/mediatek/filogic/openwrt-23.05.4-mediatek-filogic-cmcc_rax3000m-squashfs-sysupgrade.itb
python3 patch_itb.py openwrt-23.05.4-mediatek-filogic-cmcc_rax3000m-squashfs-sysupgrade.itb patched.itb
- (Optional) Verify the patched dts
diff build/orig.dts build/patched.dts
8c8
< model = "CMCC RAX3000M";
---
> model = "CMCC RAX3000M with USB3SFP";
549,551c549,550
< phy-mode = "gmii";
< phy-handle = <0x1f>;
< phandle = <0x39>;
---
> phy-mode = "2500base-x";
> managed = "in-band-status";
686c685
< phys = <0x21 0x03 0x0f 0x04>;
---
> phys = <0x21 0x03>;
689a689
> mediatek,u3p-dis-msk = <0x01>;
931c931
< };
---
> };
\ No newline at end of file
- Use
sysupgrade -F
or LuCI to flash the patched firmware
It's normal to get a warning "Image check failed", but "Force upgrade" should work.
Since there are only 2 Ethernet MACs in the MT7981 SoC, If your router uses both of them for WAN and LAN (e.g. CMCC RAX300M), the original eth1 (typically WAN port) will be disabled.
Please see this dts patch.
A patch to enable the flow control of the SFP module is under review.