Adding out-of-tree kernel modules & drivers



I am trying to develop a custom ASoC machine driver for an i.MX6 project using yocto. 

I have followed the yocto provided 'hello-mod' recipe as an example for out-of-tree kernel modules, but unfortunately this doesn't work for my application since it requires some in-tree header files that cannot be found when the recipe is built.

Another method I tried is to use patches in order to compile this as a usual in-tree driver.
This does work, but I am not getting any error messages if I use this approach. So even if the driver contains some known error that would prevent it from compiling, these are not shown and bitbake completes successfully.

Equally, if I patch the defconfig file to include some config with a made-up false name, it doesn't show that there was an error with this module.


So my questions would be:
- What is the proper way of implementing out-of-tree drivers that rely on in-tree headers?

- if that's now possible, how can I make bitbake show error when compiling the files using the patched method?

Any guidance is highly appreciated !