首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

ARM内核模块编译,该如何解决

2012-03-31 
ARM内核模块编译下面是我用的原码!1 #include linux/module.h23 int int_module(void){4printk( 1 he

ARM内核模块编译
下面是我用的原码!  

  1 #include <linux/module.h>
  2 
  3 int int_module(void){
  4 printk(" <1> hello world!\n");
  5 return 0;
  6 }
  7 
  8 void cleanup_module(void){
  9 printk(" <1> goodbye!\n");
 10 }
 
我用来编译的命令arm-linux-gcc -o hello.o _D__KERNEL__ -DMODULE -I /home/linux-2.6.38/include -c hello.c

错误为
arm-linux-gcc: _D__KERNEL__: No such file or directory
In file included from /home/linux-2.6.38/include/linux/list.h:4:0,
  from /home/linux-2.6.38/include/linux/module.h:9,
  from hello.c:1:
/home/linux-2.6.38/include/linux/types.h:13:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
In file included from /home/linux-2.6.38/include/linux/list.h:7:0,
  from /home/linux-2.6.38/include/linux/module.h:9,
  from hello.c:1:
/home/linux-2.6.38/include/linux/prefetch.h:14:27: fatal error: asm/processor.h: No such file or directory
compilation terminated.

我是新手,请高人指点啊,


[解决办法]
找LDD3上的makefile试试
[解决办法]
_D__KERNEL__ ==> -D__KERNEL__

热点排行