[OE-core] Sanitized kernel headers

Peter Kjellerstedt peter.kjellerstedt at axis.com
Wed Oct 2 13:45:55 UTC 2013

In a recent commit 
Richard added a big warning about not forking the 
linux-libc-headers recipe to get at specific kernel 
headers for user space. As a consequence I thought I 
should remove our fork of linux-libc-headers and instead 
use the suggested method of including the needed files 
from ${STAGING_KERNEL_DIR} in the recipes that need them.

However, I soon realized that what I need are the sanitized 
headers that are generated by running "make headers_install" 
in the kernel sources. So what I then did was to create a 
simple bbclass that generates them for me and makes them 
available for my recipe:

---- %< ------------- kernel-headers.bbclass --------------
DEPENDS += "virtual/kernel"


inherit kernel-arch

KINCLUDES ?= "${WORKDIR}/kernel-includes"

do_compile_prepend() {
	mkdir -p ${KINCLUDES}
	oe_runmake -C ${STAGING_KERNEL_DIR} headers_install INSTALL_HDR_PATH=${KINCLUDES}
--------------------------------------------------- >% ----

After that I could simply do 'inherit kernel-headers' and 
'CFLAGS += "-I${KINCLUDES}/includes"' in my recipe to get 
at the sanitized kernel headers.

But, it seems somewhat wasteful for each recipe that need 
those headers to do that. Wouldn't it be an idea to provide 
the sanitized headers in ${STAGING_KERNEL_DIR}/usr/include 
(which would be the default path for make headers_install) 
by default?


More information about the Openembedded-core mailing list