The mac80211 driver of MT7622 built-in WiFi is now available for newer kernel on bpi-r64.
Note that it is only tested on Openwrt trunk with kernel 4.19 currently, you can follow this guide to change the default kernel version.
The following parts will focus on how to build an Openwrt image with mt7622 wifi enabled.
Source code
mt76 driver with mt7622 built-in WiFi supported
Necessary Files
All the following files are attached, please download them first.
- dts patches: for enabling wmac interface
- mt76 Makefile: add mt7622 kernel module to menuconfig
- eeprom binary: write default wifi configs into factory partition
Apply patch
Please apply the patch for mt7622 wifi by copying 1000-mt7622-dts-support-emmc-wifi.patch
into the following path:
target/linux/mediatek/patches-4.19
The patch is used for enabling wmac interface and specifying eMMC partitions.
Config WiFi and eMMC
-
For basic configs and steps of building bpi-r64, please also refer to this guide.
-
Replace
package/kernel/mt76/Makefile
with the attached Makefile. -
Type
make menuconfig
, and the optionkmod-mt7622
can be seen at:Kernel modules -> Wireless Drivers -> kmod-mt7622
-
(Optional) Enable the following configs with
make kernel_menuconfig
, it makes mtd partitions of eMMC work normally.CONFIG_MMC=y CONFIG_MMC_BLOCK=y CONFIG_MMC_MTK=y CONFIG_MTD_BLOCK2MTD=y CONFIG_MTD_CMDLINE_PARTS=y
Note that you can just boot the system via initramfs-kernel.bin
, on which the mt7622 wifi also works, but if you want to boot with squashfs-sysupgrade.bin
, these configs must be set.
- Save and exit
Build image
-
make -j
-
copy
.bin
file to your default folder of tftp server, and bootbin/targets/mediatek/mt7622/openwrt-mediatek-mt7622-BPI-R64-initramfs-kernel.bin (choose *1. System Load Linux to SDRAM via TFTP.* in uBoot menu) or bin/targets/mediatek/mt7622/openwrt-mediatek-mt7622-BPI-R64-squashfs-sysupgrade.bin (choose *2. System Load Linux Kernel then write to Flash via TFTP.* in uBoot menu)
-
If you boot and load the mt7622 module correctly, you may find the bootlog shows something wrong during eeprom loading. Please refer to the next section.
Update eeprom
The factory partition of bpi-r64 may be empty in some devices, so we need to manually provide a binary to the partition. Just need to do it once.
-
Check the mtd partitions (on Openwrt). In this example, the
"Factory"
partition is onmtd3
root@OpenWrt:/# cat /proc/mtd dev: size erasesize name mtd0: 000c0000 00010000 "mbr" mtd1: 00080000 00010000 "uboot" mtd2: 00080000 00010000 "Config" mtd3: 00040000 00010000 "Factory" mtd4: 02000000 00010000 "Kernel" mtd5: 00270000 00010000 "kernel" mtd6: 01d80000 00010000 "rootfs" mtd7: 013d0000 00010000 "rootfs_data" mtd8: 80000000 00010000 "usrdata"
-
Write
MT7622_EEPROM.bin
into the partition/dev/mtd3
dd if=MT7622_EEPROM.bin of=/dev/mtd3
-
Reboot, the error related to eeprom should be fixed
Some demos
Related bootlog
mt7622_wmac 18000000.wmac: ASIC revision: 76220010
mt7622_wmac 18000000.wmac: MAC addr = 00:0c:43:26:60:50
mt7622_wmac 18000000.wmac: HW/SW Version: 0x8a108a10, Build Time: 20190801210006a
mt7622_wmac 18000000.wmac: N9 Firmware Version: _reserved_, Build Time: 20190801210351
mt7622_wmac 18000000.wmac: Firmware init done
mt7622_wmac 18000000.wmac: Driver own success
ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
Test results
Peak: (phy rate = 288.9 Mbps)
1000-mt7622-dts-support-emmc-wifi.patch (3.2 KB)
(Updated)1000-mt7622-dts-support-emmc-wifi.patch (3.3 KB)
Makefile_mt76.txt (7.7 KB)
MT7622_EEPROM.bin (1 KB)