MT76 precompiled drivers (mediatek wifi is useless in MT7628)

the code was really a mess... now I can understand why mtk denied to open it.

Sheesh - they made a huge mess of things. I have 840v5 running thanks to @robimarko - it also has mt7628 and sadly the same issues as before.

Flashed, worked out of the box with TFTP on my version. Sadly, WiFi keeps presenting the dreaded issues.

Here is wireless config

config wifi-device 'radio0'
option type 'mac80211'
option channel '11'
option hwmode '11g'
option path 'platform/10300000.wmac'
option htmode 'HT20'
option country 'US'
option disabled '0'

config wifi-iface 'default_radio0'
option device 'radio0'
option network 'lan'
option mode 'ap'
option encryption 'psk2'
option key '704F5738DF8E'
option ssid 'HelloThere-TestingNow'

And here is the log when Clients connect

Tue Nov  7 08:30:49 2017 daemon.notice hostapd: wlan0: AP-ENABLED 
Tue Nov  7 08:31:14 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: authenticated
Tue Nov  7 08:31:14 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: associated (aid 1)
Tue Nov  7 08:31:14 2017 daemon.notice hostapd: wlan0: AP-STA-POSSIBLE-PSK-MISMATCH 74:8d:08:1b:61:f1
Tue Nov  7 08:31:15 2017 daemon.notice hostapd: wlan0: AP-STA-POSSIBLE-PSK-MISMATCH 74:8d:08:1b:61:f1
Tue Nov  7 08:31:16 2017 daemon.notice hostapd: wlan0: AP-STA-POSSIBLE-PSK-MISMATCH 74:8d:08:1b:61:f1
Tue Nov  7 08:31:17 2017 daemon.notice hostapd: wlan0: AP-STA-POSSIBLE-PSK-MISMATCH 74:8d:08:1b:61:f1
Tue Nov  7 08:31:23 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: deauthenticated due to local deauth request
Tue Nov  7 08:31:38 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: authenticated
Tue Nov  7 08:31:38 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: associated (aid 1)
Tue Nov  7 08:31:38 2017 daemon.notice hostapd: wlan0: AP-STA-CONNECTED 74:8d:08:1b:61:f1
Tue Nov  7 08:31:38 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 WPA: pairwise key handshake completed (RSN)
Tue Nov  7 08:36:50 2017 daemon.notice hostapd: wlan0: AP-STA-DISCONNECTED 74:8d:08:1b:61:f1
Tue Nov  7 08:36:50 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: disassociated
Tue Nov  7 08:36:51 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE)
Tue Nov  7 08:36:52 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: authenticated
Tue Nov  7 08:36:52 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: associated (aid 1)
Tue Nov  7 08:36:52 2017 daemon.notice hostapd: wlan0: AP-STA-CONNECTED 74:8d:08:1b:61:f1
Tue Nov  7 08:36:52 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 WPA: pairwise key handshake completed (RSN)
Tue Nov  7 10:20:12 2017 daemon.info hostapd: wlan0: STA 80:e6:50:06:03:74 IEEE 802.11: authenticated
Tue Nov  7 10:20:13 2017 daemon.info hostapd: wlan0: STA 80:e6:50:06:03:74 IEEE 802.11: associated (aid 2)

I also tried with

uci set wireless.@wifi-iface[0].disassoc_low_ack=0
uci set wireless.@wifi-iface[0].max_inactivity=86401
uci set wireless.@wifi-iface[0].skip_inactivity_poll=1
uci set wireless.@wifi-iface[0].wpa_group_rekey=0
uci commit wireless

and lowering txpower to 20 (I read somewhere it has to do with heat),

Less issues, but very very constant too.

On the other hand, stock 840v4 and 840v5 (MT7628) work fantastic.

Please do for mt7603, until it bores you ...

What is the current status of mt7628 working? not working?

I noticed that you committed about it 10 days ago.

Thanks a lot for your work!

PS: I noticed that unfortunately mt7628 was not compiled for Lede stable version (kernel 4.9.92).

PS2:

I also noticed some guy had uploaded the full source to github, hmm, that’s at least not respectiful …

It's at least not respectfull from Mediatek to use GPL software without complying to the GPL, and to sell hardware without software support so...

I've compiled lede 17.01 form source and added your mt7628 driver for 4.4.102 I get the kernel panic enclosed.

As an afterthough I think it's normal because we don't use the same toolchain (you for your module, and me for my kernel), and modules should be compiled with the exact same compiler as kernel. Isn't it?

[   44.944869] === pAd = c080c000, size = 1292832 ===
[   44.944869] 
[   44.954404] <-- RTMPAllocTxRxRingMemory, Status=0, ErrorValue=0x
[   44.961754] <-- RTMPAllocAdapterBlock, Status=0
[   44.966390] RtmpChipOpsHook(492): Not support for HIF_MT yet!
[   44.972215] mt7628_init()-->
[   44.975148] mt7628_init(FW(8a00), HW(8a01), CHIPID(7628))
[   44.980623] e2.bin mt7628_init(1135)::(2), pChipCap->fw_len(63888)
[   44.986908] mt_bcn_buf_init(218): Not support for HIF_MT yet!
[   44.992733] <--mt7628_init()
[   52.578182] Unhandled kernel unaligned access[#1]:
[   52.583068] CPU: 0 PID: 2200 Comm: dnsmasq Tainted: P                4.4.102 #0
[   52.590485] task: 8297c000 ti: 830d6000 task.ti: 830d6000
[   52.595955] $ 0   : 00000000 7fe461c8 fffffdc9 00000094
[   52.601275] $ 4   : 8028a6d8 00000000 00000000 00000000
[   52.606582] $ 8   : 00000080 830ad1f8 00000000 00000ec9
[   52.611892] $12   : 7fe46108 7fe461a8 00000000 774bc2c0
[   52.617204] $16   : 82801900 81da81ec 00000000 00000001
[   52.622515] $20   : 00000000 833c698c 00000000 00000025
[   52.627821] $24   : 00000000 77421000                  
[   52.633130] $28   : 830d6000 830d7c40 00000014 8028a6e4
[   52.638442] Hi    : 00000000
[   52.641359] Lo    : 00000ec9
[   52.644311] epc   : 8028a388 inet6_dump_addr+0x10c/0x4f0
[   52.649701] ra    : 8028a6e4 inet6_dump_addr+0x468/0x4f0
[   52.655082] Status: 1100a403    KERNEL EXL IE 
[   52.659335] Cause : 00800010 (ExcCode 04)
[   52.663396] BadVA : ffffffa9
[   52.666315] PrId  : 00019655 (MIPS 24KEc)
[   52.670373] Modules linked in: mt7628(P) pppoe ppp_async iptable_nat pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4 ipt_REJECT ipt_MASQUERADE xt_time xt_tcpudp xt_tcpmss xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CLASSIFY slhc nf_reject_ipv4 nf_nat_redirect nf_nat_masquerade_ipv4 nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_rtcache iptable_mangle iptable_filter ipt_ECN ip_tables crc_ccitt sch_fq sch_teql em_nbyte sch_dsmark sch_pie act_ipt sch_gred em_cmp cls_basic sch_prio sch_codel em_text em_meta sch_sfq act_police sch_red act_connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow cls_route cls_fw sch_tbf sch_htb sch_hfsc sch_ingress ledtrig_usbport mac80211 cfg80211 compat ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables x_tables ifb tun leds_gpio ohci_platform ohci_hcd ehci_platform ehci_hcd gpio_button_hotplug usbcore nls_base usb_common [last unloaded: mt76]
[   52.774244] Process dnsmasq (pid: 2200, threadinfo=830d6000, task=8297c000, tls=774bdd48)
[   52.782529] Stack : 8285b2ec 82801900 024000c0 801eb8b8 00000014 00000002 fffffdc9 00000000
      00000000 00000094 8035635c 833c6a04 83802780 00000000 803a4810 00000001
      8028a6d8 00000001 81da8000 82801900 00000f40 81da81ec 00000000 00000000
      00000008 774b6d8c 00000000 80224bec 0a2900c0 800b3d28 00000000 800c01f4
      830d7e90 8348b198 81da8000 830d7d1c 81da8064 82801480 8333c100 802252f8
      ...
[   52.818650] Call Trace:
[   52.821137] [<8028a388>] inet6_dump_addr+0x10c/0x4f0
[   52.826183] [<80224bec>] netlink_dump+0x110/0x2bc
[   52.830957] [<802252f8>] __netlink_dump_start+0xdc/0x188
[   52.836354] [<8020f248>] rtnetlink_rcv_msg+0x160/0x1fc
[   52.841567] [<802272ec>] netlink_rcv_skb+0x7c/0xf8
[   52.846427] [<8020cd88>] rtnetlink_rcv+0x24/0x34
[   52.851112] [<80226b50>] netlink_unicast+0x158/0x240
[   52.856149] [<802270b8>] netlink_sendmsg+0x388/0x3cc
[   52.861194] [<801e1da4>] sock_sendmsg+0x18/0x30
[   52.865795] [<801e3cd8>] SyS_sendto+0xcc/0x120
[   52.870316] [<8000686c>] syscall_common+0x30/0x54
[   52.875081] 
[   52.876588] 
Code: 0002b00b  0000b021  8fa20018 <8c4201e0> 104000d9  00009021  8f830010  24630200  af830010 
[   52.886787] ---[ end trace 17702c6472f69e92 ]---
[   52.894492] Fatal exception: panic in 5 seconds
[   57.904803] Kernel panic - not syncing: Fatal exception
[   57.912051] Rebooting in 3 seconds..

@nossiac: Thanks for these drivers! I use them for a Linkit Smart 7688 device and they seem to perform better than the opensource mt76 driver. I successfully used the ap and station modes, but only using wpa2. I would now like to connect to an EAP network, but I don't understand how to configure this in the .dat configuration file. Do you know if it that's possible using this driver?

Could someone have mt7628 driver working on lede 17.01.4? I get instant kernel panic, with precompiled drivers.

If someone had it working, please explain how.

1 Like

the driver has builtin support for all various auth & encryptions.
you can have a try following the source code here:

1 Like

Thanks! I tried already to configure wpa-eap using the mtk luci plugin, but this seems to be only possible for an acces-point setup. For a client (sta) setup I could not set any radius related options.

This is the config I use with the opensource mt76 driver:


config wifi-iface
  option network 'wwan'
  option device 'radio0'
  option mode 'sta'
  option ssid '****'
  option encryption 'wpa2'
  option eap_type 'peap'
  option ca_cert '/etc/ca_cert'
  option auth 'EAP-MSCHAPV2'
  option identity '****'
  option password '****'

Any clues to get this config working using the mtk drivers?

Hi @nossiac , how can we use this in a build environment? What you posted a few days ago, what would be the steps to take?

Did you check the readme over here?

Haha. well shaiza. Sorry! I'll get to building right away. RTFM FTW.

@amaurynieto @BertL sorry that I don't browse this forum very often.

The drivers I put on github do not work with openwrt's uci config directly, they all use a configuration file named mt76xx.dat, usually referred as "wifi profile", usually you can find it at /etc/wireless/mt76xx/mt76xx.dat. to make the profile work, you should:

ifconfig down -> modify the profile -> ifconfig up

There are 2 ways to integrate the driver with openwrt:
first one is to use luci-app-mtk, it's an independent wifi configuration page for luci, it uses lua script to manipulate the wifi profile, recommended because it's quite easy to extend, potentially powerful.
the second choice is uci2dat, which is a small app that translates openwrt's /etc/config/wireless into mt76xx.dat. thus you may use openwrt's wifi page to configure those drivers.

Hello. So I built it with Buildroot, and booted up 840nv5

It does not see wlan0 nor ra0, it boots up fine.
I do get the following errors on logread... Never mind the initial date, it was before nmap had connected to the timeserver.

Tue Nov  7 14:22:07 2017 user.err kernel: [    2.436312] kmodloader: failed to mmap /lib/modules/4.9.58/mt7628.ko

Tue Nov  7 14:22:07 2017 user.err kernel: [    9.270573] kmodloader: failed to mmap /lib/modules/4.9.58/mt7628.ko
Tue Jan 9 14:28:55 2017 daemon.err modprobe: failed to mmap /lib/modules/4.9.58/mt7628.ko
Tue Jan 9 14:28:55 2017 daemon.err modprobe: failed to mmap /lib/modules/4.9.58/mt7628.ko
Tue Jan 9 14:28:57 2017 daemon.err modprobe: failed to mmap /lib/modules/4.9.58/mt7628.ko
Tue Jan 9 14:28:57 2017 daemon.err modprobe: failed to mmap /lib/modules/4.9.58/mt7628.ko
Tue Jan 9 14:30:00 2017 cron.info crond[967]: USER root pid 1122 cmd /usr/bin/vnstat-cron
Tue Jan 9 14:36:03 2017 daemon.err modprobe: failed to mmap /lib/modules/4.9.58/mt7628.ko
Tue Jan 9 14:36:03 2017 daemon.err modprobe: failed to mmap /lib/modules/4.9.58/mt7628.ko
Tue Jan 9 14:36:07 2017 daemon.err modprobe: failed to mmap /lib/modules/4.9.58/mt7628.ko
Tue Jan 9 14:36:07 2017 daemon.err modprobe: failed to mmap /lib/modules/4.9.58/mt7628.ko

Yep, built from scratch on Lede Trunk, git pull, everything.

I get this, on MT7628 TL-WR840N Ver 5.0

root@OpenWrt:~# logread |grep mt76
Tue Jan  9 13:40:57 2018 kern.info kernel: [    0.139125] mt7621_gpio 10000600.gpio: registering 32 gpios
Tue Jan  9 13:40:57 2018 kern.info kernel: [    0.144857] mt7621_gpio 10000600.gpio: registering 32 gpios
Tue Jan  9 13:40:57 2018 kern.info kernel: [    0.150392] mt7621_gpio 10000600.gpio: registering 32 gpios
Tue Jan  9 13:40:57 2018 kern.info kernel: [    0.297952] spi-mt7621 10000b00.spi: sys_freq: 193333333
Tue Jan  9 13:40:57 2018 user.err kernel: [    2.583074] kmodloader: failed to mmap /lib/modules/4.9.73/mt7628.ko
Tue Jan  9 13:40:57 2018 user.err kernel: [    9.166784] kmodloader: failed to mmap /lib/modules/4.9.73/mt7628.ko
Tue Jan  9 13:41:04 2018 daemon.err modprobe: failed to mmap /lib/modules/4.9.73/mt7628.ko
Tue Jan  9 13:41:04 2018 daemon.err modprobe: failed to mmap /lib/modules/4.9.73/mt7628.ko
Tue Jan  9 13:41:04 2018 daemon.err modprobe: failed to mmap /lib/modules/4.9.73/mt7628.ko
Tue Jan  9 13:41:04 2018 daemon.err modprobe: failed to mmap /lib/modules/4.9.73/mt7628.ko
Tue Jan  9 13:41:04 2018 daemon.err modprobe: failed to mmap /lib/modules/4.9.73/mt7628.ko
Tue Jan  9 13:41:05 2018 daemon.err modprobe: failed to mmap /lib/modules/4.9.73/mt7628.ko
Tue Jan  9 13:41:05 2018 daemon.err modprobe: failed to mmap /lib/modules/4.9.73/mt7628.ko

root@OpenWrt:~# cat /proc/cpuinfo 
system type		: MediaTek MT7628AN ver:1 eco:2
machine			: TP-Link TL-WR840N v5
processor		: 0
cpu model		: MIPS 24KEc V5.5
BogoMIPS		: 385.84
wait instruction	: yes
microsecond timers	: yes
tlb_entries		: 32
extra interrupt vector	: yes
hardware watchpoint	: yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa			: mips1 mips2 mips32r1 mips32r2
ASEs implemented	: mips16 dsp
shadow register sets	: 1
kscratch registers	: 0
package			: 0
core			: 0
VCED exceptions		: not available
VCEI exceptions		: not available

Just to tell that I found this repo that work for me on mt7628, it contains sources and patches for the proprietary driver:

The other repo with pre-compiled drivers did not work for me.

Is this stable ? I tried many revsisions of lede but still mt drivers are bad

It seems stable, even if we need to do more tests.

But this repo does not include mt76 driver which is free software and included by default in lede, and still very unstable

I includes a leaked version of the proprietary drive source code (mt7628.ko), therefore It's not very legal. But also it's not a standart linux wifi driver. It has it's own config file, will not work with hostapd or wpad-mini, and will only work in AP mode.

Yeah too bad. It also does not work with tp-link 840 v4/5.
Code need rewrite..

Hello guys, what about this guide? http://rgho.st/private/7sQXBwDCn/78d517e97773daa6e627a9f31664b9b5

Is it guide used to rewrite the driver ?

I found it on https://wikidevi.com/wiki/MediaTek External links for MT7628N