一:内核配置方法:
一般使用make config 和make menuconfig去配置内核。他们分别使用scripts/Configure和scripts/Menuconfig脚本解释工具去执行脚本。在2.4内核中脚本为各级目录下的Config.in,而在2.6内核中变为Kconfig。在配置完后会生成.config文件,其内容为相应的宏定义。
要让我们的驱动项显示到配置选项上,必须修改相应的Kconfig文件(以2.6内核为例),此文件有一定的语法规则,比较简单,再此不多描述。
二:实例讲解步骤
我们以添加oloir红外驱动为例讲解:
1:先选择一个放置驱动代码的位置:drivers/olo_ir,把代码放到这个目录中。
2:在drivers/olo_ir添加Kconfig文件,内容如下:
menu "OLO ir support"
config OLOIR
tristate "OLO ir support"
---help---
olo ir use gpio as ir input .
If you want olo ir support, you should say Y here and also to the
specific driver for your bus adapter(s) below.
This olo ir support can be built as a module.
endmenu
