Issues installing RTL8812BU WiFi driver on Raspberry Pi 4 B

Recently, I bought a USB3 WiFi adapter with the RTL8812BU chip (Supports Linux).
I have spent 5 hours so far trying to install the Linux driver for the chip on my Raspberry Pi 4.
Apparently, I am not able to do this on my own so I hope that you guys can help me.

Here is what I have done so far:

Install build tools:

sudo apt install build-essential bc git wget libssl-dev bison flex dkms

Get kernel source code

cd /usr/src
sudo git clone --depth 1
sudo ln -s linux $(uname -r)
sudo ln -s /usr/src/linux /lib/modules/$(uname -r)/build

Prepare linux build headers

cd linux
sudo wget -O Module.symvers
sudo make bcm2711_defconfig
sudo make prepare
sudo make modules_prepare

Install Driver

sudo git clone
cd rtl88x2bu
VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf)
sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER}
sudo dkms add -m rtl88x2bu -v ${VER}
sudo nano Makefile

Change 2 lines to this:

sudo ARCH=arm dkms build -m rtl88x2bu -v ${VER}                             
sudo dkms install -m rtl88x2bu -v ${VER}
sudo modprobe 88x2bu

The problem
When I run the last command sudo modprobe 88x2bu I get this error message:

modprobe: ERROR: could not insert '88x2bu': Exec format error

So I guess that the Makefile setting CONFIG_PLATFORM_ARM_RPI is not compatible with Raspberry Pi 4 but only earlier models.

Can I modify the Makefile and add a new platform type that allows the driver to be built for Raspberry Pi 4? Or how do I approach this issue?

I have seen other RealTek drivers that supports Raspberry Pi 4 through a variable in the Makefile named CONFIG_PLATFORM_ARM64_RPI. I am a programmer myself (not a linux programmer though) but I simply don't know what I want the Makefile code to do when CONFIG_PLATFORM_ARM64_RPI is set to y.

Example of a RealTek driver that supports Raspberry Pi 4 (These does not work with my wifi adaptor however so just fyi):

Official driver attempt
I also have the official drivers available to me from this link:

But in the ./driver folder after unpacking the tar file, I look in the Makefile and here i dont find any RPI options under CONFIGURATION_PLATFORM_*

I tried to add a new line

and ran the script but it fails (of course because the Makefile does not handle the new CONFIG_PLATFORM_ARM64_RPI line).

and dmesg shows this error message:
[ 542.113848] 88x2bu: disagrees about version of symbol module_layout

More information
Here is some more information about my setup.

Result of uname -smr:
Linux 4.19.115-v7l+ armv7l

I hope that you can help me with tips on how to proceed with this issue!
Hopefully the answer will also help other people in the future.

EDIT 2020-05-31:
I have also tried to use

sudo make modules

to build Module.symvers instead of getting it with wget.
That did not help.

And I tried to upgrade my kernel to 5.4.42-v7l+ with

sudo rpi-update
sudo wget -O /usr/local/bin/rpi-source && sudo chmod +x /usr/local/bin/rpi-source && /usr/local/bin/rpi-source -q --tag-update
sudo rpi-source

However, after upgrading it fails in an earlier step so I have rolled back the upgrade.

Answers 2

Related Questions