1. 修改 build/target/board/generic/BoardConfig.mk
定义使用 wireless extension 作为wpa_supplicant 的driver.
# Wifi related defines
BOARD_WPA_SUPPLICANT_DRIVER := WEXT

2.修改hardware/libhardware_legacy/wifi/wifi.c

wifi.c 是 wifi 的hardware 抽像层,必须修改 wifi_load() . wifi_unload()

两个函数来装载特定 wifi chip 的FW , 以及insmod wifi driver.

3. 配置 wpa_supplicant

3.1 修改out/target/product/generic/root/init.rc

# For wifi
mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/sockets 0770 wifi wifi
mkdir /data/system/wpa_supplicant 0770 wifi wifi

chmod 0660 /data/misc/wifi/wpa_supplicant.conf

service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant /
-Dwext -iwlan0 -c /data/misc/wifi/wpa_supplicant.conf
disabled
oneshot

这里wpa_supplicant 使用wireless extension 作为 driver, wlan0 为intercace, /data/misc/wifi/wpa_supplicant.conf
作为配置文件

3.2 wpa_supplicant.conf

wpa_supplicant 的配置文件内容如下

-----------------------------------------------------------------------------------

# This option can be used to allow wpa_supplicant to overwrite configuration
# file whenever configuration is changed (e.g., new network block is added with
# wpa_cli or wpa_gui, or a password is changed). This is required for
# wpa_cli/wpa_gui to be able to store the configuration changes permanently.
# Please note that overwriting configuration file will remove the comments from
# it.
update_config=1

# Parameters for the control interface. If this is specified, wpa_supplicant
# will open a control interface that is available for external programs to
# manage wpa_supplicant. The meaning of this string depends on which control
# interface mechanism is used. For all cases, the existance of this parameter
# in configuration is used to determine whether the control interface is
# enabled.
# When configuring both the directory and group, use following format:
# DIR=/var/run/wpa_supplicant GROUP=wheel
# DIR=/var/run/wpa_supplicant GROUP=0
# (group can be either group name or gid)

ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=1010

-----------------------------------------------------------------------------------

第一个参数表明,ap 配置会被最近一次的修改覆盖, 第二个参数指定wpa_supplicant 可被其他系统服务访问的管道以及访问的Group权限是AID_WIFI用户(GROUP=1010)

4. 配置 dhcpc

4.1 修改out/target/product/generic/root/init.rc

mkdir /data/misc/dhcp 0770 dhcp dhcp
chown dhcp dhcp /data/misc/dhcp

service dhcpcd /system/bin/logwrapper /system/bin/dhcpcd -BK -f /system/etc/dhcpcd/dhcpcd-wlan0.confwlan0
disabled
oneshot

4.2 dhcpcd 配置文件 dhcpcd-wlan0.conf

-------------------------------------------------------------------------------

# dhcpcd configuration for Android Wi-Fi interface
# See dhcpcd.conf(5) for details.
interface wlan0

# dhcpcd-run-hooks uses these options.
option subnet_mask, routers, domain_name_servers

--------------------------------------------------------------------------------

更多相关文章

  1. 初学Android
  2. Android(安卓)Touch事件
  3. ImageSpan的使用
  4. Android(安卓)屏幕常亮
  5. Android(安卓)Activity界面切换添加动画特效
  6. Android之SharedPreferences对参数数据的存取
  7. kotlin 对话框_使用Kotlin的Android警报对话框
  8. android 获取Service(服务)的运行状态
  9. android I/DEBUG堆栈信息

随机推荐

  1. Anatomy of an Android Application(中文
  2. Android简明开发教程十一:自定义Adapter显
  3. Android 短信窃听器
  4. 2011.10.12——— android 关于canvas.tr
  5. Android WebView中打开相机拍照和选择相
  6. 二、Android应用的界面编程(六)ProgressBar
  7. 使用SAX或者DOM或者pull解析XML文件
  8. Unity3d调用Anroid(Android(安卓)Studio环
  9. 来电 去电 监控总结
  10. android 数据持久化——File