大家好。 我想问一个驱动开发基础点的问题。 本人写了一个简单的驱动测试,在arm-linux上面跑,现在编译的时候有一些问题。 我用的编译器arm-linux-gcc,arm是s3c2410的,我现在直接这样去编译是可以的: arm-linux-gcc -c hello.c 这样编译出来的模块总觉得不妥,本来觉得应该include的是内核树里的东西啊,现在感觉include的是 arm-linux-gcc里面的,但我这样编译确实是通不过: arm-linux-gcc -Wall -D__KERNEL__ -DMODULE -I/ARMs3c2410/kernel/include -O2 -c -o Hello.o Hello.c 报错如下: In file included from /ARMs3c2410/kernel/include/linux/kernel.h:13, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/system.h:69, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/atomic.h:130, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/processor.h:25, from /ARMs3c2410/kernel/include/linux/prefetch.h:13, from /ARMs3c2410/kernel/include/linux/list.h:6, from /ARMs3c2410/kernel/include/linux/module.h:12, from Hello.c:9: /ARMs3c2410/kernel/include/linux/types.h:14: error: parse error before "dev_t" In file included from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/page.h:27, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/cpu-single.h:36, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/proc-fns.h:152, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/system.h:90, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/atomic.h:130, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/processor.h:25, from /ARMs3c2410/kernel/include/linux/prefetch.h:13, from /ARMs3c2410/kernel/include/linux/list.h:6, from /ARMs3c2410/kernel/include/linux/module.h:12, from Hello.c:9: /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/glue.h:111:2: #error Unknown data abort handler type In file included from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/cpu-single.h:36, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/proc-fns.h:152, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/system.h:90, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/atomic.h:130, from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/processor.h:25, from /ARMs3c2410/kernel/include/linux/prefetch.h:13, from /ARMs3c2410/kernel/include/linux/list.h:6, from /ARMs3c2410/kernel/include/linux/module.h:12, from Hello.c:9: /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/asm/page.h:96:2: #error Unknown user operations model Hello.c:41: warning: parameter names (without types) in function declaration Hello.c:41: warning: data definition has no type or storage class Hello.c:42: warning: parameter names (without types) in function declaration Hello.c:42: warning: data definition has no type or storage class
请问如何解决这个问题呢,难道编译驱动不用本生的内核树? 谢谢 |