移植过程中得到网友的不少帮助,很感谢!为了让更多的网友不像我这样折腾,特写此文以做参照.过程中主要参考< Realtek_Wi-Fi_SDK_for_Android_KK_4_4.pdf >和< Quick_Start_Guide_for_Driver_Compilation_and_Installation.pdf>这两个文档,以及论坛https://community.freescale.com/thread/322825 这篇文章,具体步骤如下:
一.内核修改
1.替换realtek文件夹
”realtek_wifi_SDK_for_android_KK_4.4_20140117.tar.gz” 解压,然后将ANDROID_SDK /hardware/realtek覆盖到源码kernel_imx/hardwar中.
2. BoardConfig.mk
在ANDROID_SDK /device/ fsl/sabresd_6dq/ BoardConfig.mk中,追加如下内容:
BOARD_WIFI_VENDOR := realtek
BOARD_WLAN_VENDOR := REALTEK
ifeq ($(BOARD_WIFI_VENDOR),realtek)
WPA_SUPPLICANT_VERSION :=VER_0_8_X
BOARD_WPA_SUPPLICANT_DRIVER :=NL80211
#CONFIG_DRIVER_WEXT :=y
CONFIG_DRIVER_NL80211 :=true
BOARD_WPA_SUPPLICANT_PRIVATE_LIB:= lib_driver_cmd_rtl
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_HOSTAPD_PRIVATE_LIB :=lib_driver_cmd_rtl
BOARD_WLAN_DEVICE := rtl8192cu
#BOARD_WLAN_DEVICE := rtl8192du
#BOARD_WLAN_DEVICE := rtl8192ce
#BOARD_WLAN_DEVICE := rtl8192de
#BOARD_WLAN_DEVICE := rtl8723as
#BOARD_WLAN_DEVICE := rtl8723au
#BOARD_WLAN_DEVICE := rtl8189es
#BOARD_WLAN_DEVICE := rtl8723bs
#BOARD_WLAN_DEVICE := rtl8723bu
WIFI_DRIVER_MODULE_NAME :="wlan"
WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/wlan.ko"
WIFI_DRIVER_MODULE_ARG :="ifname=wlan0 if2name=p2p0"
WIFI_FIRMWARE_LOADER :=""
WIFI_DRIVER_FW_PATH_STA :=""
WIFI_DRIVER_FW_PATH_AP :=""
WIFI_DRIVER_FW_PATH_P2P :=""
WIFI_DRIVER_FW_PATH_PARAM :=""
Endif
3. init.rc
在ANDROID_SDK /device/ fsl/sabresd_6dq/init.rc中
A. 替换如下wpa_supplican服务
service rtw_suppl_con /system/bin/wpa_supplicant
-ip2p0 -Dnl80211-c/data/misc/wifi/p2p_supplicant.conf
-e/data/misc/wifi/entropy.bin -N
-iwlan0 -Dnl80211-c/data/misc/wifi/wpa_supplicant.conf
-O/data/misc/wifi/sockets
-g@android:wpa_wlan0
class main
socket wpa_wlan0 dgram 660 wifiwifi
disabled
oneshot
service rtw_suppl/system/bin/wpa_supplicant
-iwlan0 -Dnl80211-c/data/misc/wifi/wpa_supplicant.conf
-O/data/misc/wifi/sockets
-e/data/misc/wifi/entropy.bin
-g@android:wpa_wlan0
class main
socket wpa_wlan0 dgram 660 wifiwifi
disabled
oneshot
B. 追加DHCPCD服务
service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
class main
disabled
oneshot
service dhcpcd_p2p/system/bin/dhcpcd -aABKL
class main
disabled
oneshot
service iprenew_wlan0/system/bin/dhcpcd -n
class main
disabled
oneshot
service iprenew_p2p/system/bin/dhcpcd -n
class main
disabled
oneshot
4. libhardware_legacy
在文件ANDROID_SDK/hardware/libhardware_legacy/wifi/Android.mk 中变更如下语句
ifeq ($(BOARD_WIFI_VENDOR),realtek)
LOCAL_SRC_FILES +=../realtek/wlan/libhardware_legacy/wifi/wifi_realtek.c
else
LOCAL_SRC_FILES += wifi/wifi.c
Endif
5. wpa_supplicant_8
将ANDROID_SDK/external/下wpa_supplicant_8备份一下,然后将驱动包里的wpa_supplicant_8_kk_4.4_rtw名称改为wpa_supplicant_8并替换到ANDROID_SDK/external/
6.imx6_android_defconfig
修改文件kernel_imx/arch/arm/configs/imx6_android_defconfig,将下列项目配置成Y.
CONFIG_CFG80211=y
CONFIG_MAC80211_MESH=y
CONFIG_MAC80211=y
CONFIG_HOSTAP=y
CONFIG_RTL8192CU=y
CONFIG_USB_USBNET=y
7.权限
在out/target/product/sabresd_6dq/root/init.rc中,追加内容如下:
mkdir /system/etc/wifi 0770 wifi wifi
chmod 0770 /system/etc/wifi
chmod 0660 /system/etc/wifi/wpa_supplicant.conf
chown wifi wifi /system/etc/wifi/wpa_supplicant.conf
#wpa_supplicant control socket for android wifi.c (android privatesocket)
mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/sockets 0770 wifi wifi
chmod 0770 /data/misc/wifi
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
chown wifi wifi /data/misc/wifi
chown wifi wifi /data/misc/wifi/wpa_supplicant.conf
setprop wifi.interface wlan0
setprop wlan.driver.status"ok"
8.文件夹删除
out/target/product/sabresd_6dq下的system文件夹以及out/target/product/sabresd_6d/obj/EXECUTABLES下wpa_supplicant_intermediates文件夹删除.
完成以上后,编译内核.
二.驱动编译
1.新驱动包4.3.0.9没有make_drv和autoconf_rtl8188e_usb_linux.h,需要从其他的驱动包中拷过来.
2.增加新的平台
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_NEW = y
……
ifeq($(CONFIG_PLATFORM_NEW), y)
EXTRA_CFLAGS +=-DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE :=/opt/ new/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
KSRC := /opt/new/kernel
MODULE_NAME := wlan
Endif
3. include/autoconf.h和autoconf_rtl8188e_usb_linux.h修改
#define CONFIG_IOCTL_CFG80211
#ifdef CONFIG_IOCTL_CFG80211
#define RTW_USE_CFG80211_STA_EVENT
//#defineCONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER
//#define CONFIG_DEBUG_CFG80211 1
#endif
…
#define CONFIG_CONCURRENT_MODE
…
#define CONFIG_P2P_IPS
4.将编译完成内核,将kernel_imx目录下Module.symvers文件到驱动的根目录覆盖之前的文件.
5.编译
A. make_drv
root@rtl8188C_8192C_8192D_usb_linux_v3.3.0_2920.20111123#./make_drv
Please select chip type(1/2):
1) RTL8192cu
2) RTL8192du
#? 1
You have selected RTL8192cu
B. 在驱动根目录下,执行make,然后在目录下产生wlan.ko文件
三. 驱动安装与再编译
1.将产生的wlan.ko文件,复制到out/target/product/sabresd_6dq/system/lib/modules文件夹中。(没有modules文件夹,自己新建)
2.使用make snod命令重新制作system.img
注意事项:
注意要先编译安卓,再去编译8188eus的驱动