LAN and WLAN drivers - MediaTek MT7981

Hi everyone,

I was able to compile and install openwrt-23.05.0-rc1-mediatek-filogic for M7981 based router, but I cannot see WLAN nor LAN ports up, they are not working.
ifconfig and wifi did not show any output.

In the stock firmware; I can see WLAN and LAN ports up and running, it seems I need to install drivers of WLAN and LAN ports.

Can someone guide me for what to do, Thanks

EDIT ;
The device is not GL-iNet but it very similar to it.
when I downloaded GL-iNet firmware from GL website, the WLAN worked but the LAN did not work.
when I downloaded the firmware from Openwrt website, neither WLAN nor LAN worked.

Here is the boot log after new firmware upgrade

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 5.15.114 (builder@buildhost) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 12.3.0 r23069-e2701e0f33) 12.3.0, GNU ld (GNU Binutils) 2.40.0) #0 SMP Sat Jun 3 09:42:00 2023
[    0.000000] Machine model: GL.iNet GL-MT3000
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x0000000042ffffff]
[    0.000000]   node   0: [mem 0x0000000043000000-0x000000004302ffff]
[    0.000000]   node   0: [mem 0x0000000043030000-0x0000000047c7ffff]
[    0.000000]   node   0: [mem 0x0000000047c80000-0x0000000047ffffff]
[    0.000000]   node   0: [mem 0x0000000048000000-0x000000005fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 17 pages/cpu s30040 r8192 d31400 u69632
[    0.000000] pcpu-alloc: s30040 r8192 d31400 u69632 alloc=17*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: kernel page table isolation disabled by kernel configuration
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129024
[    0.000000] Kernel command line: 
[    0.000000] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 498480K/524288K available (8384K kernel code, 910K rwdata, 1468K rodata, 448K init, 301K bss, 25808K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 640 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] GICv3: Distributor has no Range Selector support
[    0.000000] Root IRQ handler: 0xffffffc008421134
[    0.000000] GICv3: 16 PPIs implemented
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x000000000c080000
[    0.000000] arch_timer: cp15 timer(s) running at 13.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x2ff89eacb, max_idle_ns: 440795202429 ns
[    0.000000] sched_clock: 56 bits at 13MHz, resolution 76ns, wraps every 4398046511101ns
[    0.000128] Calibrating delay loop (skipped), value calculated using timer frequency.. 26.00 BogoMIPS (lpj=130000)
[    0.000139] pid_max: default: 32768 minimum: 301
[    0.000438] Mount-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.000449] Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.001747] rcu: Hierarchical SRCU implementation.
[    0.002101] smp: Bringing up secondary CPUs ...
[    0.002433] Detected VIPT I-cache on CPU1
[    0.002457] GICv3: CPU1: found redistributor 1 region 0:0x000000000c0a0000
[    0.002487] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.002552] smp: Brought up 1 node, 2 CPUs
[    0.002566] SMP: Total of 2 processors activated.
[    0.002571] CPU features: detected: 32-bit EL0 Support
[    0.002575] CPU features: detected: CRC32 instructions
[    0.002600] CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching
[    0.002662] CPU: All CPU(s) started at EL2
[    0.002673] alternatives: patching kernel code
[    0.005771] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.005793] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.005937] pinctrl core: initialized pinctrl subsystem
[    0.006768] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.007066] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[    0.007096] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.007118] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.007457] thermal_sys: Registered thermal governor 'fair_share'
[    0.007461] thermal_sys: Registered thermal governor 'bang_bang'
[    0.007466] thermal_sys: Registered thermal governor 'step_wise'
[    0.007470] thermal_sys: Registered thermal governor 'user_space'
[    0.007632] ASID allocator initialised with 65536 entries
[    0.008081] pstore: Registered ramoops as persistent store backend
[    0.008088] ramoops: using 0x10000@0x42ff0000, ecc: 0
[    0.018711] cryptd: max_cpu_qlen set to 1000
[    0.021415] SCSI subsystem initialized
[    0.021597] libata version 3.00 loaded.
[    0.022806] clocksource: Switched to clocksource arch_sys_counter
[    0.023424] NET: Registered PF_INET protocol family
[    0.023521] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.024026] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.024050] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.024059] TCP established hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.024098] TCP bind hash table entries: 4096 (order: 4, 65536 bytes, linear)
[    0.024150] TCP: Hash tables configured (established 4096 bind 4096)
[    0.024219] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.024237] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.024371] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.024394] PCI: CLS 0 bytes, default 64
[    0.026857] workingset: timestamp_bits=46 max_order=17 bucket_order=0
[    0.030493] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.030509] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.064823] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.065808] pwm-mediatek 10048000.pwm: clock: top fail: -517
[    0.074702] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.076949] printk: console [ttyS0] disabled
[    0.097100] 11002000.serial: ttyS0 at MMIO 0x11002000 (irq = 18, base_baud = 2500000) is a ST16650V2
[    0.718201] printk: console [ttyS0] enabled
[    0.723220] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.732795] loop: module loaded
[    0.735938] Loading iSCSI transport class v2.0-870.
[    0.743762] spi-nand spi0.0: calibration result: 0x3
[    0.748819] spi-nand spi0.0: Winbond SPI NAND was found.
[    0.754143] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
[    0.762926] Signature found at block 2047 [0x0ffe0000]
[    0.768056] NMBM management region starts at block 1920 [0x0f000000]
[    0.776919] First info table with writecount 0 found in block 1920
[    0.790552] Second info table with writecount 0 found in block 1923
[    0.796824] NMBM has been successfully attached
[    0.801647] 6 fixed-partitions partitions found on MTD device spi0.0
[    0.808545] Creating 6 MTD partitions on "spi0.0":
[    0.813355] 0x000000000000-0x000000100000 : "BL2"
[    0.819265] 0x000000100000-0x000000180000 : "u-boot-env"
[    0.825300] 0x000000180000-0x000000380000 : "Factory"
[    0.831899] 0x000000380000-0x000000580000 : "FIP"
[    0.838247] 0x000000580000-0x0000005c0000 : "log"
[    0.843566] 0x0000005c0000-0x00000fc00000 : "ubi"
[    0.848271] mtd: partition "ubi" extends beyond the end of device "spi0.0" -- size truncated to 0xea40000
[    1.180185] mtk_soc_eth 15100000.ethernet eth0: mediatek frame engine at 0xffffffc009600000, irq 82
[    1.190555] mtk_soc_eth 15100000.ethernet eth1: mediatek frame engine at 0xffffffc009600000, irq 82
[    1.200217] i2c_dev: i2c /dev entries driver
[    1.205821] mtk-wdt 1001c000.watchdog: Watchdog enabled (timeout=31 sec, nowayout=0)
[    1.214640] NET: Registered PF_INET6 protocol family
[    1.220513] Segment Routing with IPv6
[    1.224243] In-situ OAM (IOAM) with IPv6
[    1.228195] NET: Registered PF_PACKET protocol family
[    1.233278] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    1.246516] 8021q: 802.1Q VLAN Support v1.8
[    1.251706] pstore: Using crash dump compression: deflate
[    1.266033] phy phy-usb-phy@11e10000.1: type_sw - reg 0x218, index 0
[    1.273971] UBI: auto-attach mtd5
[    1.277308] ubi0: default fastmap pool size: 90
[    1.281828] ubi0: default fastmap WL pool size: 45
[    1.286626] ubi0: attaching mtd5
[    2.422769] random: crng init done
[    2.817070] ubi0: scanning is finished
[    2.831798] ubi0: attached mtd5 (name "ubi", size 234 MiB)
[    2.837308] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    2.844177] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    2.850951] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    2.857902] ubi0: good PEBs: 1874, bad PEBs: 0, corrupted PEBs: 0
[    2.863985] ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
[    2.871192] ubi0: max/mean erase counter: 17/11, WL threshold: 4096, image sequence number: 0
[    2.879704] ubi0: available PEBs: 1341, total reserved PEBs: 533, PEBs reserved for bad PEB handling: 38
[    2.889181] ubi0: background thread "ubi_bgt0d" started, PID 447
[    2.900554] block ubiblock0_1: created from ubi0:1(rootfs)
[    2.906075] ubiblock: device ubiblock0_1 (rootfs) set to be root filesystem
[    2.932150] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    2.939512] Freeing unused kernel memory: 448K
[    2.972802] Run /sbin/init as init process
[    2.976888]   with arguments:
[    2.979842]     /sbin/init
[    2.982536]   with environment:
[    2.985674]     HOME=/
[    2.988022]     TERM=linux
[    3.198829] init: Console is alive
[    3.202347] init: - watchdog -
[    3.687361] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.717977] usbcore: registered new interface driver usbfs
[    3.723529] usbcore: registered new interface driver hub
[    3.728872] usbcore: registered new device driver usb
[    3.738533] xhci-mtk 11200000.usb: xHCI Host Controller
[    3.743815] xhci-mtk 11200000.usb: new USB bus registered, assigned bus number 1
[    3.754190] xhci-mtk 11200000.usb: hcc params 0x01403f99 hci version 0x110 quirks 0x0000000000210010
[    3.763361] xhci-mtk 11200000.usb: irq 87, io mem 0x11200000
[    3.769106] xhci-mtk 11200000.usb: xHCI Host Controller
[    3.774334] xhci-mtk 11200000.usb: new USB bus registered, assigned bus number 2
[    3.781723] xhci-mtk 11200000.usb: Host supports USB 3.2 Enhanced SuperSpeed
[    3.789240] hub 1-0:1.0: USB hub found
[    3.793054] hub 1-0:1.0: 1 port detected
[    3.797298] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    3.805829] hub 2-0:1.0: USB hub found
[    3.809609] hub 2-0:1.0: 1 port detected
[    3.816811] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.834345] init: - preinit -
[    4.223461] mtk_soc_eth 15100000.ethernet eth1: PHY [mdio-bus:00] driver [MediaTek MT7981 PHY] (irq=POLL)
[    4.235888] mtk_soc_eth 15100000.ethernet eth1: configuring for phy/gmii link mode
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    6.320005] UBIFS (ubi0:2): Mounting in unauthenticated mode
[    6.325774] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" started, PID 562
[    6.375714] UBIFS (ubi0:2): recovery needed
[    6.383367] UBIFS error (ubi0:2 pid 560): 0xffffffc0082bf1c0: no UBIFS nodes found at the log head LEB 3:0, possibly corrupted
[    6.394808] UBIFS (ubi0:2): background thread "ubifs_bgt0_2" stops
[    6.401460] mount_root: failed to mount -t ubifs /dev/ubi0_2 /tmp/overlay: Invalid argument
[    6.410617] urandom-seed: Seed file not found (/etc/urandom.seed)
[    6.458828] procd: - early -
[    6.461783] procd: - watchdog -
[    7.001641] procd: - watchdog -
[    7.005019] procd: - ubus -
[    7.063050] procd: - init -
Please press Enter to activate this console.
[    7.245160] urngd: v1.0.2 started.
[    7.273579] kmodloader: loading kernel modules from /etc/modules.d/*
[    7.289859] crypto-safexcel 10320000.crypto: EIP97:230(0,1,4,4)-HIA:270(0,5,5),PE:150/433(alg:7fcdfc00)/0/0/0
[    7.305370] Loading modules backported from Linux version v6.1.24-0-g0102425ac76b
[    7.312888] Backport generated by backports.git v5.15.92-1-44-gd6ea70fafd36
[    7.647025] mt7986-wmac 18000000.wifi: HW/SW Version: 0x8a108a10, Build Time: 20221208201745a
[    7.647025] 
[    7.867748] mt7986-wmac 18000000.wifi: WM Firmware Version: ____000000, Build Time: 20221208201806
[    7.977405] mt7986-wmac 18000000.wifi: WA Firmware Version: DEV_000000, Build Time: 20221208202048
[    8.090820] PPP generic driver version 2.4.2
[    8.095810] NET: Registered PF_PPPOX protocol family
[    8.104417] kmodloader: done loading kernel modules from /etc/modules.d/*



BusyBox v1.36.1 (2023-06-03 09:42:00 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 23.05.0-rc1, r23069-e2701e0f33
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@(none):/# ifconfig 
root@(none):/# wifi 
Command failed: Not found
root@(none):/# ifup 
Command failed: Not found
Interface  not found

Is there a reason you didn't pick the firmware for your device? According to your log it's an GL-MT3000 and in the firmware selector that device is supported for 23.05 rc.

1 Like

The device is not GL-iNet but it is very similar to it in its hardware specifications.
when I downloaded GL-iNet firmware from GL website, the WLAN worked but the LAN did not work.
when I downloaded the firmware from Openwrt website, neither WLAN nor LAN worked.

I see, do you know how similar the devices are? The lan and wifi chip are the same? Same size and partitions of flash and ram? Same number of lan ports?

There is an ubi error and your prompt is "root@none' but the Hostname should be Openwrt. Not sure everything is mounted correct.

The router here has;

3 LAN ports
1 WAN port
RAM = 512 MB
Flash - 256 MB

how to check this information

EDIT
I remember that stock firmware has MT7530 for LAN chip
I think the WLAN chip = MT7976CN

Using lspci

Start with disclosing which device it is. And be happy you didn't brick your device by blindly loading some generic image.

root@OpenWrt:/# lspci -mk
00:00.0 "Class 0002" "14c3" "7981" "7622" "14c3" "mt_rbus"

Do not worry, I was sure that it is very similar to GL-iNet MT3000. I made a research on the hardware before I started to flash GL firmware :wink:

Hi

what @Borromini is saying is:
almost every device with wifi chip have a radio calibration data partition
so if you flash some random image with some random partition table, you could erase ART partition and your board will be unusable
It is because ART partition is specific for each device and (mostly) could not be transfered from another (similar) one. This is factory calibration data for your wifi chip

1 Like

can't find any refereces to the VID and PID in the 6.1.14 Linux kernel, so it might be unsupported.

This is a better explanation :clap: :+1:

I have the stock firmware, it is based on Openwrt v21

The WLAN is exactly as same as WLAN of GL MT3000

What I noticed with GL image is that the root filesystem is not mounted

This doesn't really say anything useful about the device/hw.

It means that the router supports openWrt!

no dude, it doesn't.

it means they use openwrt for the user space part, while the kernel (= hw support) are based on some vendor SDK.

1 Like

This part makes more sense!

The SDK is also based on Openwrt!

Now, my goal is to just add AdBlock and some other service, in addition I want to add Luci Themes.

The stock firmware does not have [ System -> Software ] feature, that is why I want to change to the standard (vanilla) OpenWrt image.

So my question is:
if I can get the SDK from the vendor , can I add some packages like AdBlock and change the Luci themes??

At least in theory, but it might not be so easy to add/build the packages.
If you're lucky, adblock could be perhaps be installed while running the stock fw.

If it is possible in theory; Then I have to try it.