我往linux內核裡添加一個驅動模塊,根據《linux設備驅動》第三版,修改Makefile如下:
obj-m := GobiNet.o GobiNet-objs := GobiUSBNet.o QMIDevice.o QMI.o但是出現了如下錯誤:
/home/sylvain/Projects/android_gingerbread_realv210_ver_1_0/kernel CHK include/linux/version.h CHK include/generated/utsrelease.h make[1]: `include/generated/mach-types.h' is up to date. CALL scripts/checksyscalls.sh CHK include/generated/compile.h LD drivers/cell/OptionGobiNet/built-in.o CC [M] drivers/cell/OptionGobiNet/GobiUSBNet.o CC [M] drivers/cell/OptionGobiNet/QMIDevice.o CC [M] drivers/cell/OptionGobiNet/QMI.o LD [M] drivers/cell/OptionGobiNet/GobiNet.o Kernel: arch/arm/boot/Image is ready SHIPPED arch/arm/boot/compressed/lib1funcs.S AS arch/arm/boot/compressed/lib1funcs.o LD arch/arm/boot/compressed/vmlinux OBJCOPY arch/arm/boot/zImage Kernel: arch/arm/boot/zImage is ready Building modules, stage 2. MODPOST 5 modules ERROR: "usbnet_suspend" [drivers/cell/OptionGobiNet/GobiNet.ko] undefined! ERROR: "usbnet_resume" [drivers/cell/OptionGobiNet/GobiNet.ko] undefined! ERROR: "usbnet_disconnect" [drivers/cell/OptionGobiNet/GobiNet.ko] undefined! ERROR: "usbnet_probe" [drivers/cell/OptionGobiNet/GobiNet.ko] undefined! make[1]: *** [__modpost] Error 1 make: *** [modules] Error 2編譯過程中生成了"GobiNet.mod.c"和"GobiNet.o",但是並沒有生成GobiNet.ko文件。
我誤解了錯誤信息,沒有清楚ko生成過程。編譯模塊在鏈接過程中查找外部符號表,但並沒有找到,因為該外部符號表並沒有編譯。
根據以上分析,我查看了外部符號在drivers/net/usb/usbnet.c文件,這就需要配置.config文件中設置CONFIG_USBNET=y。
希望對大家有所幫助。
英文地址:http://stackoverflow.com/questions/7812418/kernel-driver-external-modules-not-building-completely
AIX 5L "From Strength to Strength"
OS大戰之Windows Vista && Windows 7&& Ubuntu 8.10
linux系統安裝文件&&安裝過程分析&&kickstart文件分析
"fatal: protocol error: bad line length character: No This",fatallength
JDK介紹 && Linux下JDK 環境變量設置