您的位置:首页 > 运维架构 > Linux

Linux wifi移植

2015-03-18 19:33 148 查看
Linux wifi移植

wpa_supplicant-0.7.3 WIFI 服务端程序

wpa_supplicant包含两个主要的可执行工具:wpa_supplicant和wpa_cli。wpa_supplicant是核心程序。

它和wpa_cli的关系就是服务和客户端的关系:后台运行wpa_supplicant,使用wpa_cli来搜索、设置、和连接网络。

无线网卡驱动 DPO_RT5572_LinuxSTA_2.6.1.3_20121022 编译网卡驱动 1:修改解压目录的Makefile文件 set the "MODE = STA" set "TARGET = LINUX" ifeq ($(PLATFORM),xxxxx) //可以自定义平台名称 LINUX_SRC := linux //linux 目录 CROSS_COMPILE = arm-linux- //交叉编译 Endif 2:修改os/linux/config.mk文件 HAS_WPA_SUPPLICANT=y HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y ifeq ($(PLATFORM),xxxxx) EXTRA_CFLAGS := -D__KERNEL__   -I$(RT28xx_DIR)/include \   -I$(LINUX_SRC)/include \   -Wall -Wstrict-prototypes -Wno-trigraphs \   -O2 -fno-strict-aliasing -fno-common \   -Uarm -fno-common -pipe \ -D__LINUX_ARM_ARCH__=7 \ //跟实际平台相匹配   -march=armv7-a -Wa,\ //CPU型号    -DMODVERSIONS \   $(WFLAGS)export export EXTRA_CFLAGS endif 3:编译遇到下面问题 : error: unknown field 'private' specified in initializer /os/linux/sta_ioctl.c:2386:2: warning: initialization from incompatible pointer type /os/linux/sta_ioctl.c:2387:2: error: unknown field 'num_private' specified in initializer /os/linux/sta_ioctl.c:2387:2: warning: excess elements in struct initializer /os/linux/sta_ioctl.c:2387:2: warning: (near initialization for 'rt28xx_iw_handler_def') /os/linux/sta_ioctl.c:2388:2: error: unknown field 'private_args' specified in initializer /os/linux/sta_ioctl.c:2388:26: warning: excess elements in struct initializer /os/linux/sta_ioctl.c:2388:26: warning: (near initialization for 'rt28xx_iw_handler_def') /os/linux/sta_ioctl.c:2389:2: error: unknown field 'num_private_args' specified in initializer /os/linux/sta_ioctl.c:2389:2: warning: excess elements in struct initializer /os/linux/sta_ioctl.c:2389:2: warning: (near initialization for 'rt28xx_iw_handler_def') os/linux/../../os/linux/sta_ioctl.o] Error 1 可以用下面的方法解决: 进入linux 内核 #make menuconfig 进行选择 Device Drivers==> Network deivce support==> Wireless LAN==> <*> USB ZD1201 based Wireless device support, 编译即可 sysctl -w coherent_pool= kernel parameter! 0100 0100 0000 0000 0000 0000 0000 0000 16 x 16 x 16 x 16 x 16 4:查看无线网卡的详解信息 cat /proc/net/wireless ifconfig ra0 up 报下面的错误 RtmpAsicLoadFirmware: ver 21/21, sum cdf7/cdf7, mac cdf72100 ifconfig: ioctl 0x8914 failed: Operation not permitted wireless_tools.29 无线网卡工具,主要用来获取无线网卡的状态信息。 insmod rt5572sta.ko rtusb init rt2870 ---> 后台运行程序 wpa_supplicant -Dwext -c/etc/wpa_supplicant.conf -ira0 PLATFORM = BROADCOM7252D1 读取网络文件 #define PROC_NET_WIRELESS "/proc/net/wireless" 需要将以下文件拷贝到 /etc/Wireless/RT2870STA目录下 RT2870STA.dat RT2870STACard.dat rt2870.bin 配置文件 /etc/wpa_supplicant.conf 里面的内容为 ctrl_interface=/var/run/wpa_supplicant ap_scan=1 插上USB WIFI后报下面的错误 # insmod rt5572sta.ko rtusb init rt2870 ---> usbcore: registered new interface driver rt2870 # usb 1-1: new high-speed USB device number 2 using ehci-brcm ERROR: 256 KiB atomic DMA coherent pool is too small! Please increase it with coherent_pool= kernel parameter! ifconfig: ioctl RtmpAsicLoadFirmware: ver 21/21, sum cdf7/cdf7, mac cdf72100 0x8914 failed: Operation not permitted [NetMgrWifi.cpp:558]Cmd(ifconfig ra0 up) ret 256 [NetMgrWifi.cpp:562]iRet=27 RtmpAsicLoadFirmware: ver 21/21, sum cdf7/cdf7, mac cdf72100 Could not set interface ra0 flags: Operation not permitted Failed to initialize driver interface [NetMgrWifi.cpp:599]WaitFor_WpaSupplicant_Start failed 内核参数的查看方法 sysctl -a 内核参数的的设置方法 sysctl -w 参数名=值 vi ./arch/arm/mm/dma-mapping.c early_param("coherent_pool", early_coherent_pool); #define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_150K 将SZ_150K改为SZ_2M,改了这个参数就OK啦 # modprobe rt5572sta.ko modprobe: can't change directory to xxx': No such file or director linux设备驱动的动态加载可以使用insmod或modprobe两种方式, insmod一次只能加载一个特定的驱动,且需要驱动的绝对路径, 而modprobe则可以一次性将有依赖关系的驱动全部加载到内核, 不需要驱动的具体地址。但需要将驱动拷贝到/lib/modules/$(uname -r)/目录下, 下面我们以前面的蜂鸣器驱动为例,分别介绍两种加载方法。 新建/lib/modules/xxx目录报以下错误 # modprobe rt5572sta modprobe: can't open 'modules.dep': No such file or directory 提示找不到modules.dep文件。我们不需要手动创建该文件,使用depmod指令即可自动生成。 # depmod depmod: applet not found 报这种错误,是depmod没有被编译到busbox里。 Linux Module Utilities --->   insmod   [*] rmmod   [*] lsmod   [*] Pretty output   [*] modprobe   [*] depmod 将编译的busybox拷贝到 romfs/bin/busybox / -->/bin/busybox ./romfs/sbin/depmod -->./sbin/depmod 加载驱动还会报下面的错误 # modprobe rt5572sta modprobe: module rt5572sta not found in modules.dep 这里提示在modules.dep文件中没有发现我们加载的ko文件,我们尝试查看一下modules.dep的内容: 里面的内容为空。实际上,depmod指令会自动分析/lib/modules/$(uname -r)目录下的可加载模块, 并按照固定的格式填入modules.dep中。因此,我们可以先将需要加载的ko文件拷贝到对应的目录, 再执行depmod指令。 文件就会出现下面的内容 rt5572sta.ko: 查看这个文件是否生成/var/run/wpa_supplicant 可以判断wpa_supplicant是否正常运行。 编译wpa_supplicant-0.7.3 usr/sbin/wpa_supplicant usr/sbin/wpa_cli 拷贝到板子上的/usr/sbin目录下 将wpa_supplicant.conf文件拷贝到/etc目录下
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: