On Sun, Dec 01, 2019 at 10:57:15PM +0100, Peter Bergin wrote:
I'm currently working in a project using Yocto 2.6 (thud) release. It has
default kernel v4.18 and also linux-libc-headers from kernel v4.18. In my
project we will use kernel v4.1. I would like advice how to handle the
linux-libc-headers package for my project, should I use the v4.18 headers or
should I use the v4.1 header files which matches the running kernel?
From https://www.kernel.org/doc/html/latest/kbuild/headers_install.html:"Kernel headers are backwards compatible, but not forwards compatible. This
means that a program built against a C library using older kernel headers
should run on a newer kernel (although it may not have access to new
features), but a program built against newer kernel headers may not work on
an older kernel."
With the information from the quote above I would directly use v4.1 headers
as my linux-libc-headers. But then reading the information in the file
meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc makes me think
another round. It states:
# You're probably looking here thinking you need to create some new copy
# of linux-libc-headers since you have your own custom kernel. To put
# this simply, you DO NOT.
# There can also be a case where your kernel extremely old and you want
# an older libc ABI for that old kernel. The headers installed by this
# recipe should still be a standard mainline kernel, not your own custom
The first part states that I should not change linux-libc-headers. But when
I read the last part I'm not sure about the interpretation and it could be
for my case. Just a matter of definition if v4.1 is extremely old compared
Then another thing comes in to the equation; the LIBC ABI. When I look into
the configuration of the glibc package it uses the configure switch
"--enable-kernel=3.2" which means it shall be compatible with all kernel
newer than v3.2. Then probably glibc is fine if it is compiled with v4.18
and run on v4.1?
If building all applications against v4.18 headers but run on v4.1 kernel. I
have a feeling that there potentially can be problems here.
Please help me with some information about this and share your opinions? Are
there any risks at all to use v4.1 as linux-libc-headers in my Yocto build?
The only drawback I see is that it will be a new configuration not well
tested by the community. Are there other risks or drawbacks using your own
version of linux-libc-headers?
I would fork linux-libc-headers to the kernel you are actually using despite the
comment in the file.
That's the only way to export headers from the correct kernel to everyone
who needs them.
There is no other documented way of exporting the actual kernel headers to users
in bitbake builds and SDK.
One optimization I would do is to fork the uapi headers from the actual kernel
recipe so that full system does not need to be recompiled when kernel changes.
One needs to manually track for kernel uapi header changes then.