Adding rtl8812au driver support

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding rtl8812au driver support

5,634 Views
saseendranathvs
Contributor I

Hi,

Is it possible to add an extra driver support to linux kernel using bitbake?

Is there any patch for this? If not, how could I add the support for a particular driver module?

I want to add the driver support for rtl8812au  in my kernel. I have to add the source files, then I have to enable it in config, and all. I tried to manually cross compile the module by setting the cross compile path and kernel source directory. But it failed.

I got the source code for driver from :  https://github.com/abperiasamy/rtl8812AU_8821AU_linux/archive/master.zip

I changed the Makefile like this ;

CONFIG_PLATFORM_ARM_RPI = y

ifeq ($(CONFIG_PLATFORM_ARM_RPI), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
ARCH ?= arm
CROSS_COMPILE ?=
KVER ?= $(shell uname -r)
KSRC := /media/IMXwayland/bin/fsl-release-bsp/build/tmp/work-shared/imx6qsabreauto/kernel-source #/lib/modules/$(KVER)/build
MODDESTDIR := /media/IMXwayland/bin/fsl-release-bsp/build/tmp/work-shared/imx6qsabreauto/kernel-source/drivers/net/wireless/#/lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
endif

But I got error like this :

make


make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- -C /media/IMXwayland/bin/fsl-release-bsp/build/tmp/work-shared/imx6qsabreauto/kernel-source M=/home/saseendranath.sasi/Downloads/ArcherT4U/Archer_T4U_V1_150821/rtl8812AU_8821AU_linux-master modules
make[1]: Entering directory 'IMXwayland/bin/fsl-release-bsp/build/tmp/work-shared/imx6qsabreauto/kernel-source'

ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.

CC [M] /home/Downloads/ArcherT4U/Archer_T4U_V1_150821/rtl8812AU_8821AU_linux-master/core/rtw_cmd.o
cc1: fatal error: ./include/linux/kconfig.h: No such file or directory
compilation terminated.
scripts/Makefile.build:258: recipe for target '/home/Downloads/ArcherT4U/Archer_T4U_V1_150821/rtl8812AU_8821AU_linux-master/core/rtw_cmd.o' failed
make[2]: *** [/home/saseendranath.sasi/Downloads/ArcherT4U/Archer_T4U_V1_150821/rtl8812AU_8821AU_linux-master/core/rtw_cmd.o] Error 1
Makefile:1384: recipe for target '_module_/home/Downloads/ArcherT4U/Archer_T4U_V1_150821/rtl8812AU_8821AU_linux-master' failed
make[1]: *** [_module_/home/Downloads/ArcherT4U/Archer_T4U_V1_150821/rtl8812AU_8821AU_linux-master] Error 2
make[1]: Leaving directory '/media/IMXwayland/bin/fsl-release-bsp/build/tmp/work-shared/imx6qsabreauto/kernel-source'
Makefile:1584: recipe for target 'modules' failed
make: *** [modules] Error 2

Is this the proper way to add the driver support ? Kindly guide me.

Labels (3)
0 Kudos
Reply
2 Replies

3,360 Views
schorschi
Contributor I

The following worked for me, adding rtl8812au driver to Raspberry Pi Debian 9 (Stretch).  However, this is limited to kernel 4.9.59-v7+, given the repository for kernel 4.9.72-v7+ has yet to be updated.

First... validate that your device is on the USB bus...

// Wireless USB Adapter Driver Compile And Install...
// https://linuxforums.org.uk/index.php?topic=13232.0

# lsusb | grep 0bda
Bus 001 Device 005: ID 0bda:a811 Realtek Semiconductor Corp.

# usb-devices | awk '/a811/' RS=
T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  5 Spd=480 MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0bda ProdID=a811 Rev=02.00
S:  Manufacturer=Realtek
S:  Product=802.11ac WLAN Adapter
S:  SerialNumber=00e04c000001
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 6 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)

# modprobe -c | grep -i "0bda.*ab11"
< No Result >

# apt-get install apt-file
# apt-file update
# apt-file find lshw
# apt-get install lshw

# lshw -C network
< No Result For USB Device > This is expected since no driver present.

Second... Grab the available Raspberry Pi Kernel Headers...

# apt-get install dkms git
# apt-get install raspberrypi-kernel-headers

Third... Grab the source for the driver...

# mkdir ~/RTL8812AU
# cd ~/RTL8812AU
# git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git

Fourth... Enable configuration for Pi, disable for i386/x86_64...

# cd ~/RTL8812AU/rtl8812AU_8821AU_linux

# nano Makefile
 CONFIG_PLATFORM_ARM_RPI = y
 CONFIG_PLATFORM_I386_PC = n

# nano Makefile.dkms
 CONFIG_PLATFORM_ARM_RPI = y
 CONFIG_PLATFORM_I386_PC = n

// Only Kernel 4.9.59-v7+?
# make -f Makefile.dkms install

// Test Driver...  Assumption is USB adapter device is wlan0 interface...
# modprobe rtl8812au

# ifconfig
# iwlist wlan0 scanning
< List Wifi Networks >  Expected output is list of available wifi networks.

// May have to bounce the interface

# ip link set wlan0 down
# ip link set wlan0 up

If the wrong or (too) new kernel is installed...  Typical error...

# make -f Makefile.dkms install
make clean
make[1]: Entering directory '/root/RTL8812AU/rtl8812AU_8821AU_linux'
make ARCH=arm CROSS_COMPILE= -C /lib/modules/4.9.73-v7+/build M=/root/RTL8812AU/rtl8812AU_8821AU_linux clean
make[2]: Entering directory '/root/RTL8812AU/rtl8812AU_8821AU_linux'
make[2]: *** /lib/modules/4.9.73-v7+/build: No such file or directory.  Stop.
make[2]: Leaving directory '/root/RTL8812AU/rtl8812AU_8821AU_linux'
Makefile:1605: recipe for target 'clean' failed
make[1]: *** [clean] Error 2
make[1]: Leaving directory '/root/RTL8812AU/rtl8812AU_8821AU_linux'
Makefile.dkms:11: recipe for target 'src_install' failed
make: *** [src_install] Error 2

Notice the build directory is missing for the given kernel version.

0 Kudos
Reply

3,360 Views
igorpadykov
NXP Employee
NXP Employee

Hi Saseendranath

please look at

i.MX Yocto Project: How can I (quickly) modify the kernel and test it? 

Task #10 - How to create a custom layer 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply