以 other.mk 中的iio 为例 对 KCONFIG下面的
define KernelPackage/iio-core
SUBMENU:=$(OTHER_MENU)
TITLE:=Industrial IO core
KCONFIG:= \
CONFIG_IIO \
CONFIG_IIO_BUFFER=y \
CONFIG_IIO_KFIFO_BUF \
CONFIG_IIO_TRIGGER=y \
CONFIG_IIO_TRIGGERED_BUFFER
FILES:= \
$(LINUX_DIR)/drivers/iio/industrialio.ko \
$(if $(CONFIG_IIO_TRIGGERED_BUFFER),$(LINUX_DIR)/drivers/iio/industrialio-triggered-buffer.ko) \
$(LINUX_DIR)/drivers/iio/kfifo_buf.ko
AUTOLOAD:=$(call AutoLoad,55,industrialio kfifo_buf industrialio-triggered-buffer)
endef
define KernelPackage/iio-core/description
The industrial I/O subsystem provides a unified framework for
drivers for many different types of embedded sensors using a
number of different physical interfaces (i2c, spi, etc)
endef
$(eval $(call KernelPackage,iio-core))
通过make menuconfig 选中 GONFIG_IIO后,编译后,编译的内容
GONFIG_IIO :编译了 industrialio-core.c inkern.c industrialio-event.c
CONFIG_IIO_BUFFER=y : 编译了 industrialio-buffer.c
CONFIG_IIO_TRIGGER=y : 编译了 industrialio-trigger.c
上述五个文件共同编译了组件: industrialio.ko
$(LINUX_DIR)/drivers/iio/kfifo_buf.ko // 这句话使得 kfifo_buf.ko 模块编译,
//但是CONFIG_IIO_KFIFO_BUF 没有选中
//说明,CONFIG_IIO_KFIFO_BUF=y对模块是否编译无影响
改变KCONFIG, 后再编译
KCONFIG:= \
CONFIG_IIO \
CONFIG_IIO_BUFFER=y \
CONFIG_IIO_KFIFO_BUF \
CONFIG_IIO_BUFFER_CB=y \
CONFIG_IIO_TRIGGER \
CONFIG_IIO_TRIGGERED_BUFFER=y \
并没有出现 industrialio-triggered-buffer.ko 模块
同时 industrialio-buffer.c 也编译了
与预期的不同,所需要看Kconfig文件中的依赖关系
#
# Industrial I/O subsystem configuration
#
menuconfig IIO
tristate "Industrial I/O support"
select ANON_INODES
help
The industrial I/O subsystem provides a unified framework for
drivers for many different types of embedded sensors using a
number of different physical interfaces (i2c, spi, etc).
if IIO
config IIO_BUFFER
bool "Enable buffer support within IIO"
help
Provide core support for various buffer based data
acquisition methods.
if IIO_BUFFER
config IIO_BUFFER_CB
boolean "IIO callback buffer used for push in-kernel interfaces"
help
Should be selected by any drivers that do in-kernel push
usage. That is, those where the data is pushed to the consumer.
config IIO_KFIFO_BUF
select IIO_TRIGGER
tristate "Industrial I/O buffering based on kfifo"
help
A simple fifo based on kfifo. Note that this currently provides
no buffer events so it is up to userspace to work out how
often to read from the buffer.
config IIO_TRIGGERED_BUFFER
tristate
select IIO_TRIGGER
select IIO_KFIFO_BUF
help
Provides helper functions for setting up triggered buffers.
endif # IIO_BUFFER
config IIO_TRIGGER
boolean "Enable triggered sampling support"
help
Provides IIO core support for triggers. Currently these
are used to initialize capture of samples to push into
buffers. The triggers are effectively a 'capture
data now' interrupt.
config IIO_CONSUMERS_PER_TRIGGER
int "Maximum number of consumers per trigger"
depends on IIO_TRIGGER
default "2"
help
This value controls the maximum number of consumers that a
given trigger may handle. Default is 2.
更改KCONFIG,重新编译:
CONFIG_IIO \
CONFIG_IIO_BUFFER \
CONFIG_IIO_KFIFO_BUF \
CONFIG_IIO_TRIGGER \
CONFIG_IIO_TRIGGERED_BUFFER
可以看到,kfifo_buf.ko 模块没有生成,是因为在Kconfig 文件中看出 IIO_TRIGGER的依赖关系
config IIO_KFIFO_BUF
select IIO_TRIGGER
//而 IIO_TRIGGER
但是仅仅选中 设置 CONFIG_IIO_TRIGGER=y 编译也是通不过的,重新观察发现 只有预先选中IIO_BUFFER, 才能选中_IIO_TRIGGER
if IIO_BUFFER
config IIO_BUFFER_CB
boolean “IIO callback buffer used for push in-kernel interfaces”
help
Should be selected by any drivers that do in-kernel push
usage. That is, those where the data is pushed to the consumer.
config IIO_KFIFO_BUF
select IIO_TRIGGER
tristate “Industrial I/O buffering based on kfifo”
help
A simple fifo based on kfifo. Note that this currently provides
no buffer events so it is up to userspace to work out how
often to read from the buffer.
config IIO_TRIGGERED_BUFFER
tristate
select IIO_TRIGGER
select IIO_KFIFO_BUF
help
Provides helper functions for setting up triggered buffers.
endif # IIO_BUFFER
更改KCONFIG,重新编译:
CONFIG_IIO \
CONFIG_IIO_BUFFER=y \
CONFIG_IIO_KFIFO_BUF \
CONFIG_IIO_TRIGGER=y \
CONFIG_IIO_TRIGGERED_BUFFER=y
并没有出现 industrialio-triggered-buffer.ko 模块
CONFIG_IIO_KFIFO_BUF=y 设置后,再编译还是没有出现 industrialio-triggered-buffer.ko 模块,原因待查
当选中
CONFIG_IIO_KFIFO_BUF=y 后,
$(LINUX_DIR)/drivers/iio/kfifo_buf.ko 就不需要了