打印

关于arm-linux编译驱动的一些问题

[复制链接]
2319|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
rEap|  楼主 | 2007-12-24 19:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
大家好。 
                我想问一个驱动开发基础点的问题。 
                本人写了一个简单的驱动测试,在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 

请问如何解决这个问题呢,难道编译驱动不用本生的内核树? 
谢谢

相关帖子

沙发
阿南| | 2007-12-24 21:02 | 只看该作者

楼主可以下载《嵌入式linux入门笔记》,里面有介绍

使用特权

评论回复
板凳
rEap|  楼主 | 2007-12-24 22:53 | 只看该作者

恩,我参看了一下,也试了,但还有问题,如下:

我刚试了一下,我加上那个__KERNEL__就会报错,不加的话就可以的。
您能帮我解释一下具体原因吗?谢谢

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

5

主题

13

帖子

1

粉丝