How to build RTL8192CU/RTL8188CU drivers for MangOH?

Hi All,

I bought a Wi-Fi USB dongle, EDIMAX EW-7811Un, which chip is rtl8188cu and the driver is compatible with rtl8192cu. I found there is rtl8192cu driver in Legato-Dist-Source-mdm9x15-SWI9X15Y_07.11.09.00.

I create rtl8192cu.cfg in meta-swi/meta-swi-mdm9x15/recipes-kernel/linux/files/ as the following
CONFIG_AVERAGE=y

Generic 802.11 Support:

CONFIG_CFG80211=m
CONFIG_CFG80211_DEFAULT_PS=y
CONFIG_MAC80211=m
CONFIG_MAC80211_HAS_RC=y
CONFIG_MAC80211_RC_MINSTREL=y
CONFIG_MAC80211_RC_MINSTREL_HT=y
CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"
CONFIG_CFG80211_WEXT=y

USB 802.11 Devices:

CONFIG_RTL8192CE=m
CONFIG_RTL8192CU=m
CONFIG_RTLWIFI=m
CONFIG_RTLWIFI_DEBUG=y
CONFIG_RTL8192C_COMMON=m

Rfkill support (used by wireless/bluetooth devices)

CONFIG_RFKILL=m
CONFIG_RFKILL_LEDS=y

Add cpu temperature support (Not related to 802.11, but a nice thing to have)

CONFIG_SENSORS_CORETEMP=m

Edit meta-swi/meta-swi-mdm9x15/recipes-kernel/linux/linux-yocto_3.14.bbappend
SRC_URI += “file://rtl8192cu.cfg”

After make yocto, I got rtlwifi.ko, rtl_usb.ko, rtl8192cu.ko, and rtl8192c-common.ko, but without RTL8192CE.ko, why?

When I modpobe rtl8192cu, I got the error message.
modprobe: can’t load module rtl_usb (kernel/drivers/net/wireless/rtlwifi/rtl_usb.ko): unknown symbol in module, or unknown parameter

dmesg log is
[ 19.357942] mbim_read: Requests list is empty. Wait.
[ 129.082923] Loading modules backported from Linux version R8.5
[ 129.095070] Backport generated by backports.git R8.5
[ 129.235373] cfg80211: Calling CRDA to update world regulatory domain
[ 129.485121] rtlwifi: Unable to register rtl_rc, use default RC !!
[ 129.491622] rtl_usb: Unknown symbol ieee80211_rx (err 0)

Can I modify the configuration file in arch/arm/configs/ ?
If so, which configuration do I need to modify?

Thank you very much!

Hi,

Could you help clarify these information:

    1. Is there driver module rtl8192ce.ko file available in your building system?
    1. Is there driver module rtl8192ce.ko file available in mangOH system after reflashing new yocto image?

Hi vzhu

I think that I need to enable PCI to build rtl8192ce.ko in recipe-kernal/files. Anyway, rtl8192ce.ko is not my purpose.
[ 129.491622] rtl_usb: Unknown symbol ieee80211_rx (err 0)
I think that is this in kernal/driver/staging/rtl8192u?
Do I need to build rtl8192u?

Hi,

How about upload your kernel .config file. Then I will try to build and see the reason.

Thanks,

Hi vzhu,

Thanks for your reply!
I uploaded to http://www.megafileupload.com/kt0o/1.config
please rename 1.config to .config.

I am trying to add RTL8192CU driver, but it still shows modprobe: can’t load module rtl_usb
(kernel/drivers/net/wireless/rtlwifi/rtl_usb.ko): unknown symbol in
module, or unknown parameter

:frowning:

Thanks. Will try that and update you.

Hi,

I reproduced the problem.

So with below steps, the issue seems fixed. The staging driver seems necessary in order to get rtl8192cu interface registered(installed) successfully for current Yocto kernel.

Driver Modules Install Sequence:
insmod cfg80211.ko
insmod mac80211.ko
insmod r8192u_usb.ko
insmod rtlwifi.ko
insmod rtl8192c-common.ko
insmod rtl_usb.ko
insmod rtl8192cu.ko

root@swi-mdm9x15:/lib/modules/3.14.29ltsi-a00e464379_4e6e61179d/kernel/drivers/net/wireless/rtlwifi/rtl8192cu#
lsmod
Tainted: G
rtl8192cu 87983 0 - Live 0xbf270000
rtl_usb 12103 1 rtl8192cu, Live 0xbf269000
rtl8192c_common 52674 1 rtl8192cu, Live 0xbf256000
rtlwifi 71898 2 rtl8192cu,rtl_usb, Live 0xbf23d000
r8192u_usb 264540 0 - Live 0xbf1ea000 ©
mac80211 414297 3 rtl8192cu,rtl_usb,rtlwifi, Live 0xbf161000
cfg80211 410711 2 rtlwifi,mac80211, Live 0xbf0d2000
ipv6 289076 14 [permanent], Live 0xbf076000
msm_sdcc 62098 0 - Live 0xbf060000
usb_storage 41277 0 - Live 0xbf04c000
sd_mod 29511 0 - Live 0xbf03f000
scsi_mod 132603 2 usb_storage,sd_mod, Live 0xbf00d000
unix 29168 873 - Live 0xbf000000

