如何在linux内核中增加程序 ,其实这个东西很多教程都没有讲,故在这里简单说一下
1.将源代码放到内核目录下
2.将此目录下的Kconfig文件添加对应项目的编译配置选项
3.将此目录下的Makefile文件添加编译条目
在内核目录 /Documentation/kbuild 有更详细的说明
实例:打开linux内核中温度检测
在目录 kernel/drivers/thermal 下,vim Makefile
所以是要把CONFIG_S32V234_THERMAL 这个config打开
Kconfig 里:
config S32V234_THERMAL
bool "Temperature sensor driver for NXP s32v234 SoCs"
depends on SYSFS && THERMAL_HWMON
help
Support for Temperature Monitoring Unit (TMU) found on NXP s32v234
SoCs. It supports reporting the immediate and average temperature
in a manner compatible with lm-sensors
依赖项
grep CONFIG_THERMAL_HWMON -nr
drivers/thermal/Makefile:11:thermal_sys-$(CONFIG_THERMAL_HWMON) += thermal_hwmon.o
vim drivers/thermal/Kconfig
然后make menuconfig
实例2: