openwrt 編譯核心模組中的配置問題
以 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))
iio 跟目錄下Makefile部分內容
通過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 就不需要了