dmesg:
[ 32.341156] IPv6: ADDRCONF(NETDEV_CHANGE):usb0: link becomes ready
[ 85.411506] cfg80211: Calling CRDA to updateworld regulatory domain
[ 148.764748] r8192u_usb: module is from the stagingdirectory, the quality is unknown, you have been warned.
[ 148.784648] ieee80211_crypt: registered algorithm’NULL’
[ 148.784678] ieee80211_crypt: registered algorithm’TKIP’
[ 148.784709] ieee80211_crypt: registered algorithm’CCMP’
[ 148.784709] ieee80211_crypt: registered algorithm’WEP’
[ 148.784709]
[ 148.784709] Linux kernel driver for RTL8192 basedWLAN cards
[ 148.800701] Copyright © 2007-2008, Realsil Wlan
[ 148.811628] usbcore: registered new interface driver rtl819xU
[ 222.851243] usbcore: registered new interface driver rtl8192cu

1 Like

root@swi-mdm9x15:/lib/modules/3.14.29ltsi-a00e464379_4e6e61179d/kernel# ls drivers/staging/rtl8192u/
r8192u_usb.ko
root@swi-mdm9x15:/lib/modules/3.14.29ltsi-a00e464379_4e6e61179d/kernel# ls drivers/net/wireless/rtlwifi/
rtl8192c rtl8192cu rtl_usb.ko rtlwifi.ko
root@swi-mdm9x15:/lib/modules/3.14.29ltsi-a00e464379_4e6e61179d/kernel# ls drivers/net/wireless/rtlwifi/rtl8192c
rtl8192c-common.ko
root@swi-mdm9x15:/lib/modules/3.14.29ltsi-a00e464379_4e6e61179d/kernel# ls drivers/net/wireless/rtlwifi/rtl8192cu
rtl8192cu.ko
root@swi-mdm9x15:/lib/modules/3.14.29ltsi-a00e464379_4e6e61179d/kernel# ls net/mac80211/
mac80211.ko
root@swi-mdm9x15:/lib/modules/3.14.29ltsi-a00e464379_4e6e61179d/kernel# ls net/wireless/
cfg80211.ko

Hi vzhu,

Thanks for your verification and clarification.

Could you please tell me that how to build out staging driver(r8192u_usb.ko) for rtl8192cu?

I set CONFIG_STAGING=y and CONFIG_RTL8192U =m in meta-swi/meta-swi-mdm9x15/recipes-kernel/linux/files/xxx.cfg
But it is not working.
I check Kconfig that config RTL8192U depend on PCI && WLAN && USB
But I can’t enable PCI in bitbake linux-yocto -c menuconfig, it’s no option.
Thanks for your assistance again.

Hi,

Yes it’s a bit trick to build staging r8192u_usb. To make it config in menuconfig, what I did is to modify Kconfig to remove those depend like PCI. After that, it will show up

Hi vzhu,

Could you please check the steps what I did? I just study yocto a while. :slight_smile:

  1. tar xvf Legato-Dist-Source-mdm9x15-SWI9X15Y_07.11.09.00.tar.bz2

  2. cd yocto; make ;

  3. Remove depend on PCI of yocto/kernel/drivers/staging/rtl8192u/Kconfig

  4. source ./poky/oe-init-build-env; cd 
/build_bin

  5. bitbake linux-yocto -c menuconfig

  6. Set Device Driver->Network device support->Wireless LAN-> Realtek rtlwifi family of devices -> Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter

  7. Set Device Driver-> Staging drivers ->
    #Without RealTek RTL8192U Wireless LAN NIC driver

I still can’t get r8192u_usb.ko, please give me a hand.
Which step is wrong?

Hi,

‘without Realtek 
’ in step7, you mean it doesn’t show up in menuconfig?

Hi ,

Not sure any issue there? Feel free to tell me if I was not saying clearly.

Thanks,

Hi vzhu,

Your answer is really helpful for me.Thank you very much.
I met the other problem when I plugin the module to usb port.

