重新开始,做回自我,爱拼的男人最牛!
分类: LINUX
2010-01-27 10:25:14
|
# 驱动名称
DRI_NAME :=demo
# 模块名称
MOD_NAME :=IMTI_DEMO
# 节点名称
NOD_NAME :=/dev/demo
obj-m :=$(DRI_NAME).o
KERNELDIR ?=/lib/modules/$(shell uname -r)/build
PWD ?=$(shell pwd)
default:
$(MAKE) -C ${KERNELDIR} M=${PWD} modules
#安装的伪代码
.PHONY:install uninstall clean
install:default
insmod demo.ko
mknod $(NOD_NAME) c `awk '$$2=="'${MOD_NAME}'" {print $$1}' /proc/devices` 0
#卸载的伪代码
uninstall:
rm -f $(NOD_NAME)
rmmod $(DRI_NAME)
#清理垃圾的伪代码
clean:
@rm -rf *.o *.ko .tmp_versions *~ Module.symvers .*.cmd *.mod.c