Building TP-LINK TL-WN725N WiFi USB Adapter driver for Raspberry Pi

UPDATE (2013-01-25): I’ve updated RPi firmware today and it seems that the latest kernel (3.6.11+) includes working driver for TL-WN725N. Instructions below are now obsolete/educational ๐Ÿ˜‰

I’ve decided to replace TL-WN721N adapters with something smaller. After some research and tests with my old Debian laptop, I’ve bought two TP-LINK TL-WN725N 802.11n USB adapters.
In contrast to 721’s, they are smaller and are built on different chipset – Realtek RTL8188CUS.
Installation is not as easy as with Atheros-based adapters, because no kernel driver supports this chipset. Fortunately, Realtek provides open-source Linux drivers on their website.
So, let’s get started ๐Ÿ™‚

First, we have to download current Linux drivers from Realtek’s website. As of December 14th latest version is 2.6.6.0.20120403.
Unzip downloaded file:

$ unzip ./RTL8192xC_USB_linux_v3.4.4_4749.20121105.zip

Move to extracted folder and enter “driver” directory. There’s a tar.gz archive with driver sources – uncompress it.

$ cd RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/driver/
$ tar -xvf ./rtl8188C_8192C_usb_linux_v3.4.4_4749.20121105.tar.gz

I’ve recommend renaming the extracted dir to some shorter name and moving it to some handy place.

Default driver configuration, enables a lot of debug info being output to dmesg.
To fix this, edit include/autoconf.h file and comment out defines in “Debug Related Config” section, leaving only “DBG”.

To properly build our driver, we have to modify Makefile and add config options for RasPi platform.
Find CONFIG_PLATFORM_ block and add:

CONFIG_PLATFORM_ARM_BCM2708 = y

Now, find platform flags block and add:

ifeq ($(CONFIG_PLATFORM_ARM_BCM2708), y)
  EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
  ARCH := arm
  CROSS_COMPILE :=
  KVER  := $(shell uname -r)
  KSRC := /lib/modules/$(KVER)/build
  MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
  INSTALL_PREFIX :=
endif

Once we have driver sources ready, prepare for build.
Get build environment:

# apt-get install build-essential

We’ll also need current kernel headers – use kernel sources from github, see this post on Grendelman’s blog.

# cd /usr/src
# wget -O rpi-3.2.27.tar.gz https://github.com/raspberrypi/linux/tarball/rpi-3.2.27
# tar xzf ./rpi-3.2.27.tar.gz
# KVER=`uname -r`
# mv raspberrypi-linux-* linux-$KVER
# cd linux-$KVER/
# sed -i 's/EXTRAVERSION =.*/EXTRAVERSION = +/' Makefile
# zcat /proc/config.gz > .config
# wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
# make oldconfig
# make modules_prepare
# ln -s /usr/src/linux-$KVER /usr/src/linux
# ln -s /usr/src/linux-$KVER /lib/modules/$KVER/source
# ln -s /usr/src/linux-$KVER /lib/modules/$KVER/build

Build and install, meanwhile make yourself a coffee ๐Ÿ˜‰

# make && make install

If you want to install driver on other Raspberry running the same kernel, just copy 8192cu.ko file to /lib/modules/3.2.27+/kernel/drivers/net/wireless/ and reboot.

11 thoughts on “Building TP-LINK TL-WN725N WiFi USB Adapter driver for Raspberry Pi

  1. unMGx

    how to compile this on newer kernel version, because i do not now how to get kernel headers for 3.6.8+ / 3.6.11, because the files are not available on github

    Thankful for any kind of solution….

    Reply
    1. elevendroids Post author

      Latest RPi kernel branch is “3.6.y”.
      Download kernel headers using:

      wget -O rpi.tar.gz https://github.com/raspberrypi/linux/tarball/rpi-3.6.y

      And unpack using:

      tar xzf ./rpi.tar.gz

      Rest should work fine without any changes.
      I’ll test it later and update the post.

      Reply
  2. yanglifu90

    @elevendroids Strange, the latest version of Raspbmc uses 3.6.11 kernel but do not work with TP-LINK TL-WN725N out-of-the-box, what is stranger still is previous version of the distribution works with the wireless adapter… Do you mind try it once? It’s OK if you don’t want to, then I need to build the driver manually see if it works.

    Reply
  3. kilobyte

    I have this card and Raspberry Pi for two days and haven’t got a chance to setup this properly. Card is seen in network manager, but cannot conect to my wifi network. Do I have to configure this manually?

    Reply
  4. Pingback: Raspberry Pi ๅ…ฅๆ‰‹ๅฐ่ฎฐ | chriszh

  5. Guido

    I’m trying to install Raspbmc with the wifi adapter TP-LINK TL-WN725N. It looks like there is a connection with my network but then i got this error: “ADDRCONF(NETDEV_UP): eth0: link is not ready”.

    Can someone tell me how to fix this problem? Is this a driver problem? I’m not a linux/raspi pro, so please don’t blame me if it’s a stupid question ๐Ÿ˜‰

    Greetz from the Netherlands

    Reply
    1. elevendroids Post author

      Well, it looks like your (wired) ethernet port is not connected ๐Ÿ™‚
      If networking is working, ignore it.

      I receive these messages for both eth0 and wlan0 interfaces – it looks like some IPv6 stuff is trying to access these interfaces before they’re ready.

      Reply
      1. Guido

        I don’t have a network cable in my room that’s why i wanted to install Raspbmc with the wireless adapter. I got the solution. I installed the standalone image of Raspbmc (no network connection needed). After that, XBMC worked well รกnd the wireless adapter TP-LINK TL-WN725N did work in XBMC ๐Ÿ™‚

        Reply
        1. Mads

          Hi ๐Ÿ™‚

          Great post. I would appreciate as well if you would share your driver compilation. Is this possible?

          Thanks in advance.

          Awesome articles you have here.

          Reply
  6. Pingback: TP-LINK WN725N V2 nano usb WiFi ็ฝ‘ๅก่ฟžๆŽฅ Raspnberry Pi ็ปˆไบŽๅทฅไฝœไบ† - ๆ ‘่Ž“ๆดพ - ๅผ€ๅ‘่€…็ฌฌ1051689ไธช้—ฎ็ญ”

Leave a Reply to elevendroids Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.