This is a cache of https://discuss.96boards.org/t/db410c-kernel-with-rtl8192cu-rtl8188cu-driver/803. It is a snapshot of the page at 2024-11-01T04:08:25.504+0000.
DB410c kernel with RTL8192CU / RTL8188CU driver - DragonBoard410c - 96Boards Forum

DB410c kernel with RTL8192CU / RTL8188CU driver

=Tutorial=

Hey Guy´s,

as we already discussed in the thread “USB WiFi for Debian Jessie on 410c” it is possible to get RTL8192CU / RTL8188CU based wifi dongles working by using the in-tree drivers called “rtlwifi”. However in my case I wanted to use the original out-of-tree drivers for this chipset provided by realtek. The advantage of this driver is less power consumption and several issues when you want to use it in access point mode.
Since I got the out-of-tree driver compiled into the DB410c kernel and got it running on it, I´d like to post a little tutorial how to do that. Maybe this is a good cheat sheet for me also when I need to get it compiled again :wink:

I tried the tutorial with a fresh DB410c with latest sdcard_install_debian-110. I also did a fresh kernel checkout. My DB410c kernel source is usually stored in:

david@PC-ubuntu:~/SnapDragon-Toolchain/Kernel/linux-arrow/

[Get Sources for RTL8192CU driver]
I used to download the 0001-RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip from realtek.com direktly. It is also necessary to modify some files in cause of newer debian releases. In the following steps I will show which files you need to modify.

I usually have a “Temp” folder to download my files and modify them. If the link of the driver download is dead, use the search function on realtek hompage.

cd ~/Temp

wget http://12244.wpc.azureedge.net/8012244/drivers/rtdrivers/cn/wlan/0001-RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip

unzip 0001-RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip
cd RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911/driver/
tar -xzf rtl8188C_8192C_usb_linux_v4.0.2_9000.20130911.tar.gz
cd rtl8188C_8192C_usb_linux_v4.0.2_9000.20130911/

Next thing you gonna do is to modify four out-of-tree driver files to prevent compiler errors. I created some patch files to show what modifications are needed.

[Kconfig]

--- orginal/Kconfig     2013-09-11 05:56:55.000000000 +0200
+++ patched/Kconfig     2016-07-20 15:01:32.347354999 +0200
@@ -1,6 +1,9 @@
 config RTL8192CU
        tristate "Realtek 8192C USB WiFi"
-       depends on USB
+       depends on MAC80211 && USB
+       select CFG80211_WEXT
+       select WIRELESS_EXT
+       select WEXT_PRIV
        ---help---
-         Help message of RTL8192CU
+         This option adds the Realtek RTL8192CU USB device such as Edimax EW-7811Un

[include/autoconf.h]

--- orginal/include/autoconf.h  2013-09-11 05:56:55.000000000 +0200
+++ patched/include/autoconf.h  2016-06-30 08:30:16.696143000 +0200
@@ -296,9 +296,9 @@
 //#define CONFIG_DEBUG_RTL871X
 
 #define DBG    0
-#define CONFIG_DEBUG_RTL819X
+//#define CONFIG_DEBUG_RTL819X
 
-#define CONFIG_PROC_DEBUG      1
+//#define CONFIG_PROC_DEBUG    1
 
 //#define DBG_IO
 //#define DBG_DELAY_OS
@@ -324,7 +324,7 @@
 
 //#define DBG_MEMORY_LEAK      1
 
-#define DBG_CONFIG_ERROR_DETECT
+//#define DBG_CONFIG_ERROR_DETECT
 //#define DBG_CONFIG_ERROR_RESET
 
 //TX use 1 urb

[os_dep/linux/rtw_android.c]
here you need to change “strnicmp” to “strncasecmp”

--- orginal/os_dep/linux/rtw_android.c  2013-09-11 05:56:55.000000000 +0200
+++ patched/os_dep/linux/rtw_android.c  2016-06-30 08:30:30.871227000 +0200
@@ -230,7 +230,7 @@
 {
        int cmd_num;
        for(cmd_num=0 ; cmd_num<ANDROID_WIFI_CMD_MAX; cmd_num++)
-               if(0 == strnicmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) )
+               if(0 == strncasecmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) )
                        break;

        return cmd_num;

[core/rtw_br_ext.c]

--- orginal/core/rtw_br_ext.c   2013-09-11 05:56:55.000000000 +0200
+++ patched/core/rtw_br_ext.c   2016-07-01 08:20:36.552906999 +0200
@@ -28,6 +28,8 @@
 #include <linux/if_pppox.h>
 #endif
 
+#include <net/ip6_checksum.h>
+
 #if 1  // rtw_wifi_driver
 #include <drv_conf.h>
 #include <drv_types.h>

[Copy the driver into the kernel tree]
Next thing you gonna do is to copy the modified sources into the kernel source.

