USB无线网卡的嵌入式Linux驱动移植 - 手记
应用场景:嵌入式Linux开发板要通过wifi上网,需要一个无线网卡和在开发板上加载安装相应的驱动。
【参考资料:】
USB无线网卡的Linux驱动移植:
http://www.eefocus.com/embedded/316975
FS210无线网卡驱动移植:
http://www.embedu.org/Column/Column781.htm
瑞昱RTL8188cus 无线网卡驱动移植:
http://yangguangnanhai686.blog.163.com/blog/static/213779100201211103152226/
RT73 wifi无线网卡驱动移植过程:
http://blog.csdn.net/farsight2009/article/details/5660878
http://www.cnitblog.com/zouzheng/archive/2007/11/16/36358.html
嵌入式Linux下面的网卡驱动移植:
http://www.yeolar.com/note/2009/05/20/embedded-linux-card-driver/
======= 个人手记 =============
通过阅读上述资料,加载驱动程序有两种方法:
1. Host Linux上编译完成.ko文件,下载到开发板,insmod命令,现加载。
2. Host Linux上编译完成.ko文件,编译内核,将新的Kernel烧写到开发板。
目测第1种方法比较省事,先搞第1种罢。
****修改Makefile
命令:
# vim Makefile
打开Makefile,参考《USBwifi驱动程序for linux快速编译和安装指南》,作如下修改:
1. PC y -> PC n
2. S3C2K4 n -> S3C2K4y
3. CROSS_COMPILE := /usr/local/arm/4.3.2/bin/arm-linux-gcc
(这里前提是安装了交叉编译器http://blog.chinaunix.net/uid-22342877-id-1774722.html)
4. KSRC := /root/linux-2.6.32.2
修改完后应该是:
--------------------------这是分割线-----
ifeq ($(CONFIG_PLATFORM_ARM_S3C2K4), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := /usr/local/arm/4.3.2/bin/arm-linux-
【尽管交叉编译器是arm-linux-gcc等其它】
#KVER := 2.6.24.7_$(ARCH)
#KSRC := /usr/src/kernels/linux-$(KVER)
KSRC := /root/linux-2.6.32.2
endif
--------------------------那是分割线-----
****编译
它说此时就可以编译了(http://yangguangnanhai686.blog.163.com/blog/static/213779100201211103152226/)
执行编译命令:
# ./make
得到如下错误提示:
# make
make ARCH=arm CROSS_COMPILE=/usr/local/arm/4.3.2/bin/arm-linux- -C /root/linux-2.6.32.2
M=/root/Downloads/rtl8188EUS_rtl8189ES_linux_v4.1.2_4787.20120803 modules
make[1]: Entering directory `/root/linux-2.6.32.2'
ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /root/linux-2.6.32.2/Module.symvers
is missing; modules will have no dependencies and modversions.
Building modules, stage 2.
/root/linux-2.6.32.2/scripts/Makefile.modpost:42: include/config/auto.conf: No such file or directory
make[2]: *** No rule to make target `include/config/auto.conf'. Stop.
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/root/linux-2.6.32.2'
make: *** [modules] Error 2
-----------------------------------------------888888888888-------------------
又修改了Makefile,修改完后应该是:
--------------------------这是分割线-----
ifeq ($(CONFIG_PLATFORM_ARM_S3C2K4), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := /usr/local/arm/4.3.2/bin/arm-linux-
#KVER := 2.6.24.7_$(ARCH)
#KSRC := /usr/src/kernels/linux-$(KVER)
#KSRC := /root/linux-2.6.32.2
KSRC := /usr/src/kernels/2.6.35.6-45.fc14.i686【我怀疑是这里的问题】
endif
--------------------------这是分割线-----
继续编译,继续出错:
# make
make ARCH=arm CROSS_COMPILE=/usr/local/arm/4.3.2/bin/arm-linux- -C /usr/src/kernels/2.6.35.6-45.fc14.i686 M=/root/Downloads/rtl8188EUS_rtl8189ES_linux_v4.1.2_4787.20120803 modules
make[1]: Entering directory `/usr/src/kernels/2.6.35.6-45.fc14.i686'
make[2]: *** No rule to make target `/root/Downloads/rtl8188EUS_rtl8189ES_linux_v4.1.2_4787.20120803/core/rtw_cmd.o', needed by `/root/Downloads/rtl8188EUS_rtl8189ES_linux_v4.1.2_4787.20120803/RTL8188ETV.o'. Stop.
make[1]: *** [_module_/root/Downloads/rtl8188EUS_rtl8189ES_linux_v4.1.2_4787.20120803] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.35.6-45.fc14.i686'
make: *** [modules] Error 2
【编译驱动之前,需要一个完整编译好的内核。如果没有,则会先花费大量时间编译好一个内核,再编译驱动。】