Linux 最简单的驱动程序hello world

图片驱动位置;kernel3-10/driver/misc/mediatek/imgsensor/src/mt8127/kd_sensorlist.c

例子:kernel-3.10/driver/misc/mediatek/ext_bt_power

 

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

posted @ 2015-11-02 13:01  maxiongying  阅读(574)  评论(0编辑  收藏  举报