dmesg
[ 2799.001159] usb 1-1.3.2: new high-speed USB device number 9 using msm_hsic_host
[ 2799.042422] rtl8192cu: Chip version 0x10
[ 2799.241385] rtl8192cu: MAC address: 74:da:38:8d:bb:e6
[ 2799.245475] rtl8192cu: Board Type 0
[ 2799.249351] rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
[ 2799.255546] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
[ 2799.261528] usb 1-1.3.2: Direct firmware load failed with error -2
[ 2799.267144] usb 1-1.3.2: Falling back to user helper
[ 2799.297939] usb 1-1.3.2: Direct firmware load failed with error -2
[ 2799.308285] usb 1-1.3.2: Falling back to user helper
[ 2799.337219] rtlwifi: Loading alternative firmware rtlwifi/rtl8192cufw.bin
[ 2799.347992] rtlwifi: Firmware rtlwifi/rtl8192cufw_TMSC.bin not available
root@swi-mdm9x15:~# lsmod
Tainted: G
rtl8192cu 87991 0 - Live 0xbf262000
rtl_usb 12107 1 rtl8192cu, Live 0xbf25b000
rtl8192c_common 52674 1 rtl8192cu, Live 0xbf248000
rtlwifi 71914 2 rtl8192cu,rtl_usb, Live 0xbf22f000
r8192u_usb 264580 0 - Live 0xbf1dc000 ©
mac80211 401226 3 rtl8192cu,rtl_usb,rtlwifi, Live 0xbf157000
cfg80211 376765 2 rtlwifi,mac80211, Live 0xbf0d2000
ipv6 289228 14 [permanent], Live 0xbf076000
msm_sdcc 62146 0 - Live 0xbf060000
usb_storage 41285 0 - Live 0xbf04c000
sd_mod 29515 0 - Live 0xbf03f000
scsi_mod 132683 2 usb_storage,sd_mod, Live 0xbf00d000
unix 29200 651 - Live 0xbf000000

What is the correct way to install rtl8192cufw.bin automatically to my rootfs?
I think I need to practice recipe .bb file :slight_smile:

Great, congratulation to get it run now.

About the rtl8192cufw.bin, do you have this file in your system?

Usually, the driver firmware file will be in filesystem directory :/lib/firmware

1 Like

If you failed to copy your .bin file under directory /lib/firmware, here is the alternnative way:

    1. Go to directory /mnt/flash
      -2. mkdir lib/rtlwifi, so you will see directory: /mnt/flash/lib/rtlwifi
    1. copy the binary file rtl8192cufw.bin to /mnt/flash/lib/rtlwifi
      -4. run: mount -t aufs -o dirs=/mnt/flash/lib=rw:/lib=ro aufs /lib
    1. Install your driver module. So the driver at this time will try to load firmware binary from /mnt/flash/lib/rtlwifi/rtl8192cufw_TMSC.bin or rtl8192cufw.bin
1 Like

Hi vzhu,

Thanks for your great suggestion.

I can scan the Wireless AP.
I will try to connect AP and set Soft AP.

root@swi-mdm9x15:/# ip link set wlan0 up
root@swi-mdm9x15:/# ip a add 10.0.0.1/24 dev wlan0
root@swi-mdm9x15:/# dnsmasq
root@swi-mdm9x15:~# hostapd /etc/hostapd.conf &
root@swi-mdm9x15:~# Configuration file: /etc/hostapd.conf
Failed to initialize driver 'nl80211’
hostapd_free_hapd_data: Interface wlan0 wasn’t started

When I want to connect AP or set Soft AP.
I always get Failed to initialize driver 'nl80211’
hostapd_free_hapd_data: Interface wlan0 wasn’t started

Thank you again.

Hi ,

The 'nl80211 is part of WLAN stack for wpa and hostap application, so this module is necessary

Hi,

I have followed above steps to run rtl8192cu WiFi USB dongle

after flashing kernel image in mangOH green board, I found all “.ko” files as per given in above post.
cfg80211.ko
mac80211.ko
r8192u_usb.ko
rtlwifi.ko
rtl8192c-common.ko
rtl_usb.ko
rtl8192cu.ko

but after doing "insmod " to all, When I run command for “ifup wlan0” ,
It give me error :

`
    root@swi-mdm9x15:~# ifconfig -a
    eth0      Link encap:Ethernet  HWaddr F2:D5:8A:1C:6B:08 
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    lo        Link encap:Local Loopback 
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    usb0      Link encap:Ethernet  HWaddr E6:08:74:06:32:10 
              inet addr:192.168.2.2  Bcast:192.168.2.255  Mask:255.255.255.0
              inet6 addr: fe80::e408:74ff:fe06:3210/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:57181 errors:0 dropped:0 overruns:0 frame:0
              TX packets:63212 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:6037544 (5.7 MiB)  TX bytes:24503087 (23.3 MiB)

    root@swi-mdm9x15:~# iwlist usb0 scan
    usb0      Interface doesn't support scanning.

    root@swi-mdm9x15:~# ifup wlan0     
    /etc/init.d/tiwifi: line 11: 12350 Segmentation fault      rmmod msm_sdcc
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Unable to remove the SDIO/MMC module... May be in use ?
    Please, free all SDIO/MMC devices before using TI WIFI.
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    root@swi-mdm9x15:~# `

To remove this error , I have commented “tiwifi” recipe from “mdm9x15-image.inc” file

Add WiFi TI drivers, tools, and scripts
#IMAGE_INSTALL += “ti-compat-wireless”
#IMAGE_INSTALL += “sierra-init-tiwifi”

It gave me following error:

root@swi-mdm9x15:~# ifup wlan0
    /bin/sh: /etc/init.d/tiwifi: No such file or directory
    root@swi-mdm9x15:~#

Please Tell me how to solve this error and
how will I get wlan0 detected.

The tiwifi script is referenced by /etc/network/interfaces for wlan0. You have removed the sierra-init-tiwifi recipe which provides that script, but I guess the /etc/network/interfaces must be created by some other recipe.