手中zd1211b无线网卡已经可使用wpa_supplicant连接无线网络,
最近的工作主要为修改android的HAL层,使android能够识别该无线网卡。
Android默认使用wifi.c加载无线网卡驱动模块,如果直接编译进内核需要做一定修改。
(1)build/target/board/idea6410/BoardConfig.mk
add
# Wifi related defines
BOARD_WPA_SUPPLICANT_DRIVER := WEXT
(2)external\wpa_supplicant\.config
# CONFIG_NO_WPA=y
CONFIG_OS=unix
CONFIG_IEEE8021X_EAPOL=y
CONFIG_EAP_MD5=y
CONFIG_EAP_MSCHAPV2=y
CONFIG_EAP_TLS=y
CONFIG_EAP_PEAP=y
CONFIG_EAP_TTLS=y
CONFIG_EAP_GTC=y
CONFIG_EAP_OTP=y
CONFIG_EAP_SIM=y
CONFIG_EAP_AKA=y
CONFIG_EAP_PSK=y
CONFIG_EAP_SAKE=y
CONFIG_EAP_GPSK=y
CONFIG_EAP_PAX=y
CONFIG_EAP_LEAP=y
CONFIG_PKCS12=y
CONFIG_SMARTCARD=y
CONFIG_WIRELESS_EXTENSION=y
CONFIG_CTRL_IFACE=y
CONFIG_DRIVER_WEXT=y
(3)hardware/libhardware_legacy/wifi/wifi.c
将驱动直接编译进内核
int wifi_load_driver()
{
char driver_status[PROPERTY_VALUE_MAX];
int count = 100; /* wait at most 20 seconds for completion */
LOGE("wifi driver loaded !");
return 0;
}
int wifi_unload_driver()
{
int count = 20; /* wait at most 10 seconds for completion */
LOGE("wifi driver unloaded by rockie!");
return 0;
注意这个定义static const char IFACE_DIR[] = "/data/system/wpa_supplicant";
(4)编译整个android系统,确认编译完bin目录中含有wpa_supplicant、wpa_cli
(5)修改init.rc文件
add
mkdir /data/misc/wifi 0770 system system
mkdir /data/misc/wifi/sockets 0770 system system
mkdir /data/system/wpa_supplicant 0770 system system
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
add at the end
service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0 -d -c /data/misc/wifi/wpa_supplicant.conf
# user wifi
# group wifi system
socket wpa_eth0 dgram 0660 wifi system
disabled
oneshot
service dhcpcd /system/bin/dhcpcd -f /system/etc/dhcpcd/dhcpcd.conf -d eth0
disabled
oneshot
on property:init.svc.wpa_supplicant=stopped
stop dhcpcd
(6)添加system/etc/wifi/wpa_supplicant.conf
update_config=1
ctrl_interface=/data/system/wpa_supplicant //这个一定要和IFACE_DIR对应并保证目录权限
eapol_version=1
ap_scan=1
fast_reauth=1
(7)boot and try
阅读(1229) | 评论(0) | 转发(0) |