Building an out-of-tree module kernel including an out-of-tree header file

Ulf Samuelsson

I am tasked with updating an out of tree kernel module.

Currently this is built outside Yocto using a Yocto SDK
and the kernel module is added to the filesystem after the image has been programmed into the target.

The kernel module source code is part of a monorepo.
It depends on a header file in another part of the monorepo
using relative addressing (#include "../../header.h")

In the future, the header will be in its own repo.

My idea was a recipe handling the header file, and the kernel module recipe should DEPEND on this recipe.

The header recipe installs the header in ${D}/${includedir}.
When building the kernel module, the header file ends up in

The kernel module recipe ignores recipes-sysroot during the build
so the header file is not found. It will look in kernel include directory.

There are other packages which will also DEPEND on the header.
They are normal applications, so there the DEPEND should work.

For various reasons, I do not want to patch the kernel source.

* Is there a way to specify that the kernel module recipe should look in its sysroot for header files?
* Is there another place where I can install the header file so
that it is found when the kernel module DEPENDS on the header recipe?
* Is there a better/preferred way to let a kernel module depend on another recipe?
* How is the situation handled when there are two out-of-tree modules
where one is DEPENDing on the other?

Best Regards
Ulf Samuelsson