首页 > 系统服务 > 详细

Linux 最简单的驱动程序hello world

时间:2015-11-02 13:53:37      阅读:199      评论:0      收藏:0      [点我收藏+]

1,进入/code/v1/kernel-3.10/drivers/,新建mkdir hello

  新建hello.c

#include<linux/init.h>
#include<linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
{
printk(KERN_ALERT "Hello,init the module!");
return 0;
}

static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye,exit the module!");
}

module_init(hello_init);
module_exit(hello_exit);

 

2,新建Makefile

 obj-y += hello.o

 

3,编译。

make bootimage

Linux 最简单的驱动程序hello world

原文:http://www.cnblogs.com/senior-engineer/p/4929870.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!