Android Wifi Driver Porting

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.conf wlan0
    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

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

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/stevenliyong/archive/2010/03/19/5395223.aspx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值