Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器 软件资源

软件开发小程序制作系统集成与运维空间租用硬件开发视频监控技术咨询与支持——联系电话:0311-88999002/88999003

首页 / 操作系统 / Linux / linux2.6驱动的编写实例

以hello world的2.6版为例子,介绍linux2.6驱动的编写。

源程序:

#include
#include
#include

MODULE_LICENSE("GPL");//必有的说明

static int hello_init(void) {
printk(KERN_ALERT"Hello, world ");
return 0;
}
static void hello_exit(void) {
printk("Goodbye, cruel world ");
}

module_init(hello_init);
module_exit(hello_exit);

编译文件(makefile),最好不要粘贴,存在格式问题,手动敲一下,这是简单形式,省略了一些判断语句。