Kconfig和Makefile

内核源码树的目录下都有Kconfig和Makefile。在内核配置make menuconfig时,从Kconfig中读出菜单,用户勾选后保存到.config中。在内核编译时,Makefile调用这个.config,即用户的选择

Kconfig

config RTC_HCTOSYS
    bool "Set system time from RTC on startup and resume"
    depends on RTC_CLASS = y 
    default y
    help
      If you say yes here, the system time (wall clock) will be set ...

congfig下方的那些bool、depends on、default、help等属性,分别为类型、依赖项、默认值、帮助信息

类型
类型分类:bool布尔、 tristate三态(内建、模块、移除)、string字符串、 hex十六进制、 integer整型

  • bool 类型的只能选中或不选中,显示为[ ]
  • tristate类型多了编译成内核模块的选项,显示为< >
  • hex类型,显示为( )

Makefile

obj-$(CONFIG_RTC_HCTOSYS) += hctosys.o

这样,您加的模块也可以编译了

原文地址:https://www.cnblogs.com/zhangxuechao/p/11709771.html