标签:linux驱动
接触驱动好多年了,但一直没有一个系统的归纳,现在重新从最简单的hello world驱动说起,后续将持续更新其它的驱动,所有的驱动TQ2440开发板进行学习
<span style="font-size:18px;">///////////////////////Hello.c/////////////////////////////////</span>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello world!\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Good bye!\n");
}
module_init(hello_init);
module_exit(hello_exit);
/////////////makefile///////////////////
obj-m := hello.o
KERNEL_DIR := /lib/modules/$(shell uname -r)/build
#KERNEL_DIR := /opt/linux-2.6.30.4/
PWD := $(shell pwd)
all:
make -C ${KERNEL_DIR} M=${PWD} modules
clean:
rm -rf *.o *.ko
标签:linux驱动
原文地址:http://blog.csdn.net/chenliang0224/article/details/42535183