MediaTek MT7981 RFB Replace openwrt snapshot 21.02 with newer snapshot or stable version of openwrt

Hi Community,

I have a router model MediaTek MT7981 RFB and board name mt7981-spim-snand-rfb.
Snapshot 21.02 is currently installed and I would like to install a newer Version of openwrt, stable or snapshot.

I have found the following on the DB: https://firmware-selector.openwrt.org/?version=SNAPSHOT&target=mediatek%2Ffilogic&id=mediatek_mt7981-rfb

But this image is not accepted when flashing through uart. The selector creates an
.itb file extension, not a .bin file.

As I am new to openwrt, any feedback on how an upgrade can be done is really appreciated.

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=ce7209bd21661e3daa4a7f2f58dafdff990da19f

file renaming isn't a openwrt specific feature.

1 Like

I will follow the flash instructions and come back to you
no file renaming comes in question, I just mentioned that the firmware selector creates no bin file for this model.

how can I run those things:

  • erase 'ubi' partition
  • reset board
  • create ubootenv and ubootenv2 UBI volumes in U-Boot
  • edit environment and set bootcmd, e.g.
    setenv bootconf 'config-1#mt7981-rfb-spim-nand#mt7981-rfb-mxl-2p5g-phy-eth1'
    setenv bootcmd 'ubi read $loadaddr fit; bootm $loadaddr#$bootconf'
    can those be run on uart menu, I am not very convient with those instructions

thank you

no idea, this is done while running the stock (FW, based on, but not) openwrt.

in openwrt there's

no idea if the same commands exist in your derivative.

@daniel you added the support for the RFB, can you provide additional guidance ?

I assume what you got there is NOT the MediaTek MT7681B Reference Board MTK3943 but a different device which is based on that design. In order to add support for your device in OpenWrt, you will have to find out the modifications the vendor made and the choices they did (are they using an external 2.5GE PHY? Are they using the in-SoC 1GE PHY? Is there a MT7531 switch and which ports are used?).

As the evaluation board allows many of those options to be evaluated, it doesn't make sense to use the image intended for the reference board on a consumer device. Look at other MT7981 devices already support and also using SPI-NAND as a starting point, e.g. GL-MT3000.

Regarding the image for the MT7981B reference board:
In order to support all features of the RFB with a single image you need to replace the bootloader as well.
I assume you got the board with SPI-NAND connected to the SPI memory interface of the board.
The best is to connect the serial console and write these files to the corresponding partitions on the flash:

  • openwrt-mediatek-filogic-mediatek_mt7981-rfb-spim-nand-preloader.bin to BL2 at 0x0
  • openwrt-mediatek-filogic-mediatek_mt7981-rfb-spim-nand-bl31-uboot.fip to FIP at 0x380000

Then reboot and re-create UBI in U-Boot:

ubi detach ubi
mtd erase ubi
ubi part ubi
ubi create ubootenv 126976
ubi create ubootenv2 126976
setenv bootconf 'config-1#mt7981-rfb-spim-nand#mt7981-rfb-mxl-2p5g-phy-eth1'
setenv bootcmd 'ubi read $loadaddr fit; bootm $loadaddr#$bootconf'
setenv bootfile 'openwrt-mediatek-filogic-mediatek_mt7981-rfb-initramfs.itb'
saveenv ; saveenv

Now provide initramfs image on a TFTP server listenting on 192.168.1.254/24 and boot that:

tftpboot
bootm $loadaddr#$bootconf

Once OpenWrt comes up, you can use sysupgrade to flash the final image.

Anyway: On a consumer device you should NOT do any of that but rather create an image and device tree with the actually implemented choices and modifications such as LEDs and buttons added, ...

3 Likes

**Thank You so much Daniel for the detailed information **
Before proceeding, I have a questions about your first statement:
--------------
I assume what you got there is NOT the MediaTek MT7681B Reference Board MTK3943 but a different device which is based on that design. In order to add support for your device in OpenWrt, you will have to find out the modifications the vendor made and the choices they did (are they using an external 2.5GE PHY? Are they using the in-SoC 1GE PHY? Is there a MT7531 switch and which ports are used?).
-----------

How can I find out all those infos?
I will send you a pm with the boot log file, does it help?
or any command on openwrt get a detailed hw configuration of it?

