3222|2

74

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

arm linux驱动make发生的错误,大家帮忙看看 [复制链接]

编的一个驱动,用的是2.6.22内核,交叉编译器是arm-linux-gcc 3.4.1。
下面是我的makefile文件:
KERNELDIR :=/home/arm/linux-2.6.22.19
PWD :=$(shell pwd)
CFLAGS =-D__KERNEL__ -DMODULE -I$(KERNELDIR)/include/
CROSS_COMPILE =/home/arm/3.4.1/bin/arm-linux-
CC =$(CROSS_COMPILE)gcc

obj-m := mydev_driver.o

mydev_driver.o : s3c2440_mydev.o
        $(CC) $(CFLAGS) -c  $^ -o $@

modules:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
        rm -rf *.o *.ko *.mod.o *.mod.c

make的时候,提示的错误信息如下:
debian:/home/arm-drivers/mydev-drviver# make
/home/arm/3.4.1/bin/arm-linux-gcc -D__KERNEL__ -DMODULE -I/home/arm/linux-2.6.22.19/include/   -c -o s3c2440_mydev.o s3c2440_mydev.c
In file included from /home/arm/linux-2.6.22.19/include/linux/notifier.h:14,
                 from /home/arm/linux-2.6.22.19/include/linux/memory_hotplug.h:7,
                 from /home/arm/linux-2.6.22.19/include/linux/mmzone.h:466,
                 from /home/arm/linux-2.6.22.19/include/linux/gfp.h:4,
                 from /home/arm/linux-2.6.22.19/include/linux/slab.h:14,
                 from /home/arm/linux-2.6.22.19/include/linux/percpu.h:5,
                 from /home/arm/linux-2.6.22.19/include/asm-generic/local.h:4,
                 from /home/arm/linux-2.6.22.19/include/asm/local.h:1,
                 from /home/arm/linux-2.6.22.19/include/linux/module.h:19,
                 from s3c2440_mydev.h:7,
                 from s3c2440_mydev.c:1:
/home/arm/linux-2.6.22.19/include/linux/rwsem.h:24:65: asm/rwsem.h: No such file or directory
In file included from /home/arm/linux-2.6.22.19/include/linux/memory_hotplug.h:7,
                 from /home/arm/linux-2.6.22.19/include/linux/mmzone.h:466,
                 from /home/arm/linux-2.6.22.19/include/linux/gfp.h:4,
                 from /home/arm/linux-2.6.22.19/include/linux/slab.h:14,
                 from /home/arm/linux-2.6.22.19/include/linux/percpu.h:5,
                 from /home/arm/linux-2.6.22.19/include/asm-generic/local.h:4,
                 from /home/arm/linux-2.6.22.19/include/asm/local.h:1,
                 from /home/arm/linux-2.6.22.19/include/linux/module.h:19,
                 from s3c2440_mydev.h:7,
                 from s3c2440_mydev.c:1:
/home/arm/linux-2.6.22.19/include/linux/notifier.h:62: error: field `rwsem' has incomplete type
In file included from /home/arm/linux-2.6.22.19/include/linux/sched.h:51,
                 from /home/arm/linux-2.6.22.19/include/asm/uaccess.h:14,
                 from s3c2440_mydev.h:13,
                 from s3c2440_mydev.c:1:
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:33:3: #error You lose.
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
/home/arm/linux-2.6.22.19/include/linux/jiffies.h:225:31: division by zero in #if
In file included from /home/arm/linux-2.6.22.19/include/asm/uaccess.h:14,
                 from s3c2440_mydev.h:13,
                 from s3c2440_mydev.c:1:
/home/arm/linux-2.6.22.19/include/linux/sched.h:339: error: field `mmap_sem' has incomplete type
In file included from mac_headers.h:66,
                 from s3c2440_mydev.h:33,
                 from s3c2440_mydev.c:1:
2440_headers/2440lib.h:19:1: warning: "min" redefined
In file included from /home/arm/linux-2.6.22.19/include/linux/spinlock.h:53,
                 from /home/arm/linux-2.6.22.19/include/linux/module.h:9,
                 from s3c2440_mydev.h:7,
                 from s3c2440_mydev.c:1:
/home/arm/linux-2.6.22.19/include/linux/kernel.h:285:1: warning: this is the location of the previous definition
In file included from mac_headers.h:66,
                 from s3c2440_mydev.h:33,
                 from s3c2440_mydev.c:1:
s3c2440_mydev.c: At top level:
s3c2440_mydev.c:225: error: storage size of `s3c2440_mydev_fops' isn't known
make: *** [s3c2440_mydev.o] Error 1

还有一些warning没列出来。
s3c2440_mydev.h中包含的前几个头文件是:
#include
#include
#include
#include
#include   
#include
#include

我已经指定了内核源码的路径了,为什么会有这些错误呢?提示的错误都是在发生在内核代码里面。
2.6下驱动编译还能用-D__KERNEL__ -DMODULE选项吗?我把这个选项去掉错误就更多了。
大家帮忙看看,谢谢!


此帖出自Linux开发论坛

最新回复

遇到过和lz相同的问题,无非是一些头文件找不到 当时我是进了目录,发现这些头文件不是不存在,而是路径错了,于是自己修改了,有几个头文件找不到的,到网上下了一个,然后编译就通过了。  详情 回复 发表于 2009-6-26 23:13
点赞 关注

回复
举报

68

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
我想把驱动编译成可以insmod的模块。
此帖出自Linux开发论坛
 
 

回复

72

帖子

0

TA的资源

一粒金砂(中级)

板凳
 
遇到过和lz相同的问题,无非是一些头文件找不到
当时我是进了目录,发现这些头文件不是不存在,而是路径错了,于是自己修改了,有几个头文件找不到的,到网上下了一个,然后编译就通过了。
此帖出自Linux开发论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/6 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表