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