对于移植USB的WIFI模块来讲,相对于要简单很多。特别是我们现在要移植的这款realtek_8192已将做好了傻瓜式的步骤文档,只需要你懂一点点wifi的流程或他的工作调用。
作为没有接触过android的新人,当初也是折腾了好几天。
sdk已经非常完美,所以我们只需要按照文档进行就OK了
首先我们得把驱动编译成.KO文件,因为支持很多种的平台所以我们还是把添加到Makefile的贴出来:
支持android:
ifeq ($(CONFIG_PLATFORM_ANDROID), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := /usr/local/arm/arm-none-eabi-2010-09-51/bin/arm-none-eabi-
KVER := 2.6.35.7
KSRC ?= /home/ly/s5pv210/android_gingerbread_m12/android/kernel
MODULE_NAME := wlan \\定义模块名字为 wlan
endif
编译完成后你可以动态加载到kernel下用iwlist.iwconfig等命令进行简单的调试,如果正常就可以进行下面的步骤了。
接下来按照文档移植:
realtek_wifi_SDK_for_android_20110623.txt
==========================================================
Realtek Wifi SDK for Android
==========================================================
To port Realtek Wi-Fi driver onto Android platform, you
can go through the following guide with reference codes
within our driver package's realtek_wifi_SDK_for_android_20110623.tar.gz.
Because Android's SDK may differ from platform to
platform, our reference codes may not be applied on every
platform without modifications. You should check if our
reference code is suitable for you to use.
==========================================================
1. Modifications for platform related files
==========================================================
a. BOARD_USES_REALTEK_WIFI
Ensure "BOARD_USES_REALTEK_WIFI = true" is defined
in BoardConfig.mk or Android.mk. This is for some
compile-time choices to be applied for our wifi.
b. Service definitions
Make sure the service definition of wpa_supplicant,
dhcpd, hostapd is defined in init.rc or init.xxx.rc
for your platform. As following:
service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
disabled
oneshot
service hostapd /system/bin/hostapd_wps /data/misc/wifi/hostapd.conf
disabled
oneshot
service dhcpcd /system/bin/dhcpcd -ABKL
disabled
oneshot
==========================================================
2. Modifications for dhcpcd
==========================================================
external/dhcpcd/Android.mk
external/dhcpcd/client_realtek.c
external/dhcpcd/logger_realtek.c
==========================================================
3. Modifications for wpa_supplicant
==========================================================
external/wpa_supplicant/Android.mk
external/wpa_supplicant/driver_wext.c
external/wpa_supplicant/vendor.h
Following is the reference content of wpa_supplicant.conf:
update_config=1
ctrl_interface=DIR=/data/misc/wifi/wpa_supplicant GROUP=wifi
==========================================================
4. Modifications for libhardware_legacy - wifi
==========================================================
hardware/libhardware_legacy/wifi/Android.mk
hardware/libhardware_legacy/wifi/wifi_realtek.c
==========================================================
5. Modifications for netd - hostapd
==========================================================
external/hostapd-0.6.9_rtl/*
system/netd/Android.mk
system/netd/SoftapController_realtek.cpp
==========================================================
6. Modification for opening portable hotspot UI
==========================================================
Add interface items for "config_tether_wifi_regexs" and
"config_tether_upstream_regexs"
frameworks/base/core/res/res/values/config.xml
==========================================================
7. Driver compilation
==========================================================
a. For compilation, see document/HowTo support new platform(including Android).doc or
document/HowTo build driver under kernel tree.doc for reference.
b. MODULE_NAME defined in Makefile
For android to rmmod the wifi kernel module, the
driver module name, which is decided in compilation
time as MODULE_NAME defined in Makefile, should be
the same as WIFI_DRIVER_MODULE_NAME defined in
wifi_realtek.c:
#define WIFI_DRIVER_MODULE_NAME "wlan"
c. If you compile wifi driver to .ko file, place driver module to specific path.
The default path is defined in wifi_realtek.c:
#define WIFI_DRIVER_MODULE_PATH "/system/wifi/wlan.ko"
d. Other useful driver options defined in include/autoconf.h
#define CONFIG_IPS_LEVEL_2
The default IPS mode, IPS_NORMAL, needs a lot of IO to
wake up, it will spend much time espeically with low
speed IO interface, ex: USB1.1. With this Macro defined,
driver will set the default IPS mode to IPS_LEVEL_2.
IPS_LEVEL_2 spends more power than IPS_NORMAL but it is
speedy while waken up.
讽筿家Αゴ秨driver箇砞IPS(硈絬玡筿家Α)家Α
酬眶惠璶耕IOIO硉耕篊ざ穦耕诀
穦盢IPS家Α箇砞IPS_LEVEL_2IPS_LEVEL_2耕IPS_NORMAL
筿祘ゴчΙ纔翴琌酬眶硉е
#define CONFIG_ADAPTOR_INFO_CACHING_FILE
When the driver recognizes the wifi HW, it will read HW
configuration from it. This will spend much time espeically
with low speed IO interface. With this Macro defined, the
HW configuration will be cached in file (default path is
/data/misc/wifi/rtw_cache) to save the time of reading HW
configuration through IO. This machanism is suitable for
situations placing wifi module inside platform case. If wifi
module/dongle is replacable, due to the configuration
difference of each Wifi HW, using wrong HW configuration
will cause wifi to work unnormally.
wifi driver粄呼穦眖呼弄祑砰砞竚戈癟˙艼
IO硉耕篊ざ穦耕诀盢呼祑砰砞竚戈癟
郎い(箇砞隔畖/data/misc/wifi/rtw_cache)竊丁
惠猔種诀続ず竚wifiㄏノ薄挂キ璝蹦ノ竚┾传
wifi dongleパ–呼祑砰砞竚戈癟ぃㄏノ岿祑砰砞
竚穦硑Θwifiぃタ盽
#define CONFIG_RESUME_IN_WORKQUEUE
The Android system will resume normal peripherals(ex: Wifi)
first and then peripherals registerd under early suspend
(ex: screen). The Wif resume process will spend much time
espeically with low speed IO interface. This will cause the
user experience a period of "black screen time" after
pushing down the resume button. With this Macro defined,
the wifi resume process will be done in workqueue to avoid
delaying of screen light-up.
╰参resume穦resume㏄娩杆竚礛resume爹early
suspend杆竚wifiresume惠璶禣ㄇ丁τandroid
獹场琌爹early suspend┮穦Τresume龄ぃ
穦皑獹薄猵诀盢wifi resumeworkqueue磷wifi
resume┑筐獹丁
#define CONFIG_SET_SCAN_DENY_TIMER
With this Macro defined, driver will bypass the scan command
from upper layer for a short period of time (3 sec by default)
when the connection to AP is done and DHCP process. This will
reduce the disturbance caused by scan command from upper layer
while WPA/WPA2 authentication and DHCP are in progress.
诀ゴ秨籔AP硈絬┪DHCP穦既盢糷scan㏑
钡scanЧΘτぃ秈︽痷タscan搭ぶ糷scan癸硈絬の
DHCP耑
==============================================================================================================================
在修改了nit.rc or init.xxx.rc之后需要从android/out/release更新android.img.cpio到kernel目录下替换android.img.cpio
如果是在你曾经编译过的环境下进行移植,那就非常有必要注意下面这3个服务有没有及时的更新链接的.SO文件,如果是干净的环境那将不需要考虑:
dhcpcd
wpa_supplicant
netd - hostapd
==============================================================================================================================
一个萝卜一个坑的完成了上面的工作,基本上你就已经成功了....