转自:http://blog.csdn.net/diandianyangyi/article/details/39202255
使用一个驱动,也大费周折。
闲话不说,直接进入正题。
【问题说明】
自己使用的驱动为DPA_MT7601U_LinuxSTA_3.0.0.4_20130916 ,而这个驱动编译使用为sta模式是正常的,可以使用的。
但是公司的产品要求无线网卡可以完成AP模式和STA模式进行切换,那么这个,不知道难道多大,至少我没有配置过ap模式使用。
根据雷凌以前的产品看,ap模式的还要单独的编译驱动。 因此将此上面的驱动修改配置后,编译信息如下:
在文件config.mk 中 HAS_HOSTAPD_SUPPORT=y 在文件 Makefile.inc 中 ifeq ($(WIFI_MODE),) RT28xx_MODE = AP else RT28xx_MODE = $(WIFI_MODE) endif 平台,内核路径,编译器都已经正确指定了。 编译信息如下。
make -C UTIL/ osutil make[1]: Entering directory `/home/swchen/osdrv/kernel/mt7601/UTIL' cp -f os/linux/Makefile.6.util /home/swchen/osdrv/kernel/mt7601/UTIL/os/linux/Makefile make -C /home/swchen/osdrv/kernel/linux-3.0.y SUBDIRS=/home/swchen/osdrv/kernel/mt7601/UTIL/os/linux modules make[2]: Entering directory `/home/swchen/osdrv/kernel/linux-3.0.y' Building modules, stage 2. MODPOST 1 modules make[2]: Leaving directory `/home/swchen/osdrv/kernel/linux-3.0.y' make[1]: Leaving directory `/home/swchen/osdrv/kernel/mt7601/UTIL' /bin/sh cp_util.sh make -C MODULE/ build_tools make[1]: Entering directory `/home/swchen/osdrv/kernel/mt7601/MODULE' make -C tools make[2]: Entering directory `/home/swchen/osdrv/kernel/mt7601/MODULE/tools' gcc -g bin2h.c -o bin2h make[2]: Leaving directory `/home/swchen/osdrv/kernel/mt7601/MODULE/tools' /home/swchen/osdrv/kernel/mt7601/MODULE/tools/bin2h make[1]: Leaving directory `/home/swchen/osdrv/kernel/mt7601/MODULE' make -C MODULE/ osdrv make[1]: Entering directory `/home/swchen/osdrv/kernel/mt7601/MODULE' cp -f os/linux/Makefile.6 /home/swchen/osdrv/kernel/mt7601/MODULE/os/linux/Makefile make -C /home/swchen/osdrv/kernel/linux-3.0.y SUBDIRS=/home/swchen/osdrv/kernel/mt7601/MODULE/os/linux modules make[2]: Entering directory `/home/swchen/osdrv/kernel/linux-3.0.y' make[3]: *** No rule to make target `/home/swchen/osdrv/kernel/mt7601/MODULE/os/linux/../../ap/ap_cfg.o', needed by `/home/swchen/osdrv/kernel/mt7601/MODULE/os/linux/mt7601Uap.o'. Stop. make[2]: *** [_module_/home/swchen/osdrv/kernel/mt7601/MODULE/os/linux] Error 2 make[2]: Leaving directory `/home/swchen/osdrv/kernel/linux-3.0.y' make[1]: *** [osdrv] Error 2 make[1]: Leaving directory `/home/swchen/osdrv/kernel/mt7601/MODULE' make: *** [all] Error 2
也就是需要的文件ap_cfg.c 这个文件并不存在。所以咨询了对方的支持,得到的答复是:
MT7601 的驱动分两种, AP 和 STA 模式分别是两个驱动包
故而得到了对方提供的驱动,MT7601U_LinuxAP_3.0.0.1_20130802.tar.bz2 ,下载链接如下:
http://download.csdn.net/detail/diandianyangyi/7894443
【重新编译】
类似,同样指定了平台和指定了交叉编译器和内核路径之后,直接make。 却得到了错误信息:
make -C tools make[1]: Entering directory `/home/swchen/mt7601/MT7601U_LinuxAP_3.0.0.1_20130802/tools' gcc -g bin2h.c -o bin2h make[1]: Leaving directory `/home/swchen/mt7601/MT7601U_LinuxAP_3.0.0.1_20130802/tools' /home/swchen/mt7601/MT7601U_LinuxAP_3.0.0.1_20130802/tools/bin2h cp -f os/linux/Makefile.6 /home/swchen/mt7601/MT7601U_LinuxAP_3.0.0.1_20130802/os/linux/Makefile make -C /home/swchen/osdrv/kernel/linux-3.0.y SUBDIRS=/home/swchen/mt7601/MT7601U_LinuxAP_3.0.0.1_20130802/os/linux modules make[1]: Entering directory `/home/swchen/osdrv/kernel/linux-3.0.y' CC [M] /home/swchen/mt7601/MT7601U_LinuxAP_3.0.0.1_20130802/os/linux/../../os/linux/rt_profile.o /home/swchen/mt7601/MT7601U_LinuxAP_3.0.0.1_20130802/os/linux/../../os/linux/rt_profile.c:26: fatal error: rt_config.h: No such file or directory compilation terminated. make[2]: *** [/home/swchen/mt7601/MT7601U_LinuxAP_3.0.0.1_20130802/os/linux/../../os/linux/rt_profile.o] Error 1 make[1]: *** [_module_/home/swchen/mt7601/MT7601U_LinuxAP_3.0.0.1_20130802/os/linux] Error 2 make[1]: Leaving directory `/home/swchen/osdrv/kernel/linux-3.0.y' make: *** [LINUX] Error 2
找不到rt_config.h 这个头文件!!!!
但是代码中是有这个文件的呀。难道是哪里路径指定不对么?思量不过,就拿网上下载的雷凌其他ap驱动编译通过的进行比较。
折腾了一天之后,定位到os\Linux \config.mk中,有一句有些差别。
于是在自己的os\linux\config.mk中添加了下一句,主要还是来源于 http://www.arm9home.net/simple/index.php?t24610.html 的启发。
ifeq ($(PLATFORM),HISI_3518C) EXTRA_CFLAGS := -D__KERNEL__ -DMODULE $(WFLAGS) export EXTRA_CFLAGS endif
因为驱动并没有说明支持海思的平台,前头在驱动的根目录Makefile里,自己重新指定了平台。
PLATFORM = HISI_3518C ifeq ($(PLATFORM),HISI_3518C) LINUX_SRC = $(HOME)/osdrv/kernel/linux-3.0.y CROSS_COMPILE = /opt/hisi-linux-nptl/arm-hisiv100-linux/target/bin/arm-hisiv100nptl-linux- export ARCH=arm endif
但是没有添加上编译的条件。总之折腾完了,下一步看ap模式的使用了。
这样看来,生成的驱动不同,那么使用不同模式的wifi,就得更替驱动了,也挺麻烦的。