[Buildroot] [PATCH] linux: add an option to install kernel headers into staging

Nicolas Serafini nicolas.serafini at sensefly.com
Wed Mar 25 10:00:11 UTC 2015


Danomi, All,

On Tue, 24 Mar 2015 15:45:40 -0400
Danomi Manchego <danomimanchego123 at gmail.com> wrote:

> Nicolas,
> 
> On Tue, Mar 24, 2015 at 6:00 AM, Nicolas Serafini
> <nicolas.serafini at sensefly.com> wrote:
> > The kernel headers are installed into /usr/src/linux-headers-version
> > of the staging folder.
> >
> > These headers can be used, for example, by a post build script to
> > install or update some new headers from the kernel in /usr/include
> > of the staging.
> >
> > Signed-off-by: Nicolas Serafini <nicolas.serafini at sensefly.com>
> > ---
> >  linux/Config.in | 6 ++++++
> >  linux/linux.mk  | 9 +++++++++
> >  2 files changed, 15 insertions(+)
> >
> > diff --git a/linux/Config.in b/linux/Config.in
> > index fa3232f..dd97211 100644
> > --- a/linux/Config.in
> > +++ b/linux/Config.in
> > @@ -354,6 +354,12 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
> >           /boot if DTBs have been generated by the kernel build
> >           process.
> >
> > +config BR2_LINUX_KERNEL_INSTALL_HEADERS
> > +       bool "Install kernel headers to staging"
> > +       help
> > +         Select this option to have the kernel headers installed to
> > +         staging in /usr/src/linux-headers-version folder.
> > +
> >  # Linux extensions
> >  source "linux/Config.ext.in"
> >
> > diff --git a/linux/linux.mk b/linux/linux.mk
> > index 5a0ba01..c7792d4 100644
> > --- a/linux/linux.mk
> > +++ b/linux/linux.mk
> > @@ -7,6 +7,9 @@
> >  LINUX_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
> >  LINUX_LICENSE = GPLv2
> >  LINUX_LICENSE_FILES = COPYING
> > +ifeq ($(BR2_LINUX_KERNEL_INSTALL_HEADERS),y)
> > +LINUX_INSTALL_STAGING=YES
> > +endif
> >
> >  # Compute LINUX_SOURCE and LINUX_SITE from the configuration
> >  ifeq ($(BR2_LINUX_KERNEL_CUSTOM_TARBALL),y)
> > @@ -54,6 +57,7 @@ LINUX_MAKE_FLAGS = \
> >         HOSTCFLAGS="$(HOSTCFLAGS)" \
> >         ARCH=$(KERNEL_ARCH) \
> >         INSTALL_MOD_PATH=$(TARGET_DIR) \
> > +
> > INSTALL_HDR_PATH="$(STAGING_DIR)/usr/src/linux-headers-$(LINUX_VERSION)"
> > \ CROSS_COMPILE="$(CCACHE) $(TARGET_CROSS)" \
> > DEPMOD=$(HOST_DIR)/sbin/depmod
> >
> > @@ -297,6 +301,11 @@ define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET
> >  endef
> >  endif
> >
> > +ifeq ($(BR2_LINUX_KERNEL_INSTALL_HEADERS),y)
> > +define LINUX_INSTALL_STAGING_CMDS
> > +       $(LINUX_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D)
> > $(LINUX_TARGET_NAME) headers_install +endef
> > +endif
> 
> Adding this is as a linux staging command means that it could install
> the header files after other stuff gets built and installed, no?  I'm
> wondering if this will imply needing (or recommending) to add
> dependency on "linux" to other packages that might use kernel headers.
> Things which write to the fb devices, for example.

You do not need dependency on these staging headers because kernel
headers are already installed by the toolchain and are parts of the C
library.

Regards,
Nicolas

> 
> No objection here, I'm just thinking about the use case.
> 
> Danomi -
> 
> 
> >  define LINUX_INSTALL_HOST_TOOLS
> >         # Installing dtc (device tree compiler) as host tool, if
> > selected --
> > 2.3.4
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot at busybox.net
> > http://lists.busybox.net/mailman/listinfo/buildroot



-- 
Nicolas Serafini
R&D Embedded Software Engineer

www.sensefly.com
Route de Genève 38
1033 Cheseaux-Lausanne
Switzerland


More information about the buildroot mailing list