in case that the BL2 and FIP not the compatible ones are, how can I recover then the original installed BL2 and FIP files? The u-boot will not run....

so how can those be recovered in case of any problem?

The actual MediaTek MT7981 RFB board comes with an ARM JTAG 20-pin header which makes recovery easy. If you want to port OpenWrt to a device based on that reference design the best is probably to try to stay compatible with the stock bootloader, so you will not have to replace it. In some cases, if the stock loader is broken beyond repair or simply doesn't allow images not signed by the vendor, there is no way around replacing it.

Hi @daniel , i was able to follow your suggestion till

  • openwrt-mediatek-filogic-mediatek_mt7981-rfb-spim-nand-preloader.bin to BL2 at 0x0
  • openwrt-mediatek-filogic-mediatek_mt7981-rfb-spim-nand-bl31-uboot.fip to FIP at 0x380000
    then these two commands also
ubi detach ubi
mtd erase ubi

but when i do ubi attach ubi , it says
MT7981> ubi detach ubi
MT7981> mtd erase ubi
jedec_spi_nor spi_nor@0: unrecognized JEDEC id bytes: ff, ff, ff
Erasing 0x00000000 ... 0x03ffffff (512 eraseblock(s))
MT7981> ubi attach ubi
Error, no UBI device selected!
MT7981>


my spi-nand0 partition table looks like this
MT7981> mtd list
jedec_spi_nor spi_nor@0: unrecognized JEDEC id bytes: ff, ff, ff
List of MTD devices:

  • spi-nand0
    • device: spi_nand@0
    • parent: spi@1100a000
    • driver: spi_nand
    • path: /spi@1100a000/spi_nand@0
    • type: NAND flash
    • block size: 0x20000 bytes
    • min I/O: 0x800 bytes
    • OOB size: 64 bytes
    • OOB available: 24 bytes
    • 0x000000000000-0x000008000000 : "spi-nand0"
      - 0x000000000000-0x000000100000 : "BL2"
      - 0x000000100000-0x000000180000 : "u-boot-env"
      - 0x000000180000-0x000000380000 : "Factory"
      - 0x000000380000-0x000000580000 : "FIP"
      - 0x000000580000-0x000004580000 : "ubi"

Hardware:- Comfast CF-E393AX
CPU:- model = "COMFAST CF-E393AX";
compatible = "comfast,cf-e393ax", "mediatek,mt7981-spim-snand-gsw-rfb";

Sorry, my bad, that should have been

ubi part ubi

so part instead of attach is the right sub-command. I'll edit the original instructions above as well.

Hi Daniel,

I got a MT7981 RFB(mtk3562) from a selling website like eBay. I see you have added support for the MTK3943 reference board for MT7981B+MT7976C. In my board, there is external 2.5GE PHY and in-SoC 1GE PHY is being used. Do you know how can I switch to 2.5GE PHY? Change the DTS or are there any hw switches in the board to change?

I assume your board has the MaxLinear GPY211C 2.5G connected to the SoCs SGMII1 pins and not to the MT7531 switch port 5 -- both is possible by populating some 0-Ohm SMD resistors apparently.

Deciding whether the built-in 1GE PHY or external 2.5G PHY are used on the MTK3562 reference board works entirely in software, and selection is done using Device Tree Overlay being applied by U-Boot before launching Linux.

Ie. you can use

bootm $loadaddr#mt7981-rfb-mxl-2p5g-phy-eth1

to launch OpenWrt and use the external PHY.

Note that all this of course only works if you use OpenWrt-built bl2/preloader, U-Boot and so on.

Seems not MaxLinear GPY211C . Not found out information about this phy chip.
mtk-7981-rfb-MTK7562-phy

Is that an intel logo in the corner there? In that case it could be an early version of what became MaxLinear GPY211 later on...

Yes, it's like an intel logo. However, I didn't find any information after google.

Well, it looks like it's a VQFN-56 package which would match

VQFN-56 dimensions

How could I run these 2 command under OpenWrt serial terminal?

The uboot menu has options to write to BL2 and FIP.
When you select one of these options it asks you how you want to transfer the file: tftp worked for me.
You need a tftp server anyway to load the initramfs.

A post was merged into an existing topic: Huasifei ws1610