target specific KCONFIG fragments for kernel modules

Tomasz Maciej Nowak tmn505 at gmail.com
Fri Feb 27 15:48:07 PST 2026


W dniu 27.02.2026 o 22:47, Tim Harvey pisze:
> Greetings,

Hi

> I've been trying to figure out a way to create target specific KCONFIG
> fragments in a KernelPackage and have not found anything that works.
> 
> specifically I'm trying to enable HCIART_BCM for a specific target (as
> my PR has not been accepted due to imposing a small increase in static
> kernel size: https://github.com/openwrt/openwrt/pull/14517).
> 
> Enabling the items in the target/subtarget config-default does not
> work as the KCONFIG's in selected packages are applied after that so
> I've been focusing on target specific changes in the KenrelPackage
> definition.
> 
> I have not been able to get something like the following to work:
> define KernelPackage/hci-uart
>   SUBMENU:=$(BLUETOOTH_MENU)
>   TITLE:=Bluetooth HCI UART support
>   DEPENDS:=+kmod-bluetooth
> ifeq ($(CONFIG_TARGET_imx_cortexa53),y)
>   KCONFIG:= \
>         CONFIG_BT_HCIUART \
>         CONFIG_BT_HCIUART_BCM=y \
>         CONFIG_BT_HCIUART_SERDEV=y \
>         CONFIG_SERIAL_DEV_CTRL_TTYPORT=y \
>         CONFIG_SERIAL_DEV_BUS=y \
>         CONFIG_BT_HCIUART_INTEL=n \
>         CONFIG_BT_HCIUART_H4 \
>         CONFIG_BT_HCIUART_NOKIA=n
> else
>   KCONFIG:= \
>         CONFIG_BT_HCIUART \
>         CONFIG_BT_HCIUART_BCM=n \
>         CONFIG_BT_HCIUART_INTEL=n \
>         CONFIG_BT_HCIUART_H4 \
>         CONFIG_BT_HCIUART_NOKIA=n
> endif
>   FILES:= \
>         $(LINUX_DIR)/drivers/bluetooth/hci_uart.ko \
>         $(if $(CONFIG_BT_HCIUART_BCM),$(LINUX_DIR)/drivers/bluetooth/btbcm.ko)
>   AUTOLOAD:=$(call AutoProbe,hci_uart)
> endef
> 
> Does anyone have any suggestions on how to accomplish this?

Put CONFIG_SERIAL_DEV_CTRL_TTYPORT and CONFIG_SERIAL_DEV_BUS in kernel config
of target You are targeting and use conditional in FILES like in my patch[1].
That way any target including those tow symbols will have btbcm.ko available.

1. https://patchwork.ozlabs.org/project/openwrt/patch/20241029161046.110403-2-tmn505@terefe.re/

> Best Regards,
> 
> Tim
Regards

-- 
TMN



More information about the openwrt-devel mailing list