mkdir ~/SnapDragon-Toolchain/Kernel/linux-arrow/drivers/net/wireless/realtek/rtl8192cu
cp -a ./* ~/SnapDragon-Toolchain/Kernel/linux-arrow/drivers/net/wireless/realtek/rtl8192cu

[Modify Makefile and Kconfig in kernel tree]
That your new rtl8192cu driver will get compiled in your new kernel build you need to modify
the Kconfig / Makefile. It will also disable the in-tree driver called “rtlwifi”.

cd ~/SnapDragon-Toolchain/Kernel/linux-arrow/

[drivers/net/wireless/Kconfig]

--- orginal/drivers/net/wireless/Kconfig        2016-07-04 12:16:50.841121000 +0200
+++ patched/drivers/net/wireless/Kconfig        2016-07-20 15:00:03.915160999 +0200
@@ -278,7 +278,8 @@
 source "drivers/net/wireless/p54/Kconfig"
 source "drivers/net/wireless/rt2x00/Kconfig"
 source "drivers/net/wireless/mediatek/Kconfig"
-source "drivers/net/wireless/realtek/rtlwifi/Kconfig"
+#source "drivers/net/wireless/realtek/rtlwifi/Kconfig"
+source "drivers/net/wireless/realtek/rtl8192cu/Kconfig"
 source "drivers/net/wireless/realtek/rtl8xxxu/Kconfig"
 source "drivers/net/wireless/ti/Kconfig"
 source "drivers/net/wireless/zd1211rw/Kconfig"

[drivers/net/wireless/realtek/Makefile]

--- orginal/drivers/net/wireless/realtek/Makefile       2016-07-04 12:16:51.765583000 +0200
+++ patched/drivers/net/wireless/realtek/Makefile       2016-07-20 15:00:38.108249000 +0200
@@ -4,6 +4,7 @@
 
 obj-$(CONFIG_RTL8180)          += rtl818x/
 obj-$(CONFIG_RTL8187)          += rtl818x/
-obj-$(CONFIG_RTLWIFI)          += rtlwifi/
+#obj-$(CONFIG_RTLWIFI)         += rtlwifi/
+obj-$(CONFIG_RTL8192CU)        += rtl8192cu/
 obj-$(CONFIG_RTL8XXXU)         += rtl8xxxu/

[Enable RTL8192CU USB driver]
When I´m doing kernel modifications, I like to use nconfig. So in the next step you mark your out-off-tree driver as an module [M].

cd ~/SnapDragon-Toolchain/Kernel/linux-arrow/
export ARCH=arm64

export CROSS_COMPILE=/home/david/SnapDragon-Toolchain/CrossCompiler/gcc-linaro-aarch64-linux-gnu-4.8-2014.04_linux/bin/aarch64-linux-gnu-

make nconfig

Here you will find it:

Symbol: RTL8192CU [=m]
Type  : tristate
Prompt: Realtek 8192C USB WiFi
Location:
-> Device Drivers
  -> Network device support (NETDEVICES [=y])
    -> Wireless LAN (WLAN [=y])

Do not forget to save your new configuration (.config) !

[Build your kernel with the new driver]
Nearly the last step is to compile the kernel.

cd ~/SnapDragon-Toolchain/Kernel/linux-arrow/
export ARCH=arm64

export CROSS_COMPILE=/home/david/SnapDragon-Toolchain/CrossCompiler/gcc-linaro-aarch64-linux-gnu-4.8-2014.04_linux/bin/aarch64-linux-gnu-

git clone git://codeaurora.org/quic/kernel/skales

wget http://builds.96boards.org/releases/dragonboard410c/linaro/debian/16.06/initrd.img-4.4.9-linaro-lt-qcom

make -j4 Image dtbs KERNELRELEASE=4.4.9-linaro-lt-qcom
make -j4 modules KERNELRELEASE=4.4.9-linaro-lt-qcom
./skales/dtbTool -o dt.img -s 2048 arch/arm64/boot/dts/qcom/
./skales/mkbootimg --kernel arch/arm64/boot/Image \
                   --ramdisk initrd.img-4.4.9-linaro-lt-qcom \
                   --output boot-db410c.img \
                   --dt dt.img \
                   --pagesize 2048 \
                   --base 0x80000000 \
                   --cmdline "root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8"
make bindeb-pkg KERNELRELEASE=4.4.9-linaro-lt-qcom

[Copy your modules to DB410c and install them]
The bindeb-pkg created some …/*.deb files. You need to Copy them to your DB410c and install them. I also made a “Temp” folder on DB410c to store those files.

scp …/*.deb linaro@linaro-alip:~/Temp

SSH into the DB410c and install the modules / headers …

ssh linaro@linaro-alip

linaro@linaro-alip:~$ sudo dpkg -i ~/Temp/*.deb

[Flash the Dragonboard with the new boot image]
Very last step is to flash the DB410c with your new kernel and reboot. Then your rtl8192cu (e.g. Edimax) wifi dongle should work with the orginal out-of-tree driver from realtek. This will also give you the possibility to use your dongle in AP mode.

sudo fastboot flash boot boot-db410c.img

Hi @gc,

Thank you for the extremely detailed tutorial of step by step procedure to install out of tree driver for RTL8192CU / RTL8188CU provided by RealTek which has less power consumption.

Great!
:slight_smile: