I’ve got this TP-Link TL-WDN3200 N600 Wireless Dual Band USB Adapter and I’ve been trying to make it work in Kali Linux which is a Debian derivative. I managed to find the Linux driver DPO_RT5572_LinuxSTA_2.6.1.3_20121022.tar.bz2 from http://www.mediatek.com/. The instructions were very clear but when I tried to compile I received an compile error “make: *** /lib/modules/3.7-trunk-amd64/build: No such file or directory. Stop.“. Following is how to re-produce and fix this error.
Plug-in the USB Adapter
Issue the following command which lists all plugged in USB devices.
root@oracle:~# lsusb Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 003: ID 148f:2870 Ralink Technology, Corp. RT2870 Wireless Adapter Bus 002 Device 003: ID 148f:5572 Ralink Technology, Corp. root@oracle:~#
Download driver and unpack it.
root@oracle:~# tar xvf DPO_RT5572_LinuxSTA_2.6.1.3_20121022.tar.bz2 root@oracle:~# cd Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/ root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# ls chips iwpriv_usage.txt rate_ctrl RT2870STA.dat tools common Makefile README_STA_usb sta include os RT2870STACard.dat sta_ate_iwpriv_usage.txt
Modify makefile
In Makefile
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# leafpad Makefile
set the "MODE = STA"
in Makefile and chose the TARGET to Linux by set "TARGET = LINUX"
.
You can modify more to meet your need.
Modify config.mk file
In os/linux/config.mk
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# leafpad os/linux/config.mk
2 Options:
** Build for being controlled by NetworkManager or wpa_supplicant wext functions
Please set ‘HAS_WPA_SUPPLICANT=y’ and ‘HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y’.
=> #>cd wpa_supplicant-x.x
=> #>./wpa_supplicant -Dwext -ira0 -c wpa_supplicant.conf -d
** Build for being controlled by WpaSupplicant with Ralink Driver
Please set ‘HAS_WPA_SUPPLICANT=y’ and ‘HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n’.
=> #>cd wpa_supplicant-0.5.7
=> #>./wpa_supplicant -Dralink -ira0 -c wpa_supplicant.conf -d
In my case, I choose y
and y
for both.
Complile code
Now lets try to compile using make
command.
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# make make -C tools make[1]: Entering directory `/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools' gcc -g bin2h.c -o bin2h make[1]: Leaving directory `/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools' /root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools/bin2h cp -f os/linux/Makefile.6 /root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/Makefile make -C /lib/modules/3.7-trunk-amd64/build SUBDIRS=/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux modules make: *** /lib/modules/3.7-trunk-amd64/build: No such file or directory. Stop. make: *** [LINUX] Error 2
This is where I got the error:
make: *** /lib/modules/3.7-trunk-amd64/build: No such file or directory. Stop. make: *** [LINUX] Error 2
Determine headers
To fix this error we need to install correct headers as you can see the compiler is looking into the following directory /lib/modules/3.7-trunk-amd64/build
Following command will list available headers
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# aptitude search `uname -r` p linux-headers-3.7-trunk-amd64 - Header files for Linux 3.7-trunk-amd64 i A linux-image-3.7-trunk-amd64 - Linux 3.7 for 64-bit PCs p linux-image-3.7-trunk-amd64-dbg - Debugging symbols for Linux 3.7-trunk-amd64 v linux-latest-modules-3.7-trunk-amd64 - v linux-modules-3.7-trunk-amd64 - p xen-linux-system-3.7-trunk-amd64 - Xen system with Linux 3.7 on 64-bit PCs (meta-package)
Now let’s install the correct headers using the following command
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: linux-headers-3.7-trunk-amd64 linux-headers-3.7-trunk-common linux-kbuild-3.7 The following NEW packages will be installed: linux-headers-3.7-trunk-amd64 linux-headers-3.7-trunk-common linux-headers-amd64 linux-kbuild-3.7 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 4,671 kB of archives. After this operation, 30.0 MB of additional disk space will be used. Do you want to continue [Y/n]? Y . . . . . <truncated> . . . Setting up linux-headers-3.7-trunk-common (3.7.2-0+kali8) ... Setting up linux-kbuild-3.7 (3.7.1-1~experimental.1+kali2) ... Setting up linux-headers-3.7-trunk-amd64 (3.7.2-0+kali8) ... Setting up linux-headers-amd64 (3.7+46+kali1) ...
That looks good. Now we should be able to compile the code
Compile code – Take 2
Issue make
command to complile source codes
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# make make -C tools make[1]: Entering directory `/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools' gcc -g bin2h.c -o bin2h make[1]: Leaving directory `/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools' /root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools/bin2h cp -f os/linux/Makefile.6 /root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/Makefile make -C /lib/modules/3.7-trunk-amd64/build SUBDIRS=/root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux modules make[1]: Entering directory `/usr/src/linux-headers-3.7-trunk-amd64' . . . . . <truncated> . . . . . make[1]: Leaving directory `/usr/src/linux-headers-3.7-trunk-amd64' cp -f /root/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/rt5572sta.ko /tftpboot root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022#
Thats looks better. Now we can try to actually use the driver.
Copy drivers
Copy the driver to /etc/Wireless/RT2870STA
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# mkdir -p /etc/Wireless/RT2870STA/ root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# cp RT2870STA.dat /etc/Wireless/RT2870STA/
Load driver module
Plugin the USB Adapter now if you haven’t already and load driver
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# insmod os/linux/rt5572sta.ko
Set interface up
Set interface up and you might need to restart Network Manager
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# ifconfig ra0 inet up root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# service network-manager restart
Unload driver module
To unload driver, unplug the USB Adapter and
root@oracle:~/Desktop/DPO_RT5572_LinuxSTA_2.6.1.3_20121022# rmmod rt2870sta
That makes TP-Link TL-WDN3200 N600 Wireless Dual Band USB Adapter work in linux.
Thanks for reading.