4

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 https://github.com/raspberrypi/linux.git
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 https://raw.githubusercontent.com/raspberrypi/firmware/master/extra/Module7l.symvers
KERNEL=kernel7l
sudo make bcm2711_defconfig
sudo make prepare
sudo make modules_prepare

Install Driver

sudo git clone https://github.com/cilynx/rtl88x2bu.git
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:
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM_RPI = y

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):
https://github.com/aircrack-ng/rtl8812au

Official driver attempt
I also have the official drivers available to me from this link:
https://archive.org/details/realtekdrivers_rtl8811_rtl8812

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
CONFIG_PLATFORM_ARM64_RPI = y

and ran the install.sh 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 https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -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.

  • The Pi4 has built in WiFi hardware. – Unsigned_Arduino May 27 at 16:30
  • Yes, it does. But I have some issues with that. First, I am using an aluminium case which lowers the internal WiFi signal. Second I am using USB3 devices and USB3 and the internal 2.4Ghz WiFi interferes with each other so the internal WiFi does not work when a USB3 device is plugged in. So I bought a more powerful USB3 WiFi adapter to overcome those challenges. I just need to make it work on Pi4 :-) And before you suggest that I use 5Ghz WiFi, I just want to mention that it is not an option either. Range is way too short on that for my needs. – Stefan R. May 27 at 17:46
5

Finally I had a breakthrough!

Instead of using modprobe and dkms it was enough to follow these steps:

sudo git clone https://github.com/EntropicEffect/rtl8822bu.git 
cd rtl8822bu
sudo nano Makefile

Update lines 100 and 101 to this and save the file:
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM_RPI = y

sudo make
sudo make install
sudo reboot

After reboot i did iwconfig and now I see 2 Wireless USB adapters.
And a quick speed test with speedtest-cli makes me very happy:

Ping: 7.414 ms
Download: 133.61 Mbit/s
Upload: 153.04 Mbit/s
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.