Re: Kernel Header UAPI Issue

Karthik Poduval

Hi Khem and Bruce,

I got the patch from raspberry pi github and it looked like it put the header into include/uapi/linux/dma-heap.h, for kernel 5.4 it doesn't look like there is a need for a Kbuild file. Are any special steps needed for exporting the header (I thought kernel 5.4 exports everything from include/uapi directory) ? The  linux-libc-headers sound like the issue. Thanks for the pointers, I will dig up further based on the suggestions and revert.

On Mon, Feb 22, 2021 at 5:14 PM Bruce Ashfield <bruce.ashfield@...> wrote:
On Mon, Feb 22, 2021 at 7:52 PM Karthik Poduval
<karthik.poduval@...> wrote:
> I have a 5.4 kernel where I applied a patch (using a .scc file) from
> kernel 5.6 which brings in dmabuf heaps.
> The patch exports a uapi header
> include/uapi/linux/dma-heap.h.
> I am trying to write an application that uses dmabuf with a recipe (no
> special DEPENDS).
> It is able to find
> #include<linux/dma-buf.h>
> but not
> #include<linux/dma-heap.h> (this file is introduced in the patch)
> I looked at the recipe's sysroot
> recipe-sysroot/usr/linux/include

That's coming from the linux-libc-headers, your new upi header is not
part of the libc-headers package, so it won't show up there. And no,
it shouldn't be part of that recipe and the libc-headers should not be
generated from the current state of whatever kernel is being built.

You need to arrange for it to be exported and staged separately (look
for examples of 'sysroot_stage' variants in the meta-data, you can
bbappend the behaviour to your kernel recipe), or your code can look
for the header in the kernel shared workdir (STAGING_KERNEL_BUILDDIR)
by adding that to your include paths in the recipe.

As khem also mentioned, you'll need to make sure that the uapi header
is not just patched in, but properly exported.


> and  dma-buf.h is there but not  dma-heap.h
> Why is the header not being imported ?
> --
> Regards,
> Karthik Poduval

- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

Karthik Poduval

Join to automatically receive all group messages.