From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] glibc and --enable-kernel
Date: Wed, 27 Jan 2016 09:21:19 +0100 [thread overview]
Message-ID: <20160127092119.7cf8953d@free-electrons.com> (raw)
In-Reply-To: <20160127042104.GA6719@tungsten.ozlabs.ibm.com>
Hello!
On Wed, 27 Jan 2016 15:21:04 +1100, Sam Bobroff wrote:
> I've noticed that when building glibc, buildroot's configure command doesn't
> pass any "--enable-kernel" option, which according to the documentation...
>
> http://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
>
> ... means that glibc is always built to support the oldest possible kernel.
>
> At first this seems like a good idea but the documentation is misleading, and
> it actually causes two problems:
>
> 1) Unnecessary compat code: If you've built a kernel and glibc together
> (presumably this is common when using buildroot) then you have no need of any
> compat code because the only kernel you'll be using is the one you just built.
> According to the doc (above) this causes glibc to include unnecessary compat
> code which slows it down.
>
> 2) Availability of new features: It appears from the code that the
> documentation leaves out some important information. What actually happens
> while building glibc is that the "minimum kernel version" (which is either the
> version given by "--enable-kernel=" or the oldest possible version for that
> architecture) sets both __LINUX_KERNEL_VERSION and __ABI_TAG_VERSION so that
> glibc will never use any kernel features *newer* than this version. Therefore
> you cannot get access to recent kernel features *at all* via glibc (without
> manually altering glibc.mk).
Thanks a lot for spotting this problem and for the explanation,
definitely makes sense.
> (An example of a recent feature would be the sendmmsg syscall, which
> requires a kernel version of 3.0.0 but the minimum version for PowerPC 64 is
> 2.6.24.)
Ah, so you're working on PowerPC 64, great! We have a toolchain build
problem that I reported on Power PC 64, when building for Power 8:
http://lists.busybox.net/pipermail/buildroot/2016-January/150338.html
If you have some time to look at it, it would be great.
> I'd like to prepare a patch to make this configurable, and it obviously
> wouldn't be difficult to add but I'm not sure of the best way to do it.
>
> The most obvious way seems to be to add a menu item to the Toolchain menu, just
> after "glibc version" (and only enabled when glibc is the C library), called
> "glibc kernel API version" with a default value of "same as kernel headers".
> The other options would be "as old as possible" or a specific version.
>
> Comments?
I don't think you need to add additional options. We should just use
the kernel version of the chosen kernel headers, since we're guaranteed
that the running kernel will be at least more recent than the kernel
headers being used.
I.e, can you try something such as:
--enable-kernel=$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))
BR2_TOOLCHAIN_HEADERS_AT_LEAST will be 3.0 if you use some 3.0.x kernel
headers for your toolchain.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2016-01-27 8:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 4:21 [Buildroot] glibc and --enable-kernel Sam Bobroff
2016-01-27 8:21 ` Thomas Petazzoni [this message]
2016-01-28 2:55 ` Sam Bobroff
2016-01-28 8:36 ` Thomas Petazzoni
2016-01-28 23:35 ` Arnout Vandecappelle
2016-02-02 13:27 ` Peter Korsgaard
2016-02-02 16:56 ` Mike Frysinger
2016-02-04 4:10 ` Sam Bobroff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160127092119.7cf8953d@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox