I bought (a few) Wireless-N WiFi adapters from Ebay to enable WiFi on my OpenELEC-featured Raspberry Pi. I was hoping it would work out-of-the-box, but that wasn't true. Some attempts such as modprobe rt2x00usb did not work as expected because it's a totally different chipset.
The output of lsusb:
...
Bus 001 Device 004: ID 148f:7601 Ralink Technology, Corp.
...
This guide shows you how to cross compile the driver and integrate it in an existing OpenELEC installation. It works under Ubuntu 14.04 for OpenELEC nightly with kernel version 3.15. Common build tools are assumed, plus squashfs-tools). I'm not a pro in building modules, but this has worked for me.
- Install the dependencies:
apt-get install build-essential squashfs-tools git - Download the the driver source from here (version v3.0.0.4 from 9/13/2013) and unzip it.
- Apply this patch, for kernel 3.13+. Can be done manually.
- Note your OpenELEC kernel version, via SSH
uname -a. - Clone the Raspberry Pi tools repository:
git clone https://github.com/raspberrypi/tools. - Clone the OpenELEC repository:
git clone https://github.com/OpenELEC/OpenELEC.tv. - Download the approriate kernel version from here, and unzip it.
- Apply the patch to
KERNEL_ROOT:patch -p1 < OPENELEC_ROOT/projects/RPi/patches/linux/linux-01-RPi_support.patch. Make sure you have changed directory to theKERNEL_ROOTfolder. - Copy
OPENELEC_ROOT/project/RPi/config/linux.arm.conftoKERNEL_ROOT/.config
- Apply the patch to
- Add
RPI_TOOLS_ROOT/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/binto yourPATH. The compile tools should be available for running. - Compile kernel modules:
make modules. - Change
DRIVER_ROOT/Makefileto look as below (around line 198). Replace theLINUX_ROOTwith your path.
ifeq ($(PLATFORM),PC)
# Linux 2.6
LINUX_SRC = LINUX_ROOT
# Linux 2.4 Change to your local setting
#LINUX_SRC = /usr/src/linux-2.4
LINUX_SRC_MODULE = LINUX_ROOT/kernel/drivers/net/wireless/
CROSS_COMPILE = arm-linux-gnueabihf-
ARCH=arm
export ARCH
export CROSS_COMPILE
endif
- Run
make, which should result in a kernel objectDRIVER_ROOT/os/linux/mt7601Usta.ko - Take the
SYSTEMimage file from your SD card, and mount it withsudo mount -t squashfs SYSTEM TMPDIR. - Since the file system is read-only, rsync (as root) the contents to another dir
sudo rsync -avp TMPDIR TMPDIR2. - Create directories for the following operations (as root) if needed. Replace
x.x.xwith the kernel version.- Copy
DRIVER_ROOT/os/linux/mt7601Usta.kotoTMPDIR2/lib/modules/x.x.x/kernel/drivers/net/wireless - Copy
DRIVER_ROOT/RT2870STA.dattoTMPDIR2/etc/Wireless/RT2870STA/RT2870STA.dat - In
TMPDIR2, rundepmod -a -b . x.x.x
- Copy
- Repack the filesystem (as root) with
sudo mksquashfs TMPDIR2 SYSTEM -noappend -comp gzip. - Run
chown USER:USER SYSTEMso you can access the file. - Copy the new
SYSTEMimage to your SD card and boot OpenELEC.
Your WiFi should be ready to use! In case of problems, SSH into the system, and view the output of dmesg. Note that auto-update will probably overwrite your custom SYSTEM image, but chances are the driver will still work.
Hello,
It seems really great you could do it.
As I read on the web, many people are searching for this solution.
For someone like me, even I can handle linux knowledges, I am lost with this recipe. (I don't have any idea of how to "apply a patch" etc )
Could you just write the entire command line process you used for it, as example ?
Would be great !
Thanks
Harnon.