免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3349 | 回复: 3
打印 上一主题 下一主题

ARM内核模块编译 [复制链接]

论坛徽章:
1
水瓶座
日期:2014-10-18 20:17:41
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-09 22:01 |只看该作者 |倒序浏览
下面是我用的原码!  

  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.

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

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2011-12-11 23:40 |只看该作者
_D__KERNEL__

好象应该是 -D__KERNEL__

论坛徽章:
0
3 [报告]
发表于 2013-03-20 11:29 |只看该作者
需要一本,内核裁剪的书。求推荐。

论坛徽章:
0
4 [报告]
发表于 2013-03-30 23:46 |只看该作者
本帖最后由 rabbit2013 于 2013-03-30 23:59 编辑

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

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP