[yocto] Custom kernel headers and SDK

Longchamp, Valentin Valentin.Longchamp at keymile.com
Tue Dec 8 13:06:29 PST 2015


Hello,

We are currently migrating our Embedded Linux software and the corresponding
small in house distribution to Yocto. We are small Linux team and we provide and
maintain the toolchain, kernel and base distribution for a broader team of
software developers that build the applications for our hardware.

So far, we have been able to use Yocto to build our whole software (kernel,
minimal distribution and application software) by adding our minimal meta-layer
and defining stuff there and it works great.

Since the application devs are "not interested" in our distro nor in the
compiler, we want to make them available for them thanks to the SDK which is a
great fit for this use case. So far it works very well and we are currently
working on adapting the build system to the SDK.

And here comes my question. We have however our own kernel sources that extend
the headers for a few "in-house" drivers. From the warning in linux-libc-headers
(http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc),
I understand that it should be avoided to recreate a recipe for the kernel
headers to avoid having the libc "machinified". From yocto, I could get the
custom headers thanks to STAGING_KERNEL_DIR. However, we need these custom
headers from "outside" of yocto, when using the SDK.

I have found 2 ways to install them into the sysroot and thus SDK:
- either by adding the kernel-devsrc to the SDK that installs them into
/usr/src/kernel by default.
- or by adding something similar to what is proposed in this mailing-list
discussion to our kernel recipe:
https://lists.yoctoproject.org/pipermail/linux-yocto/2014-April/002178.html

The problem with these 2 solutions is that sysroot contains:
1) the sanitized kernel headers at in sysroot/usr/include/linux
2) our custom headers at sysroot/usr/src/kernel/include/linux

and when I add a -I option in the CFLAGS for 2), I get conflicts since the SDK
automatically looks first in sysroot/usr/include.

Here is an example of the current errors I get with 1) and 2) in both the -I path:

>                  from plat/icndrv/hdlc/mpc8xxx_scc/src/libhdlc-km.c:2:
> /opt/work/ppc-toolchain/sysroots/powerpc-oe-linux/usr/src/kernel/include/linux/types.h:14:26: error: conflicting types for 'fd_set'
>  typedef __kernel_fd_set  fd_set;
>                           ^
> In file included from /opt/work/ppc-toolchain/sysroots/powerpc-oe-linux/usr/include/sys/types.h:219:0,
>                  from /opt/work/ppc-toolchain/sysroots/powerpc-oe-linux/usr/include/sys/uio.h:23,
>                  from /opt/work/ppc-toolchain/sysroots/powerpc-oe-linux/usr/include/sys/socket.h:26,
>                  from plat/icndrv/hdlc/mpc8xxx_scc/src/libhdlc-km.c:1:
> /opt/work/ppc-toolchain/sysroots/powerpc-oe-linux/usr/include/sys/select.h:75:5: note: previous declaration of 'fd_set' was here
>    } fd_set;

What would be the correct "yocto" way of solving our current problem with our
custom headers to be added to the SDK ?

Thanks

Valentin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20151208/0db9e80b/attachment.html>


More information about the yocto mailing list