19
Dez
2021

Install driver for RTL8812BU wifi dongle on a Raspberry Pi

install the RTL88x2BU driver…

Install dependencies
First step is to install all required dependencies for the build. Keep also in mind, that the driver is build for the current installed kernel version. So performing an sudo apt update && sudo apt upgrade beforehand maybe useful. ????


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


Download kernel source files
To compile the driver we need the source code of the currently running kernel. Luckily the rpi-source tool takes care of that.

# Create build folder


# Download rpi-source tool

sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update

# Download kernel source (around ~150MB to download)

rpi-source
Install driver
cd ~/rtl8812bu-build/

git clone https://github.com/cilynx/rtl88x2bu.git


Modify driver Makefile
To make the driver compile on a Raspberry Pi, some small adjustments to the Makefile are required. This two sed commands will do the job.


sed -i '/CONFIG_PLATFORM_I386_PC = y/c\CONFIG_PLATFORM_I386_PC = n' Makefile


sed -i '/CONFIG_PLATFORM_ARM_RPI = n/c\CONFIG_PLATFORM_ARM_RPI = y' Makefile


Compile driver
Now the fun begins ???? The following commands will compile and install the driver as Dynamic Kernel Module (DKMS). When everything works out the modprobe command will then load the compiled driver itself.

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}


Check if driver works
After the driver is loaded it can be check with sudo iwconfig if the wifi device is correctly loaded and ready to use. On my Raspberry Pi 3 (which have an onboard wifi card) the new device is added as wlan1. Now this can be used as any other wifi device.

pi@raspberrypi:~ $ sudo iwconfig
wlan1 IEEE 802.11AC ESSID:off/any Nickname:“<WIFI@REALTEK>“
Mode:Managed Access Point: Not-Associated
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on

eth0 no wireless extensions.

lo no wireless extensions.

wlan0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on

gefunden auf: https://www.manuel-bauer.net/blog/install-driver-for-rtl8812bu-wifi-dongle-on-a-raspberry-pi

Share

You may also like...

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert