Rock64 Wifi Module

I successfully installed Dietpi on my new Rock64 2G board. However, I cannot make my RTL8812AU wifi module to work on Dietpi.
I tried to compile the driver by myself but the linux headers for Rock64 cannot be found, tried to get the headers but apt-get told me the system has the newest headers.
I am wondering, is there a way to compile the driver for Dietpi? Will Dietpi support RTL8812AU wifi module in the future? I found
https://github.com/ayufan-rock64/linux-kernel/tree/release-4.4/drivers/net/wireless/rockchip_wlan
has a lot of drivers ready for compilation if it is possible on Dietpi.

Looks like not many people are using Rock64, very few views and no replies.

Anyways, I spent 4 hours trying to figure out how to compile 8812au for Rock64, and finally have it up and running in Dietpi!
Here’s my tutorial:

sudo apt-get install git
sudo apt-get install build-essential
sudo dpkg -i linux-headers-4.4.77-rockchip-ayufan-136_0.5.15_arm64.deb
mkdir header
dpkg -x linux-headers-4.4.77-rockchip-ayufan-136_0.5.15_arm64.deb header
cd header/usr/src
sudo mv linux-headers-4.4.77-rockchip-ayufan-136/ /usr/src/.

The following information is based on the personal blog I found on the net:

git clone GitHub - gnab/rtl8812au: Realtek 802.11n WLAN Adapter Linux driver
cd rtl8812au
Using your text editor, edit some entries in file called Makefile so that it can run without error on Rock64.

[Disable energy saving around line 40]

CONFIG_POWER_SAVING = y

CONFIG_POWER_SAVING = n


[Change platform setting around line 53]

CONFIG_PLATFORM_I386_PC = y

CONFIG_PLATFORM_I386_PC = n


[Add the following platform setting immediately under the above line]

CONFIG_PLATFORM_ARM_PC = y


[Add the following command around line 662]

ifeq ($(CONFIG_PLATFORM_ARM_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
SUBARCH := arm64
ARCH ?= arm64
CROSS_COMPILE ?=
KVER ?= $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build/
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
endif


[Remove “modules” part from the following command around line 1065]

$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules

$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd)

  1. Compile:

$ make

  1. Register the newly created driver:

$ sudo insmod 8812au.ko

Somehow, I am not able to make 8812au.ko loads in /etc/modules. My fix is to simply edit /etc/rc.local and add insmod /Path-to-driver/8812au.ki

My path to driver is in /lib/modules/4.4.77-rockchip-ayufan-136 since I moved 8812au.ko to this location.

I hope this helps someone.

By the way, since I have 8812au module compiled and confirmed working. Will dietpi include this driver in the future release, please? I do not want to recompile it again in the future.

I made some corrections, if you like, you can download my Makefile and skip those confusing modifications

sudo apt-get install git

sudo apt-get install build-essential

apt-get download linux-headers-4.4.77-rockchip-ayufan-136

mkdir header

dpkg -x linux-headers-4.4.77-rockchip-ayufan-136_0.5.15_arm64.deb header

cd header/usr/src

sudo mv linux-headers-4.4.77-rockchip-ayufan-136/ /usr/src/.

The following information is based on the personal blog I found on the net:

The page is in Japanese only, so I summarise the relevant parts here.

  1. Obtain the source code:

$ git clone GitHub - gnab/rtl8812au: Realtek 802.11n WLAN Adapter Linux driver

[This will create a directory called rtl8812au in your home directory.]

  1. Move to this newly created rtl8812au directory:

$ cd rtl8812au

  1. Using your text editor, edit some entries in file called Makefile so that it can run without error on Rock64.

[Disable energy saving around line 40]

CONFIG_POWER_SAVING = y

CONFIG_POWER_SAVING = n


[Change platform setting around line 53]

CONFIG_PLATFORM_I386_PC = y

CONFIG_PLATFORM_I386_PC = n

[Add the following platform setting immediately under the above line]

CONFIG_PLATFORM_ARM_PC = y


[Add the following command around line 662]

ifeq ($(CONFIG_PLATFORM_ARM_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
SUBARCH := arm64
ARCH ?= arm64
CROSS_COMPILE ?=
KVER ?= $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build/
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
endif


[Remove “modules” part from the following command around line 1065]

$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules

$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd)

  1. Compile:

$ make

  1. Register the newly created driver:

$ sudo insmod 8812au.ko


Somehow, I am not able to make 8812au.ko loads in /etc/modules. My fix is to simply edit /etc/rc.local and add insmod /Path-to-driver/8812au.ki

My path to driver is in /lib/modules/4.4.77-rockchip-ayufan-136/kernel/drivers/net/wireless since I moved 8812au.ko to this location.

I hope this helps someone.
Makefile.zip (5.06 KB)

Some screen shots after connected to my 5G router. It is fast!


There is a newer version of 8812au driver – 5.2.20, I think it is the newest. If you know there is a newer one, please let me know.

To compile and install it:

  1. If you have old rtl8812au installed, please remove it first. Leave no trace of it :slight_smile:
    sudo rmmod 8812au
    go to the path where 8812au.ko is installed
    sudo rm 8812au.ko
  2. Install build-essential from Dietpi-software(Looks like Dietpi-software is not able to install a complete build-essential, you need to install it with :sudo apt-get install build-essential)
  3. Install git from dietpi-software
  4. git clone https://github.com/gordboy/rtl8812au
  5. apt-get download linux-headers-4.4.77-rockchip-ayufan-136
  6. mkdir header
  7. dpkg -x linux-headers-4.4.77-rockchip-ayufan-136_0.5.15_arm64.deb header
  8. cd header/usr/src
  9. sudo mv linux-headers-4.4.77-rockchip-ayufan-136/ /usr/src/.
  10. cd
  11. cd rtl8812au
  12. ARCH=arm64 make
  13. sudo ARCH=arm64 make install
  14. Reboot and it should work now.