前言
本文的基础是下面两篇博文:
https://blog.csdn.net/wenhao_ir/article/details/144556756
https://blog.csdn.net/wenhao_ir/article/details/144532544
本篇博文对应的学习实例是:
https://blog.csdn.net/wenhao_ir/article/details/144881830
源码
编译驱动程序模块和测试程序的Makefile的源码如下:
# 使用不同的Linux内核时, 一定要修改KERN_DIR,KERN_DIR代表已经配置、编译好的Linux源码的根目录
KERN_DIR = /home/book/100ask_imx6ull-sdk/Linux-4.9.88
all:
make -C $(KERN_DIR) M=`pwd` modules
$(CROSS_COMPILE)gcc -o hello_drv_test hello_drv_test.c
clean:
make -C $(KERN_DIR) M=`pwd` clean