There is bcm4329 driver/firmware exist under ..'hardware/broadcom'.
It seems support different hw port. Is there a programing gudie document about it?
Does anybody has experience to build and enable wifi on imx51 android solution throung SDIO?
Wondering (outloud) if you got this working on your system....Any tips & pitfalls would be MUCH appreciated!
Thanks!
(1)wifi based on BCM4329 module should be connected to sdio interface on i.mx51.
(2)Compile wifi driver from Broadcom and get a .ko file(such as dhd.ko).
(3)Open nvram.txt and modify crystal (for example, you use 38.4MHz on hardware,then xtalfreq=38400)
(4)copy dhd.ko to /opt/nfsroot/system/lib/modules
(5)copy sdio-bcm4329-dhd.bin(firmware) and nvram.txt to /opt/nfsroot/system/lib/modules
(6)enter ~/android22/kernel_imx/drivers/mmc/core and find sdio.c file
search whether there is the following function, if not , please search it on website(google)
int sdio_reset_comm(struct mmc_card *card)
{
}
EXPORT_SYMBOL(sido_reset_comm);
(7)configure linux kernel
a. choose Device driver-->Network driver support-->Wireless LAN
[*]Wireless Lan
[*]IEEE802.11 For Host AP
[*]Support downloading firmware images with host AP driver.
[*] Support for non-volatile firmware download
b.choose Networking support-->Wireless
[*] old wireless static regulatory definitions
[*] wireless extensions sysfs files
(8) load driver
#/system/bin/insmod /system/lib/modules/dhd.ko "firmware_path=/system/etc/wifi/sdio-bcm4329-dhd.bin
nvram_path=/system/etc/wifi/nvram.txt"
The following will display :
/#DHD: dongle ram size is set to 294912(orig 294912)
Firmware version = wl0: Aug 11 2010 13:21:15 version 4.218.243.1
eth1: Broadcom Dongle Host Driver mac=00:26:37:a4:f7:e7
Enter wl_control_wl_start
Exited wl_control_wl_start
<-------How to debug wifi on linux command line -------------------->
customer can use "wireless-tools" to debug wifi network. this tool can be downloaded from internet. after compliling, some tools can be got :
frename iwconfig iwevent iwgetid iwlist iwpriv iwspy
**Use "iwconfig" to set AP ( router)
#iwconfig eth1 mode Managed
#iwconfig eth1 key 1234567890
#iwconfig eth1 key open
#iwconfig eth1 essid TP-LINK_432F1A
**Get DHCP Address
#/system/bin/dhcpcd eth1
**Search AP
#iwlist eth1 scan
Cell 01 - Address: 00:23:CD:43:2F:1A
ESSID:"TP-LINK_432F1A"
Cell 02 - Address: 00:23:CD:5D:56:66
ESSID:"TP-LINK_789"
******Customer can also use "wpa_supplicant" to test BCM4329"
A. Configure wpa_supplicant.conf file
Open /opt/nfsroot/system/etc/wifi/wpa_supplicant.conf and add the following lines:
ctrl_interface=DIR=/data/misc/wifi/wpa_supplicant GROUP=wifi
ap_scan=1
update_config=1
B. Run wpa_supplicant service by back
#/system/bin/wpa_supplicant -B -Dwext -ieth1 -c/data/misc/wifi/wpa_supplicant.conf
C. Run wpa_cli to connect AP
# wpa_cli –i eth1
>add_network
0
> set_network 0 ssid "TP-LINK_432F1A"
OK
> set_network 0 wep_key2 "1234567890"
OK
> enable_network 0
OK
>q
****************************For android2.2 based on i.mx51******************************
(1) Adjust init.rc file
At position "prepare for wifi", to add:
(1)在prepare for wifi 处添加目录并修改权限
setprop wifi.interface eth1
mkdir /data/misc/wifi/sockets 0777 wifi wifi
mkdir /data/misc/dhcp 0777 dhcp dhcp
mkdir /data/misc/wifi 0777 wifi wifi
mkdir /system/etc/wifi 0777 wifi wifi
mkdir /data/system/wpa_supplicant 0771 wifi wifi
mkdir /data/misc/wifi/wpa_supplicant 0771 wifi wifi
chmod 0777 /data/misc
chmod 0777 /data/misc/wifi
chmod 0777 /data/misc/wifi/wpa_supplicant.conf
chmod 0771 /system/etc/wifi
chmod 0777 /system/etc/wifi/wpa_supplicant.conf
chmod 0777 /data/system/wpa_supplicant
chmod 0777 /data/misc/wifi/wpa_supplicant
chmod 0777 /system/etc/dhcpcd
chmod 0777 /system/etc/dhcpcd/dhcpcd-hooks
chown wifi wifi data/system/wpa_supplicant
chown wifi wifi /system/etc/wifi/wpa_supplicant.conf
chown dhcp dhcp /data/misc/dhcp
chown wifi wifi /data/misc/wifi/wpa_supplicant
chown dhcp dhcp /system/etc/dhcpcd
chown dhcp dhcp /system/etc/dhcpcd/dhcpcd-hooks
(2)Modify wpa_supplicant and DHCP service
service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant -d -B -Dwext -ieth1 -c/data/misc/wifi/wpa_supplicant.conf
user root
group wifi inet
socket wpa_eth1 dgram 777 wifi wifi
disable
oneshot
service dhcpcd /system/bin/logwrapper /system/bin/dhcpcd -d -B eth1
user root
group system dhcp wifi
disabled
oneshot
(3)modify HAL for wifi .
Open android/hardware/libhardware_legacy/wifi/wifi.c and add:
#ifndef WIFI_DRIVER_MODULE_PATH
#define WIFI_DRIVER_MODULE_PATH "/system/lib/modules/dhd.ko"
#endif
#ifndef WIFI_DRIVER_MODULE_NAME
#define WIFI_DRIVER_MODULE_NAME "dhd"
#endif
#ifndef WIFI_DRIVER_MODULE_ARG
#define WIFI_DRIVER_MODULE_ARG "firmware_path=/system/etc/wifi/sdio-bcm4329-dhd.bin
nvram_path=/system/etc/wifi/nvram.txt"
#endif
#ifndef WIFI_FIRMWARE_LOADER
#define WIFI_FIRMWARE_LOADER ""
#endif
#define WIFI_TEST_INTERFACE "eth1"
#define WIFI_DRIVER_LOADER_DELAY 5000000
static const char IFACE_DIR[] = "/mywifi";/*这里填一个不存在的文件目录*/
static const char DRIVER_MODULE_NAME[] = WIFI_DRIVER_MODULE_NAME;
static const char DRIVER_MODULE_TAG[] = WIFI_DRIVER_MODULE_NAME " ";
static const char DRIVER_MODULE_PATH[] = WIFI_DRIVER_MODULE_PATH;
static const char DRIVER_MODULE_ARG[] = WIFI_DRIVER_MODULE_ARG;
static const char FIRMWARE_LOADER[] = WIFI_FIRMWARE_LOADER;
static const char DRIVER_PROP_NAME[] = "wlan.driver.status";
static const char SUPPLICANT_NAME[] = "wpa_supplicant";
static const char SUPP_PROP_NAME[] = "init.svc.wpa_supplicant";
static const char SUPP_CONFIG_TEMPLATE[]= "/system/etc/wifi/wpa_supplicant.conf";
static const char SUPP_CONFIG_FILE[] = "/data/misc/wifi/wpa_supplicant.conf";
static const char MODULE_FILE[] = "/proc/modules";
(4) modify android/device/fsl/imx51_bbg/BoardConfig.mk file
BOARD_WPA_SUPPLICANT_DRIVER := WEXT
HAVE_CUSTOM_WIFI_DRIVER_2 :=false
WIFI_DRIVER_MODULE_PATH := /system/lib/modules/dhd.ko
WIFI_DRIVER_MODULE_NAME :=”dhd”
WIFI_DRIVER_MODULE_ARG :=”firmware_path=/system/etc/wifi/ sdio-bcm4329-dhd.bin nvram_path=/system/etc/wifi/nvram.txt”
(5)modify frameworks/base/wifi/java/android/net/wifi/WifiStateTracker.java file
mInterfaceName = SystemProperties.get("wifi.interface", "tiwlan0");
>>mInterfaceName = SystemProperties.get("wifi.interface", "eth1");
(6)modify android/build/target/board/generic/system.prop
add : wifi.interfae=eth1
(7)modify android/external/wpa_supplicant/wpa_supplicant.conf :
ctrl_interface=eth1
update_config=1
ap_scan=1
(8) configure AP and delete password .
(9) compile android source code.
(10) That is ok.
Maybe it seems very complex , acturally it is not difficult.