Compiling the rtl8812au Wifi Driver for Raspbian
In the beginning of 2016 the Raspberry Pi Foundation released the Raspberry Pi 3 Model B. It was the first Raspberry Pi model that was equipped with 802.11 Wireless LAN out of the box. Previous models just didn’t have wifi. Buying a wifi USB dongle is the only way to use Wireless LAN with older models like the Raspberry Pi 2 Model B.
The drawback of Raspberry Pi 3’s wifi, the very popular Edimax EW-7811Un or even the official Raspbery Pi USB Wifi Dongle is that all of them only operate in the 2.4Ghz band (IEEE 802.11b/g/n). If you live in a big city like me you may have noticed that those frequencies are pretty crowded. That’s because each of your neighbours runs his own access point. I’m talking of 30+ wireless networks within reach. That means a lot of interference and concurrent usage of frequencies. In such an environment throughput performance is quite bad. Sometimes also connection losses occur. If it’s really bad not even switching the channel helps. Fortunatelly the IEEE 802.11 standard also specifies operation in other frequency bands. IEEE 802.11a/n/ac do so for the 5GHz band. Even though these parts of the standard also exist for several years now, they are less often in use. This is good news. That’s why almost all of the wifi devices in my place support IEEE 802.11a, n or ac. And in fact competition with neighbours is less.
When I was looking for a wifi dongle for my Raspberry Pi 2 I was specifically searching for one supporting 5GHz. A friend recommended the Edimax EW-7811UTC. So I bought one. What I didn’t consider before buying that thing was the driver support by common distributions for the Raspberry Pi. I realized that while OpenELEC for instance does come with a driver for the Edimax EW-7811UTC out of the box, Raspbian doesn’t.
Compiling the Driver step by step
While finding an open source driver for the Edimax EW-7811UTC was easy, compiling it for Raspbian was a bit more of a challenge. That’s because Raspbian doesn’t ship with its kernel sources in the software repositories. After some web research I stumbled upon rpi-source. This small tool is able to install the kernel source used to build the kernel on the Raspian image.
By the way, the driver could not only be used for the Edimax EW-7811UTC. The Realtek 8812au chipset is also built into many other wifi products like the D-Link DWA-171. So if you know that your wifi dongle is also using the rtl8812au chipset this might work for you, too.
So here is what it takes to compile the rtl8812au driver for Raspbian:
Now you can start configuring your wifi network using
wpa_supplicant or the wifi configuration tool of your choice.
The procedure has been tested on a Raspberry Pi 2 Model B and Raspberry Pi Zero running:
- Raspbian Jessie release 2016-05-27 using kernel version 4.4.11-v7+
- Raspbian Jessie release 2016-09-23 using kernel version 4.4.21-v7+
- Raspbian Jessie release 2017-01-11 using kernel version 4.4.34-v7+
- Raspbian Jessie release 2017-04-10 using kernel version 4.4.50-v7+
I started to bootstrap all my computers using Ansible a while ago. Especially for the Raspberry Pi I find an Ansible playbook pretty helpful since I keep setting it up from scratch for various new projects very often. For compiling the rtl8812au wifi driver on Raspbian I published an Ansible role on github. Check it out: