Skip to content

Commit

Permalink
Add support for rtl8821cu WiFi Dongle (#1899)
Browse files Browse the repository at this point in the history
* Add rtl8821cu driver

* buildroot ee56159464...666868435d (1):
  > Merge pull request #2 from s-ol/fix-usb_modeswitch-systemd

* Add rtl8821cu support to all boards

Signed-off-by: s-ol <[email protected]>
Co-authored-by: Stefan Agner <[email protected]>
  • Loading branch information
s-ol and agners authored May 16, 2022
1 parent a1261f8 commit e7e7c7a
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion buildroot
1 change: 1 addition & 0 deletions buildroot-external/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ source "$BR2_EXTERNAL_HASSOS_PATH/package/qemu-guest-agent/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/rpi-eeprom/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/rpi-rf-mod/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/rtl88x2bu/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/rtl8821cu/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/tempio/Config.in.host"
source "$BR2_EXTERNAL_HASSOS_PATH/package/udisks2/Config.in"
source "$BR2_EXTERNAL_HASSOS_PATH/package/xe-guest-utilities/Config.in"
1 change: 1 addition & 0 deletions buildroot-external/configs/generic_aarch64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,6 @@ BR2_PACKAGE_HASSIO_ARCH="aarch64"
BR2_PACKAGE_HASSIO_MACHINE="qemuarm-64"
BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/generic_x86_64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,6 @@ BR2_PACKAGE_HASSIO_MACHINE="generic-x86-64"
BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/khadas_vim3_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,6 @@ BR2_PACKAGE_HASSIO_MACHINE="odroid-n2"
BR2_PACKAGE_KHADAS_BOOT=y
BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/odroid_c2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,6 @@ BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RPI_RF_MOD_DTS=y
BR2_PACKAGE_RPI_RF_MOD_DTS_ODROID-C2=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/odroid_c4_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@ BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RPI_RF_MOD_DTS=y
BR2_PACKAGE_RPI_RF_MOD_DTS_ODROID-C4=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/odroid_n2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,6 @@ BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RPI_RF_MOD_DTS=y
BR2_PACKAGE_RPI_RF_MOD_DTS_ODROID-N2=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/odroid_xu4_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,6 @@ BR2_PACKAGE_HASSIO_MACHINE="odroid-xu"
BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/ova_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ BR2_PACKAGE_OS_AGENT=y
BR2_PACKAGE_QEMU_GUEST_AGENT=y
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
BR2_PACKAGE_XE_GUEST_UTILITIES=y
1 change: 1 addition & 0 deletions buildroot-external/configs/rpi3_64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,6 @@ BR2_PACKAGE_PI_BLUETOOTH=y
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RPI_RF_MOD_DTS=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/rpi3_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@ BR2_PACKAGE_PI_BLUETOOTH=y
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RPI_RF_MOD_DTS=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/rpi4_64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,6 @@ BR2_PACKAGE_PI_BLUETOOTH=y
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RPI_RF_MOD_DTS=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
1 change: 1 addition & 0 deletions buildroot-external/configs/rpi4_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,6 @@ BR2_PACKAGE_PI_BLUETOOTH=y
BR2_PACKAGE_RPI_RF_MOD=y
BR2_PACKAGE_RPI_RF_MOD_DTS=y
BR2_PACKAGE_RTL88X2BU=y
BR2_PACKAGE_RTL8821CU=y
BR2_PACKAGE_HOST_TEMPIO=y
BR2_PACKAGE_UDISKS2=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Makefile: expose platform variables

Signed-off-by: s-ol <[email protected]>

diff --git a/Makefile b/Makefile
index 22bd0e0..72321a4 100755
--- a/Makefile
+++ b/Makefile
@@ -96,9 +96,9 @@
###################### MP HW TX MODE FOR VHT #######################
CONFIG_MP_VHT_HW_TX_MODE = n
###################### Platform Related #######################
-CONFIG_PLATFORM_I386_PC = y
-CONFIG_PLATFORM_ARM_RPI = n
-CONFIG_PLATFORM_ARM64_RPI = n
+CONFIG_PLATFORM_I386_PC ?= n
+CONFIG_PLATFORM_ARM_RPI ?= n
+CONFIG_PLATFORM_ARM64_RPI ?= n
CONFIG_PLATFORM_ANDROID_X86 = n
CONFIG_PLATFORM_ANDROID_INTEL_X86 = n
CONFIG_PLATFORM_JB_X86 = n
5 changes: 5 additions & 0 deletions buildroot-external/package/rtl8821cu/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
config BR2_PACKAGE_RTL8821CU
tristate "Realtek 8821cu USB WiFi"
depends on BR2_LINUX_KERNEL
---help---
Driver for RTL8821CU USB WiFi adapters (no firmware needed).
20 changes: 20 additions & 0 deletions buildroot-external/package/rtl8821cu/rtl8821cu.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
RTL8821CU_VERSION = 8c2226a74ae718439d56248bd2e44ccf717086d5
RTL8821CU_SITE = $(call github,brektrou,rtl8821CU,$(RTL8821CU_VERSION))
RTL8821CU_LICENSE = GPL-2.0
RTL8821CU_LICENSE_FILES = LICENSE

RTL8821CU_MODULE_MAKE_OPTS = \
CONFIG_RTL8821CU=m \
KVER=$(LINUX_VERSION_PROBED) \
KBASE=$(LINUX_DIR) \
CROSS_COMPILE=$(TARGET_CROSS)

ifeq (arm, $(filter arm, $(KERNEL_ARCH)))
RTL8821CU_MODULE_MAKE_OPTS += CONFIG_PLATFORM_ARM_RPI=y
RTL8821CU_MODULE_MAKE_OPTS += CONFIG_PLATFORM_ARM64_RPI=y
else
RTL8821CU_MODULE_MAKE_OPTS += CONFIG_PLATFORM_I386_PC=y
endif

$(eval $(kernel-module))
$(eval $(generic-package))

0 comments on commit e7e7c7a

Please sign in to comment.