9

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.

toyota Supra
  • 560
  • 2
  • 6
  • 9
Stefan R.
  • 191
  • 1
  • 1
  • 7
  • The Pi4 has built in WiFi hardware. – Unsigned_Arduino May 27 '20 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 '20 at 17:46
  • In my case, I got a "target not found" for arch/arm/kernel/ on my Manjaro ARM version. I set ARCH=arm64 in the Makefile to solve the issue. Remember to update the Makefile in /usr/src/rtl88x2bu-${VER} with rsync. – RobotMan Dec 07 '20 at 20:12

2 Answers2

10

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 apt-get install raspberrypi-kernel-headers
sudo make
sudo make install
sudo reboot

After reboot I did iwconfig and now I see two 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
Greenonline
  • 2,740
  • 4
  • 23
  • 36
Stefan R.
  • 191
  • 1
  • 1
  • 7
  • Even though EntropicEffect/rtl8822bu is no longer maintained, these instructions worked like a charm! 3x better WiFi speeds with TP-Link T4U v3 compared to built-in RPi4 WiFi. – Leonid Makarov Jan 25 '21 at 03:59
  • Didn't work for me on RPi CM4 using 64-bit OS until I ran as ARCH=arm64 make && make install – jacobq Apr 30 '21 at 17:19
  • The EntropicEffect/rtl8822bu no longer complies in the September 2022 release of the Pi OS. Try https://github.com/drygdryg/rtl8188eus.git – Megan Spencer Feb 01 '23 at 10:00
  • on Raspberry Pi 4b using bookworm I get this error: fatal error: net/ipx.h: No such file or directory – A.W. Jan 01 '24 at 18:44
2
sudo apt-get install dkms
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 dkms build -m rtl88x2bu -v ${VER}
sudo dkms install -m rtl88x2bu -v ${VER}
sudo modprobe 88x2bu 

Remember to reboot.
Source: AC1300 TP-link adapter doesn't work

My speed: 140 Mb/s U:78Mb/s at this AC1300 Wi-Fi

My speed at cable Cu, classic wired UTP connector> D:288mb/s U: 165Mb/s

Country: Romania

SSD 512 WD, +12 GB RAM DDR3, microprocesor old: 2x3000 MHz

goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • I was able to install rtl88x2bu driver on a Raspberry Pi 1B and It's working! It wouldn't compile because only 256MB RAM but after changing my swap to 2G I was able to compile (it took 2h aprox). Thank you! – Marco Afonso Feb 07 '22 at 22:38
  • 2
    These instructions are out of date. I followed the instructions here and it worked: https://github.com/cilynx/rtl88x2bu – Megan Spencer Feb 01 '23 at 11:24
  • 1
    The links to the images are dead. This is why the images should be uploaded to the stack exchange server and not be links to external sites. – Greenonline Feb 02 '23 at 06:56