[yocto] Installing Linux kernel headers including custom UAPI header file

Craig McQueen craig.mcqueen at innerrange.com
Wed Mar 18 21:24:32 PDT 2015


I think I've answered my own question.

The existing files installed in the build root /usr/include/linux/... are put there by the linux-libc-headers package.

According to a prominent comment in meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc, I shouldn't try to fiddle with those, but instead point my application/library code to the STAGING_KERNEL_DIR.
This previous post gave some useful hints: https://lists.yoctoproject.org/pipermail/linux-yocto/2014-April/002178.html

But according to http://kernelnewbies.org/KernelHeaders I should just copy the specific header file I need from the kernel into my application/library source code, with a note to keep it synced with the latest kernel versions.

I ended up doing the latter.
-- 
Regards,
Craig McQueen

-----Original Message-----
From: yocto-bounces at yoctoproject.org [mailto:yocto-bounces at yoctoproject.org] On Behalf Of Craig McQueen
Sent: Thursday, 19 March 2015 10:59 AM
To: yocto at yoctoproject.org
Subject: [yocto] Installing Linux kernel headers including custom UAPI header file

Hello,

I'm using Yocto (dizzy) with meta-ti and the linux-ti-staging kernel 3.14.x to build for BeagleBone Black.

I've written a custom char driver with several ioctl() calls, and I'm patching that into the linux-ti-staging kernel. The driver adds a new UAPI header file that goes in the kernel tree under include/uapi/linux/mydriver.h, to define the ioctl commands.

I've got a test application to use that custom char driver. I've also written a library libmydriver, to provide a more user-friendly interface to the ioctl calls. Both want to include the mydriver.h from the Linux headers. The application and library are using autotools to build. I've written a Yocto recipe to build them via autotools.

My problem is this: my application and library fail to build under Yocto, due to missing the Linux kernel header file mydriver.h (/usr/include/linux/mydriver.h is where I'd expect it to appear in the build environment root filesystem).

What do I need to change to cause the custom Linux kernel build to install the kernel header files, including mydriver.h into the Yocto build for other packages to use during build?

(I don't want it installed on the target, only in the build sysroot, although I'm not familiar enough with Yocto to understand how it installs include files to the build sysroot, but not the target sysroot.) I can see that Linux kernel headers are being installed to tmp/sysroots/beaglebone/usr/include/linux/... but not including mydriver.h; I'm not sure what package is installing these headers. (I can also see that my header is installed at tmp/sysroots/beaglebone/usr/src/kernel/include/uapi/linux/mydriver.h, but that's not the same.)

-- 
Craig McQueen

-- 
_______________________________________________
yocto mailing list
yocto at yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto



More information about the yocto mailing list