| 
 | 
 
大家好,我用天嵌2440板子,编译一个驱动模块,总是找不到头文件。不知道该如何处理。请务必帮忙。高手能留下QQ指点一下最好了。程序如下,执行make就出错。找不到头文件。 
/****************hellomod.c*******************************/ 
#include <linux/module.h> //所有模块都需要的头文件 
#include <linux/init.h> // init&exit相关宏 
MODULE_LICENSE("GPL"); 
static int __init hello_init (void) 
{ 
    printk("Hello china init/n"); 
    return 0; 
} 
 
static void __exit hello_exit (void) 
{ 
    printk("Hello china exit/n"); 
} 
 
module_init(hello_init); 
module_exit(hello_exit); 
 
/****************hellomod.c*******************************/ 
 
/****************Makefile*******************************/ 
 
KDIR := /opt/EmbedSky/linux-2.6.30.4 
 
obj-m := hellomode.o 
 
all: 
        make -C $(KDIR) M=$(PWD) modules ARCH=arm CROSS_COMPILE=arm-linux- 
clean: 
        rm -f *.ko *.o *.mod.o *.mod.c *.symvers modul* 
/****************Makefile*******************************/ 
[root@localhost root]# cd .. 
提示信息如下: 
[root@localhost /]# cd opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/ 
[root@localhost hellomode]# make 
make -C /opt/EmbedSky/linux-2.6.30.4 M=/opt/EmbedSky/linux-2.6.30.4/drivers/hell 
omode modules ARCH=arm CROSS_COMPILE=arm-linux- 
make[1]: Entering directory `/opt/EmbedSky/linux-2.6.30.4' 
  
  WARNING: Symbol version dump /opt/EmbedSky/linux-2.6.30.4/Module.symvers 
           is missing; modules will have no dependencies and modversions. 
  
  CC [M]  /opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.o 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:1:26: error: linux/mo 
dule.h: No such file or directory 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:2:24: error: linux/in 
it.h: No such file or directory 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:3: error: expected de 
claration specifiers or '...' before string constant 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:3: warning: data defi 
nition has no type or storage class 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:3: warning: type defa 
ults to 'int' in declaration of 'MODULE_LICENSE' 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:3: warning: function 
declaration isn't a prototype 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:4: error: expected '= 
', ',', ';', 'asm' or '__attribute__' before 'hello_init' 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:9: error: expected '= 
', ',', ';', 'asm' or '__attribute__' before 'hello_exit' 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:14: warning: data def 
inition has no type or storage class 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:14: warning: type def 
aults to 'int' in declaration of 'module_init' 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:14: warning: paramete 
r names (without types) in function declaration 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:15: warning: data def 
inition has no type or storage class 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:15: warning: type def 
aults to 'int' in declaration of 'module_exit' 
/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.c:15: warning: paramete 
r names (without types) in function declaration 
make[2]: *** [/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode/hellomode.o] Error 
1 
make[1]: *** [_module_/opt/EmbedSky/linux-2.6.30.4/drivers/hellomode] Error 2 
make[1]: Leaving directory `/opt/EmbedSky/linux-2.6.30.4' 
make: *** [all] Error 2 
[root@localhost hellomode]# 
 |   
 
 
 
 |