免费注册 查看新帖 |

Chinaunix

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

我在ubuntu中编译The Linux® Kernel Primer中的hellomod例子为什么不行 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-06-10 11:45 |只看该作者 |倒序浏览
本帖最后由 qihuasoft 于 2011-06-10 11:46 编辑

  1. // hellomod.c  
  2. // hello world driver for Linux 2.6

  3. #include <linux/module.h>
  4. #include <linux/kernel.h>
  5. #include <linux/init.h>
  6. #MODULE_LICENCE("GPL"); //get rid of taint message

  7. static int __init lkp_init( void )
  8. {
  9.   printk("<1>Hello,World! from the kernel space...\n");
  10.   return 0;
  11. }

  12. static void __exit lkp_cleanup( void )
  13. {
  14.   printk("<1>Goodbye, World! leaving kernel space...\n");
  15. }

  16. module_init(lkp_init);
  17. module_exit(lkp_cleanup);
复制代码
-----------------------------------------------------------------------


  1. # Makefile for Linux Kernel Primer module skeleton (2.6.7)



  2. obj-m += hellomod.o
复制代码
Notice that we specify to the build system that this be compiled as a loadable module. The command-line invocation of this Makefile wrapped in a bash script called doit is as follows:

----------------------------------------------------------------------------doit
001 make -C /usr/src/linux-2.6.7 SUBDIRS=$PWD modules
--------------------------------------------------------------------------------




错误信息是


make:进入目录'/usr/src/linux-headers-2.6.32-21-generic'
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-x86
make[1]: *** 没有规则可以创建“kernel/bounds.s”需要的目标“kernel/bounds.c”。 停止。
make: *** [prepare0] 错误 2
make:离开目录“/usr/src/linux-headers-2.6.32-21-generic”
root@ubuntu:~# make -C /usr/src/linux-headers-2.6.32-21-generic/ SUBDIR=$PWD modules
make:进入目录'/usr/src/linux-headers-2.6.32-21-generic'
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-x86
make[1]: *** 没有规则可以创建“kernel/bounds.s”需要的目标“kernel/bounds.c”。 停止。
make: *** [prepare0] 错误 2
make:离开目录“/usr/src/linux-headers-2.6.32-21-generic”
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP