Chinaunix首页 | 论坛 | 博客
  • 博客访问: 689597
  • 博文数量: 240
  • 博客积分: 3616
  • 博客等级: 大校
  • 技术积分: 2663
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-21 23:59
文章分类

全部博文(240)

文章存档

2013年(6)

2012年(80)

2011年(119)

2010年(35)

分类: LINUX

2010-11-03 21:54:10

1.程序代码
#include ///最重要的头文件,它必须包含在模块源代码中
#include //紧用于模块初始化或清除阶段的函数和数据
MODULE_LICENSE("GPL");//遵守GPL协议
MODULE_AUTHOR("andyluo");//作者
MODULE_DESCRIPTION("Hello world module");//模块名称
static int __init hello_init(void)
{
 printk(KERN_ERR "hello world!\n");//打印hello world
 return 0;
}
static void __exit hello_exit(void)
{
 printk(KERN_ERR "Goodbye,cruel world !\n");
}
module_init(hello_init);//用于指定模块的初始化和清除函数的宏
module_exit(hello_exit);
2.Makefile代码
ifneq ($(KERNELRELEASE),)
阅读(1188) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-11-05 08:41:59

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com