首页 > 系统服务 > 详细

linux驱动编程入门实例

时间:2014-10-31 18:44:45      阅读:358      评论:0      收藏:0      [点我收藏+]

编辑

/*****hello.c*******/

#include <linux/init.h>

#include <linux/module.h>

#include <linux/kernel.h>

MODULE_LICENSE("Dual BSD/GPL");

static int hello_init() {

  printk("<1>hello\n");

  return 0;

}

static void hello_exit() {

  printk("<1>bye\n");

}

module_init(hello_init);

module_exit(hello_exit);

makefile

  obj-m := hello.o

编译

make -C /usr/src/kernel-source M=`pwd` modules

运行

安装驱动:insmod hello.ko

查看驱动:lsmod

卸载驱动:rmmod hello

linux驱动编程入门实例

原文:http://www.cnblogs.com/feilv/p/4065509.html

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