标题:arm hello模块make时错误
只看楼主
elesun8
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2014-12-29
结帖率:42.86%
 问题点数:0 回复次数:2 
arm hello模块make时错误
arm hello模块make时错误

宿主机环境:PC 虚拟机 Linux(2.6.18-53.el5)_redhat gcc(4.3.2)
目标机:arm Linux(2.6.29) mini2440 hello.ko模块在本开发板挂载

出现以下错误:
[root@localhost arm_hello_module_makefile]# ls
hello.c  Makefile
[root@localhost arm_hello_module_makefile]# make
make -C /home/sun/linux-2.6.29/ M=/temp/arm_hello_module_makefile modules ARCH=arm CROSS_COMPILE=arm-linux-
make[1]: Entering directory `/home/sun/linux-2.6.29'
  CC [M]  /temp/arm_hello_module_makefile/hello.o
In file included from include/linux/gfp.h:4,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /temp/arm_hello_module_makefile/hello.c:1:
include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory
include/linux/mmzone.h:256:5: warning: "MAX_NR_ZONES" is not defined
In file included from include/linux/gfp.h:4,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /temp/arm_hello_module_makefile/hello.c:1:
include/linux/mmzone.h:290: error: 'MAX_NR_ZONES' undeclared here (not in a function)
/temp/arm_hello_module_makefile/hello.c:10: warning: function declaration isn't a prototype
/temp/arm_hello_module_makefile/hello.c:16: warning: function declaration isn't a prototype
make[2]: *** [/temp/arm_hello_module_makefile/hello.o] Error 1
make[1]: *** [_module_/temp/arm_hello_module_makefile] Error 2
make[1]: Leaving directory `/home/sun/linux-2.6.29'
make: *** [all] Error 2



Makefile文件内容如下:
ifneq ($(KERNELRELEASE),)

obj-m := hello.o

else

KDIR := /home/sun/linux-2.6.29/
all:
        make -C $(KDIR) M=$(PWD) modules ARCH=arm CROSS_COMPILE=arm-linux-
clean:
        rm -f *.ko *.o *.mod.o *.mod.c *.symvers

endif
搜索更多相关主题的帖子: 虚拟机 hello Linux 开发 
2015-01-08 22:31
elesun8
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2014-12-29
得分:0 
没有人遇到过这个问题嘛
2015-01-09 12:43
elesun8
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2014-12-29
得分:0 
出现这种错误的原因主要是由于linux内核做过 make clean 命令,把bounds.h 文件清除掉了(可以查看makefile 中的写法),因而需要重新生成这个头文件,使用命令 make prepare
cd linux2.29,make prepare,cd file_module,make   OK
2015-01-09 20:51



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-440882-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025043 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved