If your recipe builds an application that needs to
communicate with some device or needs an API into a custom
kernel, you will need to provide appropriate header files.
Under no circumstances should you ever modify the existing
meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc
file.
These headers are used to build libc
and
must not be compromised with custom or machine-specific
header information.
If you customize libc
through modified
headers all other applications that use
libc
thus become affected.
libc
header file (i.e.
meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc
).
The correct way to interface to a device or custom kernel is to use a separate package that provides the additional headers for the driver or other unique interfaces. When doing so, your application also becomes responsible for creating a dependency on that specific provider.
Consider the following:
Never modify
linux-libc-headers.inc
.
Consider that file to be part of the
libc
system, and not something
you use to access the kernel directly.
You should access libc
through
specific libc
calls.
Applications that must talk directly to devices should either provide necessary headers themselves, or establish a dependency on a special headers package that is specific to that driver.
For example, suppose you want to modify an existing header that adds I/O control or network support. If the modifications are used by a small number programs, providing a unique version of a header is easy and has little impact. When doing so, bear in mind the guidelines in the previous list.
libc
, and subsequently all
other applications on the system, use a
.bbappend
to modify the
linux-kernel-headers.inc
file.
However, take care to not make the changes
machine specific.
Consider a case where your kernel is older and you need
an older libc
ABI.
The headers installed by your recipe should still be a
standard mainline kernel, not your own custom one.
When you use custom kernel headers you need to get them from
STAGING_KERNEL_DIR
,
which is the directory with kernel headers that are
required to build out-of-tree modules.
Your recipe will also need the following:
do_configure[depends] += "virtual/kernel:do_shared_workdir"