Realtek 8812au Drivers for Raspberry Pi 2

The problem with the Raspberry Pi 2 is that it’s a great device, but it lacks wireless capability.  Additionally, from what I’ve read, the Pi 3 has a problem with connecting to wireless at distances because of the antenna (or lack of).  The venture started because I wanted to install OctoPi for my 3D Printer and have that control everything.  Not having a Pi 3, I decided to use one of my old Realtek wireless antennas to get wireless access.  Most linux distributions don’t support the 8812au out of the box and getting this installed was proving to be a huge pain, but once I found the right drivers, the installation was pretty simple.

First, had to identify the device:

lsusb:

Bus 001 Device 004: ID 0bda:0811 Realtek Semiconductor Corp.

On a Debian or Raspian build, you need to update you kernel and install the kernel headers.

# apt-get update && apt-get install rasperrypi-kernel raspberrypi-kernel-headers

Then install dkms so that it can rebuild the drivers if you update.

# apt-get install dkms build-essential

Now, we have to get the right driver.  The one that worked for me was the gnab drivers on github.

mkdir drivers/ &&; cd drivers/
git clone -b v4.3.21 https://github.com/astsam/rtl8812au
cd rtl8812au
sed -i ‘s/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g’ Makefile
sed -i ‘s/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g’ Makefile
make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm
make install
cp 8812au.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
depmod -a
modprobe 8812au

Then for the DKMS piece:

dkms add -m 8812au -v 4.3.21
dkms build -m 8812au -v 4.3.21
dkms install -m 8812au -v 4.3.21

To remove the driver:

dkms remove -m 8812au -v 4.3.21 --all