The kernel header guard to ensure that headers aren't included from userland moved in commit 69c8f52b. This causes the following message to be emitted when building klibc (which is designed to use kernel headers explicitly): /usr/local/src/git/linux-2.6//include/linux/types.h:13:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" In order to silence this warning, make sure we define __EXPORTED_HEADERS__ when building klibc userland. Signed-off-by: Mike Waychison <mikew at google.com> --- scripts/Kbuild.klibc | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc index fb399f5..52a95c4 100644 --- a/scripts/Kbuild.klibc +++ b/scripts/Kbuild.klibc @@ -74,7 +74,7 @@ KLIBCWARNFLAGS := -W -Wall -Wno-sign-compare -Wno-unused-parameter KLIBCSHAREDFLAGS : KLIBCBITSIZE : KLIBCLDFLAGS :-KLIBCCFLAGS :+KLIBCCFLAGS := -D__EXPORTED_HEADERS__ # Defaults for arch to override KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include -- 1.7.3.1
On Thursday 24 February 2011, Mike Waychison wrote:> The kernel header guard to ensure that headers aren't included from > userland moved in commit 69c8f52b. This causes the following message to > be emitted when building klibc (which is designed to use kernel headers > explicitly): > > /usr/local/src/git/linux-2.6//include/linux/types.h:13:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" > > In order to silence this warning, make sure we define > __EXPORTED_HEADERS__ when building klibc userland. > > Signed-off-by: Mike Waychison <mikew at google.com>Well, klibc uses the kernel headers, but I don't think it's a good idea to use them directly without make headers_install. Since klibc also doesn't set -D__KERNEL__, the result should be the same, except that it makes sure not to use any headers that are meant to be internal. Arnd
On Thu, Feb 24, 2011 at 6:19 AM, Arnd Bergmann <arnd at arndb.de> wrote:> On Thursday 24 February 2011, Mike Waychison wrote: >> The kernel header guard to ensure that headers aren't included from >> userland moved in commit 69c8f52b. ?This causes the following message to >> be emitted when building klibc (which is designed to use kernel headers >> explicitly): >> >> /usr/local/src/git/linux-2.6//include/linux/types.h:13:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" >> >> In order to silence this warning, make sure we define >> __EXPORTED_HEADERS__ when building klibc userland. >> >> Signed-off-by: Mike Waychison <mikew at google.com> > > Well, klibc uses the kernel headers, but I don't think it's a good idea > to use them directly without make headers_install. Since klibc also > doesn't set -D__KERNEL__, the result should be the same, except that > it makes sure not to use any headers that are meant to be internal.I'm not sure I follow. The warning happens when __KERNEL__ isn't set. Also, the build for klibc explicitly supports using kernel headers without installing them first via setting KLIBCKERNELSRC.
On Sun, Feb 27, 2011 at 12:07 PM, Arnd Bergmann <arnd at arndb.de> wrote:> On Saturday 26 February 2011, Sam Ravnborg wrote: >> > >> > What you are proposing seems to me like a step towards giving up on >> > this noble goal :( >> You seem to be confusing something here. Even if klibc is one day >> included in the kernel source then we should continue to use >> the headers generated using "make headers_install" for building klibc. > > Absolutely, yes. > > Mike, just think of the generated header files as intermediate files > required for building, just like the .o files that are use to build > the library.How is one expected to test if the files should be rebuild or not? Forcing a headers_install as part of a build will cause the entire userland to be rebuilt.
On Monday 28 February 2011, Mike Waychison wrote:> How is one expected to test if the files should be rebuild or not? > Forcing a headers_install as part of a build will cause the entire > userland to be rebuilt.How about changing headers_install to only install files that have changed? Make headers_install alreadh knows the list of all files it is installing. Arnd
On Mon, Feb 28, 2011 at 01:11:16PM +0100, Arnd Bergmann wrote:> On Monday 28 February 2011, Mike Waychison wrote: > > How is one expected to test if the files should be rebuild or not? > > Forcing a headers_install as part of a build will cause the entire > > userland to be rebuilt. > > How about changing headers_install to only install files that have > changed? Make headers_install alreadh knows the list of all files > it is installing.make headers_install already does so. Only changes fiels are updated. So I consider this a non-issue. Sam
Reasonably Related Threads
- [PATCH] Update header locations for uapi & generated
- [PATCH 00/16] External building, update for 2.6.33 and multiple root devices.
- Replacing kernel-headers with custom compiled version (from kernel.org) - safe?
- [PATCH v2 0/4] Support drop directories directly from kinit
- [RFC PATCH v1 0/2] virtio_net: Better low memory handling.