USB_WIFI移植(realtek_8192cu)

   對於移植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(硈絬玡篠家Α)家Α
酬眶惠璶耕IOIO硉耕篊ざ穦耕訣
穦盢IPS家Α箇砞IPS_LEVEL_2IPS_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杆竚wifiresume惠璶禣ㄇ丁τandroid
獹場琌爹early suspend┮穦Τresume齡ぃ
穦皚獹薄猵訣盢wifi resumeworkqueue磷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

==============================================================================================================================


一個蘿蔔一個坑的完成了上面的工作,基本上你就已經成功了....




   


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章