Skip to content

Instantly share code, notes, and snippets.

@SlavikZ
Last active August 26, 2016 20:05
Show Gist options
  • Save SlavikZ/adeca9234e76625b9aee to your computer and use it in GitHub Desktop.
Save SlavikZ/adeca9234e76625b9aee to your computer and use it in GitHub Desktop.
RTL8192EU driver for RaspberryPi OpenELEC cross compilation and embedding guide

This guide was based on this guide. The guide shows you how to cross compile the driver for a WiFi USB dongle based on RTL8192EU chipset and integrate it into an existing OpenELEC installation. It works under Ubuntu 14.04 for OpenELEC 5.0.8 (32bit) with kernel version 3.17.8.

The output of usb-devices on Ubuntu 14.04:

T:  Bus=02 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  6 Spd=480 MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0bda ProdID=818b Rev=02.00
S:  Manufacturer=Realtek
S:  Product=802.11n NIC
S:  SerialNumber=00e04c000001
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 5 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)

Compile steps:

  • Install the dependencies: apt-get install build-essential squashfs-tools git
  • Get the the driver source: git clone https://github.com/Mange/rtl8192eu-linux-driver.
  • Note your OpenELEC kernel version, via SSH uname -a or simply grep target\KERNEL file from OpenELEC distribution: grep -aoP "Linux version\s+[\d\.]+\s\S+" OPENELEC_DIST_ROOT/target/KERNEL
  • 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.
  • Change directory to OPENELEC_ROOT folder and switch to 5.0 version: git checkout openelec-5.0
  • Download the approriate kernel version from here, unzip it and change directory to the KERNEL_ROOT folder.
    • 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 the KERNEL_ROOT folder.
    • Make default RPi configuration: PATH=$PATH:RPI_TOOLS_ROOT/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
    • Copy OPENELEC_ROOT/projects/RPi/linux/linux.arm.conf to KERNEL_ROOT/.config: cp OPENELEC_ROOT/projects/RPi/linux/linux.arm.conf .config
    • Make kernel modules: PATH=$PATH:RPI_TOOLS_ROOT/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules.
  • Change directory to DRIVER_ROOT folder.
    • Make driver module (replace x.x.x with the kernel version): PATH=$PATH:RPI_TOOLS_ROOT/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin make ARCH=arm KVER=x.x.x KSRC=KERNEL_ROOT CROSS_COMPILE=arm-linux-gnueabihf-. You should get kernel module DRIVER_ROOT/8192eu.ko.
    • Unpack OpenELEC SYSTEM image file to SYSTEM_FS_TMP directory: sudo unsquashfs -d SYSTEM_FS_TMP OPENELEC_DIST_ROOT/target/SYSTEM
    • Create directory for the module (replace x.x.x with the kernel version): sudo mkdir SYSTEM_FS_TMP/lib/modules/x.x.x/RTL8192EU
    • Copy kernel module: sudo cp 8192eu.ko SYSTEM_FS_TMP/lib/modules/x.x.x/RTL8192EU/
    • Update kernel modules data: sudo depmod -a -b SYSTEM_FS_TMP x.x.x
    • Repack the SYSTEM image file: sudo mksquashfs SYSTEM_FS_TMP SYSTEM -noappend -comp gzip
  • Copy the new SYSTEM image 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment