Skip to contentSkip to conversation

linux: add an option to install kernel headers into staging

PATCH New Nicolas Serafini 4 participants 7 messages Mar 24, 2015 – Mar 25, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux: add an option to install kernel headers into staging

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.

---
 linux/Config.in | 6 ++++++
 linux/linux.mk  | 9 +++++++++
 2 files changed, 15 insertions(+)
linux/Config.in +6 -0
index fa3232f..dd97211 100644
@@ -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"
 
linux/linux.mk +9 -0
index 5a0ba01..c7792d4 100644
@@ -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
 
 define LINUX_INSTALL_HOST_TOOLS
 	# Installing dtc (device tree compiler) as host tool, if selected
Signature · 1 line
2.3.4
#1 lore raw

PATCH 1/1 linux: add an option to install kernel headers into staging

Nicolas,

Quoted 53 lines · Nicolas Serafini

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.

---
 linux/Config.in | 6 ++++++
 linux/linux.mk  | 9 +++++++++
 2 files changed, 15 insertions(+)
linux/Config.in +6 -0
index fa3232f..dd97211 100644
@@ -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"
 
linux/linux.mk +4 -0
index 5a0ba01..c7792d4 100644
@@ -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
 

linux/linux.mk define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET · line 308

Quoted 8 lines
linux/linux.mk +5 -0
@@ -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.

No objection here, I'm just thinking about the use case.

Danomi -

Quoted 9 lines
linux/linux.mk +0 -1
 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

#2 lore raw

PATCH 1/1 linux: add an option to install kernel headers into staging

Danomi, All,

Quoted 61 lines · On Tue, 24 Mar 2015 15:45:40 -0400 Danomi Manchego…

Nicolas,

Quoted 57 lines · Nicolas Serafini

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.

---
 linux/Config.in | 6 ++++++
 linux/linux.mk  | 9 +++++++++
 2 files changed, 15 insertions(+)
linux/Config.in +6 -0
index fa3232f..dd97211 100644
@@ -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"
 
linux/linux.mk +4 -0
index 5a0ba01..c7792d4 100644
@@ -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

linux/linux.mk +0 -0
@@ -297,6 +301,11 @@ define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET
 endef
 endif
 
Quoted 11 lines
Quoted 5 lines
linux/linux.mk +3 -0
+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

Quoted 15 lines

No objection here, I'm just thinking about the use case.

Danomi -

Quoted 9 lines

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

Signature · 7 lines
Nicolas Serafini
R&D Embedded Software Engineer

www.sensefly.com
Route de Gen?ve 38
1033 Cheseaux-Lausanne
Switzerland
#3 lore raw

PATCH 1/1 linux: add an option to install kernel headers into staging

In reply to Nicolas Serafini

Nicolas, All,

On 2015-03-24 11:00 +0100, Nicolas Serafini spake thusly:

Quoted 6 lines

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.

No, no. The kernel headers in staging are those that come from the toolchain.

When the toolchain has been compiled, parts of it (notably the C library) have been configured according to whatever API/ABI the kernel headers where exporting to userland. Those headers can *not* be changed after the fact.

So, this is a big NAK from me, sorry.

Regards,
Yann E. MORIN.

Quoted 64 lines
---
 linux/Config.in | 6 ++++++
 linux/linux.mk  | 9 +++++++++
 2 files changed, 15 insertions(+)
linux/Config.in +6 -0
index fa3232f..dd97211 100644
@@ -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"
 
linux/linux.mk +9 -0
index 5a0ba01..c7792d4 100644
@@ -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
 
 define LINUX_INSTALL_HOST_TOOLS
 	# Installing dtc (device tree compiler) as host tool, if selected
Signature · 6 lines
2.3.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 linux: add an option to install kernel headers into staging

Yann, All,

Quoted 6 lines · On Tue, 24 Mar 2015 21:57:09 +0100 "Yann E. MORIN" <[email protected]>…

Nicolas, All,

On 2015-03-24 11:00 +0100, Nicolas Serafini spake thusly:

Quoted 3 lines

The kernel headers are installed into /usr/src/linux-headers-version of the staging folder.

Quoted 6 lines
Quoted 3 lines

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.

No, no. The kernel headers in staging are those that come from the toolchain.

Yes I'm ok with that.

Quoted 7 lines

When the toolchain has been compiled, parts of it (notably the C library) have been configured according to whatever API/ABI the kernel headers where exporting to userland. Those headers can *not* be changed after the fact.

So, this is a big NAK from me, sorry.

It's possible my example is not good. I'm ok with the fact that headers can not be changed after but if you have a custom kernel with new custom API and you want to build userspace software that use theses API you need to have new headers into staging.

I'm going to explain my case. For me Buildroot is a part of a biggest build system. Buildroot is used to build/generate the bootloader, the kernel and the rootfs. After that, the global build system use the output of buildroot to build our own software.

I have a custom kernel with new API that are used by some userspace software and this patch give only a way to retrieve these cleaned headers (#ifdef KERNEL removed) correctly exported by the kernel instead of taking headers directly into the kernel source. It's why theses headers are into /usr/src/linux-headers-version instead of /usr/include

Regards,

Nicolas

Quoted 70 lines

Regards,
Yann E. MORIN.

Quoted 65 lines
---
 linux/Config.in | 6 ++++++
 linux/linux.mk  | 9 +++++++++
 2 files changed, 15 insertions(+)
linux/Config.in +4 -0
index fa3232f..dd97211 100644
@@ -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

linux/Config.in +2 -0
+	  staging in /usr/src/linux-headers-version folder.
+
 # Linux extensions
 source "linux/Config.ext.in"
linux/linux.mk +4 -0
index 5a0ba01..c7792d4 100644
@@ -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

linux/linux.mk +3 -0
@@ -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

linux/linux.mk +1 -0
+endif
 
 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

Signature · 7 lines
Nicolas Serafini
R&D Embedded Software Engineer

www.sensefly.com
Route de Gen?ve 38
1033 Cheseaux-Lausanne
Switzerland
#5 lore raw

PATCH 1/1 linux: add an option to install kernel headers into staging

In reply to Nicolas Serafini

Dear Nicolas Serafini,

Quoted 6 lines · Nicolas Serafini

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.

Can you give some more details and background about the issue you're trying to solve? You're only explaining what your solution is, but not what the original problem is.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 linux: add an option to install kernel headers into staging

Thomas, all,

Quoted 6 lines · On Wed, 25 Mar 2015 00:57:55 +0100 Thomas Petazzoni…

Dear Nicolas Serafini,

Quoted 3 lines · Nicolas Serafini

The kernel headers are installed into /usr/src/linux-headers-version of the staging folder.

Quoted 7 lines
Quoted 3 lines

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.

Can you give some more details and background about the issue you're trying to solve? You're only explaining what your solution is, but not what the original problem is.

I have explain my problem in the mail response to Yann.

Regards,
Nicolas

Quoted 4 lines

Best regards,

Thomas

Signature · 7 lines
Nicolas Serafini
R&D Embedded Software Engineer

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