-
Notifications
You must be signed in to change notification settings - Fork 2
mt7601u compilation
#Supporting MT7601u Wifi USB dongles on Raspberry Pi boards (models A, B, B+, 2B+)
This page tries to explain how to get wifi USB dongles based on the MT7601u chipset working on Raspberry Pi boards. The procedure is geared towards the Raspbian distribution, but it should work with minimal changes on any distribution using kernels provided by the Raspberry Pi foundation.
The instructions below were based on the (very helpful) following pages:
As usual, the errors are mine, not theirs.
Some adjustments were necessary, because:
- the kernel in the current Raspbian image from raspberrypi.org doesn't match the tip of the official Raspberry Pi kernel master branch,
- the Raspberry Pi 2 uses a specific kernel/config,
- the default driver from Mediatek doesn't compile with newer kernel versions (such as the ones now provided by Raspbian).
Become root.
$ sudo -s
Download latest updates.
# apt-get update
# apt-get upgrade
# rpi-update
# cd /usr/src
# git clone https://github.com/raspberrypi/linux.git
# sudo ln -s /usr/src/linux /lib/modules/`uname -r`/build
# cd linux
(Exercise for the reader: decrease git clone download time by doing a shallow clone followed by a fetch of only the necessary references)
- Carefully note the output of
uname -a
on the Raspberry Pi.
In my case, this is "Linux radio 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux". - Navigate to https://github.com/raspberrypi/firmware/commits/master/extra, and find the commit where the content of the file
extra/uname_string
(extra/uname_string7
for Raspberry Pi 2) matches the output from your board. The commit will likely be the one mentioning the bump to your kernel version, and the content of the uname_string file can be checked by clicking on a commit and scrolling down the page.
In my case, the commit was 47bd0f0 (full commit id: 47bd0f0f46bc053d8e21655e3a69c4a73ae19b41).
Note down the full commit id as it will be needed later. - Browse the files for that commit, and note the commit id contained in the
extra/git_hash
file (0be82f722c097340632a59b879fbfee9c6148f53 in my case). This commit id is a reference in the kernel git repository we cloned earlier, so we can use it to checkout the correct version of the kernel sources.
In my case, this results in the following command:
# cd /usr/src/linux; git checkout 0be82f722c097340632a59b879fbfee9c6148f53
# make mrproper
# zcat /proc/config.gz > .config
# cp .config .config.org
# make modules_prepare
For Raspberry Pi boards models A, B, B+ (using BCM2835 SoC), this is the file extra/Module.symvers, for a Raspberry Pi 2 board model B+ (using BCM2836 SoC) this is the file extra/Module7.symvers. Despite the 2 different names, the file always needs to be named Module.symvers in the kernel sources, so in the case of a Raspberry Pi 2 board you'll need to rename it. The commit id to use is the one noted down above in step 2., so in my case I ended up with the following commands:
# wget https://github.com/raspberrypi/firmware/raw/47bd0f0f46bc053d8e21655e3a69c4a73ae19b41/extra/Module7.symvers
# mv Module7.symvers Module.symvers
(simply replace the commit id and filename to match your setup)
Now that the proper kernel headers/config/symbols are in place, get the MT7601 USB driver from porjo's repository and build it. Switch back to a regular user, then:
$ cd
$ git clone https://github.com/porjo/mt7601.git
$ cd mt7601/src
$ make
$ mkdir -p /etc/Wireless/RT2870STA/
$ sudo cp RT2870STA.dat /etc/Wireless/RT2870STA/
$ sudo insmod os/linux/mt7601Usta.ko
If the module has loaded OK, you should see mt7601Usta listed in the output of lsmod
and a new network interface ra0 should be present in the output of ip link
.
If all goes well, you can permanently install the driver with sudo make install
.
Configure the ra0 interface for DHCP and make it start at boot. Edit /etc/network/interfaces to look like:
auto lo ra0
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug ra0
iface ra0 inet dhcp
wpa-ssid <your Wifi SSID>
wpa-psk <your Wifi password>
The wireless network can then be brought up by:
ifup ra0
or a reboot.
Note: I was unable to get WEP working. I didn't dig into it, but some of the messages made me suspect it might be a limitation of the MT7601u, or of the driver.
Derived from MediaTek MT7601 USB WIFI on the Raspberry Pi by Martin Bo Kristensen Grønholdt, used under CC BY-NC 4.0.