将驱动程序自动编译到linux kernel

linux kernel version:4.4.38

hardware version:exynos4412-tiny4412 1312B

最近在学习IIC UART SPI,写了一个i2c client程序sht3x,将其加入到linux kernel

驱动程序参考连接:https://www.cnblogs.com/ethandlwang/p/15001716.html

和mma7660一样,sht3x也是一个iic client

1.mma7660位于drivers/input/misc/mma7660.c,那么判断mma7660被归类成了输入杂项设备,那么sht3x也是如此属性,那么就把sht3x放在mma7660同等目录下

2.打开drivers/input/misc/,找到Kconfig和Makefile两个文件打开

3.将mma7660作为模板修改,tristate后面双引号的部分为make menuconfig时显示的部分

 

 

 4.修改保存之后,执行make menuconfig

Device Drivers  ---> 

  Input device support  --->

    [*]   Miscellaneous devices  --->

 

 

 5.接下来修改Makefile,在mma7660下方按照Kconfig中字串添加

1 obj-$(CONFIG_INPUT_MMA7660)        += mma7660.o
2 obj-$(CONFIG_INPUT_SHT3XDIV)        += sht3x.o

6.将sht3x.c放入drivers/input/misc/

7.执行make LOADADDR=40008000 uImage

8.烧录uImage

9.系统起来后直接查看temperature文件

 

posted @ 2021-07-12 14:04  王东力  阅读(160)  评论(0)    收藏  举报