Realtek R8192D USB WiFi Integration: Difference between revisions
mNo edit summary |
|||
Line 190: | Line 190: | ||
<a_pointer> = vmalloc(<a_size>); | <a_pointer> = vmalloc(<a_size>); | ||
memset(<a_pointer>, 0, <a_size>); | memset(<a_pointer>, 0, <a_size>); | ||
[[Category | [[Category:Whitepaper]] |
Revision as of 19:27, 31 March 2014
Overview
This articles is based on Realtek R8712U USB WiFi Integration.
However, the chipset to integrate is a Realtek R8192D chipset inside a TRENDnet TEW-664UB wlan USB stick.
Existing Linux support
http://www.linux-hardware-guide.de/2013-11-09-trendnet-tew-664ub-300-mbps-usb-wlan-adapter-802-11n
Checked USB IDs on Ubuntu host:
lsusb ... Bus 003 Device 009: ID 20f4:664b TRENDnet
Sure it's a Realtek RTL8192DU chip set.
Port driver from: https://github.com/lwfinger/rtl8192du.git
Integrating the driver to the 2.6.32 DM36x kernel
Create a new patch
cd $DEVDIR/kernel quilt new arch/add_realtek_rtl8192du_usb_wlan_support.patch
Extend the kernel configuration and the Makefile
cd $DEVDIR/kernel quilt add linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/Kconfig quilt add linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/Makefile
Add a config item to linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/Kconfig
... config RTL8192DU tristate "Realtek 8192DU USB support" ---help--- This is a driver for RTL8192DU based cards. These are USB based chips found in devices such as: TRENDnet TEW-664UB V2.0R ...
Add a sub directory build to linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/Makefile
... obj-$(CONFIGRTL8192DU) += rtl8192du/ ...
Refresh the patch
cd $DEVDIR/kernel quilt refresh
Add the patch to the bsp's arch-dm368 and clean up the kernel patch stack
echo "add_realtek_rtl8192du_usb_wlan_support.patch" >> $DEVDIR/bsp/arch-dm368/patches/linux-2.6.32.17-psp03.01.01.39/series cd $DEVDIR make kernel_clean FORCE=1 make kernel
Position the quilt stack again to the patch
cd $DEVDIR/kernel quilt pop arch/add_realtek_rtl8192du_usb_wlan_support.patch
Clone the existing driver to integrate into a temporary directory
mkdir -p $HOME/work/tmp cd $HOME/work/tmp git clone https://github.com/lwfinger/rtl8192du.git
Create the driver directoryin the kernel
mkdir $DEVDIR/linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du
Create the same files as in the cloned driver
cd $HOME/work/tmp/rtl8192du/core for file in *.c; do touch $DEVDIR/kernel/linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/$file; done cd $HOME/work/tmp/rtl8192du/hal for file in *.c; do touch $DEVDIR/kernel/linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/$file; done cd $HOME/work/tmp/rtl8192du/os_dep for file in *.c; do touch $DEVDIR/kernel/linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/$file; done cd $HOME/work/tmp/rtl8192du/include for file in *.h; do touch $DEVDIR/kernel/linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/$file; done
Add the driver sources to the patch
cd $DEVDIR/kernel quilt add linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/* quilt add linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/include/*
cp $HOME/work/tmp/rtl8192du/core/*.c linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/ cp $HOME/work/tmp/rtl8192du/hal/*.c linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/ cp $HOME/work/tmp/rtl8192du/os_dep/*.c linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/ cp $HOME/work/tmp/rtl8192du/include/*.h linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/
quilt refresh
Add a driver Makefile
touch linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/Makefile quilt add linux-2.6.32.17-psp03.01.01.39/drivers/net/wireless/rtl8192du/Makefile
Contents:
rtl8192du-objs := rtw_cmd.o \ rtw_security.o \ rtw_debug.o \ rtw_io.o \ rtw_ioctl_set.o \ rtw_ieee80211.o \ rtw_mlme.o \ rtw_mlme_ext.o \ rtw_wlan_util.o \ rtw_pwrctrl.o \ rtw_rf.o \ rtw_recv.o \ rtw_sta_mgt.o \ rtw_ap.o \ rtw_xmit.o \ rtw_p2p.o \ rtw_tdls.o \ rtw_br_ext.o \ rtw_sreset.o \ rtw_efuse.o \ hal_intf.o \ hal_com.o \ rtl8192d_hal_init.o \ rtl8192d_phycfg.o \ rtl8192d_rf6052.o \ rtl8192d_dm.o \ rtl8192d_rxdesc.o \ rtl8192d_cmd.o \ usb_halinit.o \ rtl8192du_led.o \ rtl8192du_xmit.o \ rtl8192du_recv.o \ Hal8192DUHWImg.o \ rtl8192d_xmit.o \ usb_ops_linux.o \ osdep_service.o \ os_intfs.o \ usb_intf.o \ usb_ops_linux.o \ ioctl_linux.o \ xmit_linux.o \ mlme_linux.o \ recv_linux.o \ ioctl_cfg80211.o \ rtw_android.o
quilt refresh --strip-trailing-whitespace
Activate the driver in the kernel configuration
cd $DEVDIR make config
Select
Fixes to match the 2.6.32 kernel
Local headers are included with <...>
Search and replace with "...".
vzalloc is not present
Compilation errors like:
drivers/net/wireless/rtl8192du/rtw_xmit.c:93: error: implicit declaration of function 'vzalloc'
occur.
vzalloc(...) is just a zero-set version of vmalloc(...) in later kernels.
Replace:
<a_pointer> = vzalloc(<a_size>);
with:
<a_pointer> = vmalloc(<a_size>); memset(<a_pointer>, 0, <a_size>);