Power & Source of Big Ideas

Struggling to compile rtl8812au driver.

Moderators: chensy, FATechsupport

Hello community,

I spended now several hours to get the rtl8812 driver for an Edimax 7811UTC (5GHz USB Wifi) compiled.

My board is an Nanopi-Neo2, uname -a says

Code: Select all

Linux NanoPi-NEO2 4.14.0 #25 SMP Fri May 11 16:57:53 CST 2018 aarch64 aarch64 aarch64 GNU/Linux


I tried several Methods from cross-compile on an Ubuntu x86_64 to compile native on Nanopi, either it fails for compile or, and that is my actual issue, get just an ARM 32bit elf Kernel module out (required one is for aarch64).

My latest steps for cross compile are:

Code: Select all

$ git clone https://github.com/ARMWorks/NanoPi-Linux-4.1.y.git
$ git clone https://github.com/friendlyarm/prebuilts.git
$ sudo tar xzf prebuilts/gcc/arm-linux-gcc-4.4.3.tar.gz -C /

Installed prebuilt toolchain and set path to it.
(optionally I tried Ubuntu arm-none-abi TC as well)

Next I preconfigured the kernel source:

Code: Select all

make oldconfig && make prepare

Then I got the rtl8812 kernel module from https://github.com/gnab/rtl8812au.git

Before I changed the Platform:

Code: Select all

diff --git a/Makefile b/Makefile
index 71d0660..6b14487 100644
--- a/Makefile
+++ b/Makefile
@@ -50,7 +50,7 @@ CONFIG_EXT_CLK = n
@@ -80,7 +80,7 @@ CONFIG_PLATFORM_DMP_PHILIPS = n

Code: Select all

cd rtl8812au
make CROSS_COMPILE=arm-none-eabi- KSRC=../NanoPi-Linux-4.1.y clean all

And I got a pecious 8812au.ko file, but for the wrong architecture (ELF 32 EABI5 rather then aarch64).


My question are now:

1) How can I get a 64bit kernel module compiled on Nanopi or cross compiled.
2) alternatively an option is definitively to switch the whole Nanopi to 32 Bit. Is there an 32 Bit Image?

Any help is apreciated, many thanks in advance, Axel.
You probably want to make sure that you have

Code: Select all


in your kernel .config file, otherwise you will compile 2 32 bit executable.
Or simply go with Armbian, where this chip is supported out of the box and with a better driver.
Many thanks @itnavigate for your reply. Yes, ARM64 was one of the issues I had. But the main reason turned out that I followed the wrong website :(

However if somebody has the same issue, here is a description of my build steps.

Cross Compile 8812au Module for Edimax 7811UTC - state as of 2018-07-11

    * Follow instructions http://wiki.friendlyarm.com/wiki/index. ... _and_Linux to setup
    * The description on this page works not for Neo2 and Kernel 4.14 https://github.com/ARMWorks/NanoPi-Linux-4.1.y/wiki/Compiling-NanoPi-Kernel
    * The kernel module for Edimax 7811UTC is cross-compiled on a Linux x86_64 (Manjaro and Ubuntu tested)

Get the cross compiler ready, using Linaro toolchain:
Download the current Linaro toolchain, as of 2018-07-11 it was gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz
and install it.

Code: Select all

$ sudo mkdir -p /opt/FriendlyARM/toolchain
$ sudo tar xf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz -C /opt/FriendlyARM/toolchain/

Get the kernel sources and prepare build

Code: Select all

$ git clone  https://github.com/friendlyarm/linux.git   -b sunxi-4.x.y --depth 1  nanopi-linux-4.x
$ cd nanopi-linux-4.x
$ export PATH=/opt/FriendlyARM/toolchain/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/:$PATH
$ touch .scmversion
$ make sunxi_arm64_defconfig ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
$ make ARCH=arm64 \
   CROSS_COMPILE=aarch64- \

Download the 8812au driver sources and compile it:

Code: Select all

$ git clone https://github.com/gnab/rtl8812au.git
$ cd rtl8812au
$ make KSRC=../nanopi-linux-4.x \
     CROSS_COMPILE=aarch64-linux-gnu- \

Now you get the file =8812au.ko=

Code: Select all

$ file 8812au.ko
8812au.ko: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), BuildID[sha1]=15385b6a189fbdbf9746d263cc5f84852d469626, not stripped

Install the module on the nano-pi

Code: Select all

$ scp 8812au.ko <myuser>@<mynanopi>:/tmp
$ ssh <myuser>@<mynanopi>

On =<mynanopi>= execute:

Code: Select all

$ sudo cp /tmp/8812au.ko /lib/modules/4.14.0/kernel/drivers/net/wireless/8812au.ko
$ sudo depmod
$ sudo insmod 8812au.ko

If the USB stick is connected to the NanoPi you will see:

Code: Select all

$ ifconfig
wlan0     Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:62 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    * 2018-07-11 - few edits to fix typos, uperr vs. lower case ...
Hello igorp, indeed I started with Armbian. But there was the config tool broken and I was not able to enable 2nd and 3rd USB ... the menu simply displayed garbage ... well but thats offtopic in this thread :-)

What better driver is used by Armbian,. ... the one from the Edimax page?

igorp wrote:
Or simply go with Armbian, where this chip is supported out of the box and with a better driver.
awachtler wrote:
Hello igorp, indeed I started with Armbian. But there was the config tool broken and I was not able to enable 2nd and 3rd USB ... the menu simply displayed garbage ... well but thats offtopic in this thread :-)

Well, config tool is not yet on the level to deal with more complex setups, like more than one device, creating bridges, etc. I am planning to implement that once I find some time. It's already in my head but need to start coding.

I am also running a setup of two 8812AU in my summer house and I was ofc not able to complete this with our configurator, but manually ... One for a 2.4G band and one for 5Ghz, (I still used config tool to create both hostapd configs). One is actually 8814AU to get even more bandwidth. Then I also have a 3rd adaptor which is connecting to public wireless network ... + LTE backup.

Sources are not from Edimax. I am not aware if they are more recent. I doubt. I am using those:
https://github.com/aircrack-ng/rtl8812au There are even more recent versions, that are present in a current kernel but I am not aware of pros and cons.

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 47 on Wed Feb 21, 2018 7:00 am

Users browsing this forum: No registered users and 4 guests