I have written a simple inherit module
recipe to build a third-party out-of-tree kernel module called u-dma-buf:
SUMMARY = "User space mappable DMA Buffer"
DESCRIPTION = "${SUMMARY}"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=bebf0492502927bef0741aa04d1f35f5"
inherit module
SRC_URI = "git://github.com/ikwzm/udmabuf.git"
SRCREV = "9b943d49abc9c92a464e4c71e83d1c479ebbf80e"
S = "${WORKDIR}/git"
RPROVIDES_${PN} += "kernel-module-u-dma-buf"
This works correctly and generates the module file /lib/modules/[version]/extra/u-dma-buf.ko
in the image.
However, looking at the docs there is an option that can be enabled: CONFIG_U_DMA_BUF_MGR
that is disabled by default. If I can somehow enable this, then I can expect to find /lib/modules/[version]/extra/u-dma-buf-mgr.ko
in the image also.
The project has a Kconfig file. Does bitbake have support for integrating Kbuild configuration outside of the kernel tree? If so, how do I hook into this and enable CONFIG_U_DMA_BUF_MGR
? And if not, what's my best option, other than patching the Kconfig
file to change the default to "y"? (EDIT: this probably won't work, as kernel sources need to be modified to incorporate Kbuild anyway - so probably a dead end unless it's a specific feature of bitbake I haven't encountered yet).
I see that the upstream Makefile also has the option CONFIG_U_DMA_BUF_MGR=m
that could be used to enable this feature outside of Kbuild. I'm not sure how to pass that to the make
command line though - would I need to write a custom do_compile
task? Looking at the module.bbclass
code, I can't see any provision for passing such an option to oe_runmake
. Should I just copy/paste module_do_compile()
from module.bbclass
and add CONFIG_U_DMA_BUF_MGR=m
? Is that the best way to do this?
So my question is, given I'm using inherit module
, what is the proper way to enable this configuration option, given the recipe I have?
According to the Yocto kernel development docs:
That suggests to me that the correct and intended course of action in this case is to copy/paste
module_do_compile()
as ado_compile()
override, and modify accordingly (addCONFIG_U_DMA_BUF_MGR=m
):Additionally, add the new module to
RPROVIDES_${PN}
: