wl18xx wiki: http://processors.wiki.ti.com/index.php/WL18xx?DCMP=wilink8&HQS=wilink8wiki
编译过程参考: http://processors.wiki.ti.com/index.php/WL18xx_System_Build_Scripts
使用TI的驱动编译脚本编译,R8.4, R8.3 SP1,使用R8.3 SP1.
1. 下载:
user@ubuntu:~$ mkdir utility
user@ubuntu:~$ cd utility
user@ubuntu:~/utility$ git clonegit://github.com/TI-ECS/build-utilites.git
Cloning into 'build-utilites'...
remote: Counting objects: 223, done.
remote: Compressing objects: 100% (176/176), done.
remote: Total 223 (delta 115), reused 145 (delta 40)
Receiving objects: 100% (223/223), 78.98 KiB | 61 KiB/s,done.
Resolving deltas: 100% (115/115), done.
user@ubuntu:~/utility$ ls
build-utilites
user@ubuntu:~/utility$ cd build-utilites/
user@ubuntu:~/utility/build-utilites$ ls
functions scripts wl12xx_build.sh
patches setup-env.sample wl18xx_build_bt.sh wl18xx_build_ble.sh wl18xx_build.sh
README wl12xx_build_bt.sh wlan_enable_config.sh
user@ubuntu:~/utility/build-utilites$
由于使用的kernel版本为3.2,需要设置:
git reset --hard ol_r8.a8.10_32
2. 在setup-env设置环境变量,主要有内核路径,gcc路径,和驱动源码目录
export CROSS_COMPILE="arm-none-linux-gnueabi-"
export PATH="$PATH:/usr/local/arm-2010q1/bin" gcc路径
export ROOTFS=/home/tom/wl18xx_build_utilites/rootfs rootfs目录,执行install时,将驱动copy到这个目录下,编译也需要这个目录下的头文件
exportWORK_SPACE=/home/tom/wl18xx_build_utilites/workspace 源码目录,包括wl18xx驱动,还有其他的源码,我们只关心wl18xx的源码
exportKLIB_BUILD=/home/tom/myd-am335x/kernel/linux-3.2.0-psp04.06.00.08.sdk2linux内核目录
export BUILD_VERSION="r8"
# MACHINE_TYPE - The target machine type. Can have one ofthe following values: "am1808" , "omap3evm" ,"am335x"
# This is needed to build bluetooth components.
# This parameter is not relevant for ti814x board.
export MACHINE_TYPE="am335x" am335x cpu
3. 硬件说明
WLAN_IRQ一定要用,不用会出现错误:
wlcore: ERROR ELP wakeup timeout!
注意WL_EN引脚在VBAT和VIO上电的时候需要是低电平,在内核初始化过程中需要把该引脚拉高,还必须延时100ms左右,否则内核
启动会检测到不wl18xx模块.
4. 修改内核配置和驱动源码
http://processors.wiki.ti.com/index.php/WL18xx_WiFi_Build_Process这里有对内核配置的说明
TI修改了cfg80211和mac80211源码,所以需要配置:
CONFIG_BT=N
CONFIG_CFG80211=N
CONFIG_MAC80211=N
驱动编译的时候也会检查内核配置,如果不符合要求,会有提示.
驱动的WLAN_IRQ使用的是上升沿中断,我们的板加了一个MOS管反相了,中断线平时是高电平,所以需要修改源码,
设置中断类型为下降沿中断:
compat-wireless\drivers\net\wireless\ti\wlcore\main.c
static void wlcore_nvs_cb(const struct firmware *fw, void*context)
{
...
if (wl->platform_quirks &WL12XX_PLATFORM_QUIRK_EDGE_IRQ) {
//irqflags = IRQF_TRIGGER_RISING;
irqflags = IRQF_TRIGGER_FALLING;
printk("WLAN IRQ: Fallinginterrupt\n");
hardirq_fn = wlcore_hardirq;
} else {
irqflags = IRQF_TRIGGER_HIGH |IRQF_ONESHOT;
}
...
需要全编译一次后,才能修改驱动源码,因为全编译之后才会下载源码
5. 编译
第一次先执行一次全编译:
./wl18xx_build.shall
单独编译wl18xx驱动
./wl18xx_build.shwl18xx_modules build //编译
./wl18xx_build.shwl18xx_modules install //将驱动安装到rootfs目录下
源码目录:
compat-wireless是wl18xx驱动,./wl18xx_build.shwl18xx_modules build会先将该目录删除,再解压新的源码,
所以如果需要修改源码,需要修改编译脚本(wl18xx_build.sh):
6. 驱动加载
执行./wl18xx_build.shwl18xx_modules install之后,会将驱动模块安装到rootfs/lib/modules/3.2.0目录下:
驱动在updates目录下,用到的驱动文件有compat.komac80211.ko cfg80211.ko wlcore.ko wlcore_sdio.ko wl18xx.ko,
驱动的依赖关系modules.dep文件中有说明,加载顺序:
insmodcompat.ko
insmodcfg80211.ko
insmodmac80211.ko
insmodwlcore.ko
insmodwl18xx.ko
insmodwlcore_sdio.ko
6. 连网
得使用rootfs/usr/sbin目录下的wpa_supplicant去连
wpa_supplicant-i wlan0 -c /etc/wpa_supplicant.conf -Dnl80211 -B,
注意不能使用参数-Dwext