最近移植wifi到Eclair,Froyo平台。由于没有记录下移植步骤和心得,以至于每次都浪费了大量的精力。在此记录下移植步骤和心得,并和大家分享,如果有错误欢迎指正。
1、在你的BoardConfig.mk文件中增加一行(根据你的无线网卡类型来设置):
1: BOARD_WPA_SUPPLICANT_DRIVER := WEXT
2、在你的board配置目录下创建一个wpa_supplicant.conf文件,输入如下内容:
1: ctrl_interface=DIR=/data/system/wpa_supplicant
2: update_config=1
3、copy网络驱动模块ko文件到你的board配置目录下,下文假设网卡驱动模块为LK_DRV_USB_RTL8192.ko。
4、修改board配置目录下的AndroidBoard.mk,增加如下代码:
1: file := $(TARGET_OUT)/lib/modules/LK_DRV_USB_RTL8192.ko
2: ALL_PREBUILT += $(file)
3: $(file) : $(LOCAL_PATH)/LK_DRV_USB_RTL8192.ko | $(ACP)
4: $(transform-prebuilt-to-target)
5: 6: file := $(TARGET_OUT_ETC)/wifi/wpa_supplicant.conf
7: ALL_PREBUILT += $(file)
8: $(file) : $(LOCAL_PATH)/wpa_supplicant.conf | $(ACP)
9: $(transform-prebuilt-to-target)
5、修改hardware/libhardware_legacy/wifi/wifi.c文件。
重新定义WIFI_DRIVER_MODULE_PATH和WIFI_DRIVER_MODULE_NAME宏,定义如下:
1: #ifndef WIFI_DRIVER_MODULE_PATH
2: #define WIFI_DRIVER_MODULE_PATH "/system/lib/modules/LK_DRV_USB_RTL8192.ko"
3: #endif4: #ifndef WIFI_DRIVER_MODULE_NAME
5: #define WIFI_DRIVER_MODULE_NAME "LK_DRV_USB_RTL8192"
6: #endif 6、修改init.rc文件,修改如下:
1: chmod 0771 /system/etc/wifi wifi wifi
2: chmod 0660 /system/etc/wifi/wpa_supplicant.conf
3: chown wifi wifi /system/etc/wifi/wpa_supplicant.conf
4: mkdir /data/misc/wifi 0771 wifi wifi
5: 6: mkdir /data/misc/wifi/sockets 0771 wifi wifi
7: # wpa_supplicant socket
8: mkdir /data/system/ 0771 system system
9: mkdir /data/system/wpa_supplicant 0771 wifi wifi
10: 11: mkdir /data/misc/dhcp 0771 system system
12: 13: setprop wifi.interface wlan0
14: 15: ice wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c /system/etc/wifi/wpa_supplicant.conf
16: group system wifi inet
17: disabled
18: oneshot
19: 20: ice dhcpcd /system/bin/dhcpcd wlan0
21: group system dhcp
22: disabled
23: oneshot
注意如果有问题,请给各个目录设置为777属性,把文件设置为666的文件属性试试。
7、最好是clean掉,全部重新编译。享受终于可以享受wifi了!
阅读(1418) | 评论(0) | 转发(0) |