Friday, October 30, 2015

MT7601 on Raspberry Pi

Here's how to cross compile driver for Mediatek MT7601 based wifi dongle.

Before this, you need to compile your own raspibian kernel, see my old post: http://igunosystem.blogspot.co.id/2014/03/step-by-step-building-raspibian-on.html
After above process is OK, You'll have compiled kernel source and working root file system with working chroot (using qemu-arm-static) for raspberry pi board on your Desktop PC.

mt7601
download source:
https://github.com/porjo/mt7601/archive/master.zip
or
git clone https://github.com/porjo/mt7601.git
edit Makefile

ifeq ($(PLATFORM),PC)
# Linux 2.6
LINUX_SRC = [linux_source_dir]

# Linux 2.4 Change to your local setting
#LINUX_SRC = /usr/src/linux-2.4
LINUX_SRC_MODULE = [rootfs_dir]/lib/modules//kernel/drivers/net/wireless
CROSS_COMPILE = [toolchains_dir]/bin/arm-linux-gnueabihf-
ARCH=arm
export ARCH
export CROSS_COMPILE
endif


Compile It using:
make

To Install, see the install part on Makefile
install:
    rm -rf $(DAT_PATH)
    $(shell [ ! -f /etc/Wireless ] && mkdir /etc/Wireless)
    mkdir $(DAT_PATH)
    cp $(RT28xx_DIR)/$(DAT_FILE_NAME) $(DAT_PATH)/.
    install -d $(LINUX_SRC_MODULE)
    install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE)
    /sbin/depmod -a ${shell uname -r}


Now copy the RT2870STA.dat & mt7601Usta.ko to somewhere in your running raspberry system or chroot to raspberry folder with qemu-arm-static then do

mkdir /etc/Wireless/RT2870STA
cp RT2870STA.dat /etc/Wireless/RT2870STA/.
install -d /lib/modules/$(uname -r)/kernel/drivers/net/wireless/
install -m 644 -c mt7601Usta.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless/

depmod -a $(uname -r)

You can get my working copy of pre-compiled kernel 3.14y including working mt7601 & rtl8188eu driver from here:
https://www.mediafire.com/?lq5cvlskurcy5y0
Copy to your RaspberryPi SD Card somewhere, extract it, and forced copy to root folder, then reboot with wifi dongle plugged, you should see the ra0 in ifconfig.

source:
http://groenholdt.net/Computers/RaspberryPi/MediaTek-MT7601-USB-WIFI-on-the-Raspberry-Pi/MediaTek-MT7601-USB-WIFI-on-the-Raspberry-Pi.html
http://www.mediatek.com/en/downloads1/downloads/usb/
https://github.com/porjo/mt7601
https://github.com/kuba-moo/mt7601u


2 comments:

  1. Dear Gunawan,
    Can i use your pre-compiled version on Odroid C2? (on Ubuntu 16.04 / Kernel 3.14.61)

    ReplyDelete
  2. I believe it won't work, because different architecture. You should recompile on your system with working kernel source. Or you may upgrade you kernel to version 4, it already included on kernel source.

    ReplyDelete