kumquat-buildroot/package/linux-headers/linux-headers.mk

138 lines
5.1 KiB
Makefile
Raw Normal View History

################################################################################
#
# linux-headers
#
################################################################################
# This package is used to provide Linux kernel headers for the
# internal toolchain backend.
package/linux-headers: add option to use same sources as the kernel Some heavily (and most often improperly) modified Linux kernels may export new APIs to userland, so as to speak to custom hardware or custom kernel facilities. However, we currently have no easy way to use such kernels as a source for the linux-headers package, which precludes having those userland headers intalled for userland applications to use them. We do have a way for the kernel to use the same version as for the headers, but that is definitely not enough, as the linux-headers package has a version choice that is far less versatile and capable than that of the linux package. Add a new option for the linux-headers package, for the user to specify that the version (really, the sources) of the kernel be used to install the headers from. We do that by making linux-headers patch-depend on the linux package. We can't have linux-header simply depend on linux, because the simple dependency means the the dependee will be configured, built and installed before the dependent is configured. And since linux is a target package, it depends on the toolchain, which internally dependes on linux-headers, which would depend on linux, and we'd get a circular dependency. Using patch-depend will ensure that linux is extracted and patched before linux-headers is extracted, which is really all we need. Then, we install the headers from the linux source tree, rather than from linux-headers' source tree (as there's nothing in there!). Since we need to install a private set for uClibc (see cde947f, uclibc: prevent rebuilding after installation to staging), we explicitly set INSTALL_HDR_PATH when calling the kernel' install-headers rule in LINUX_HEADERS_CONFIGURE_CMDS, so that the headers are installed in linux-headers' $(@D) instead of linux' $(@D). Finally, as there is no way to know the kernel version in this case, we must still prompt the user for the kernel series the headers are from (like we do for a custom version) and check for consistency at build time. Note however that this still leaves users that want to built their such-kernel outside of Buildroot out in the cold. [Peter: drop comment as suggested by Thomas] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Karoly Kasza <kaszak@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <jacmet@uclibc.org> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-01-20 19:34:28 +01:00
ifeq ($(BR2_KERNEL_HEADERS_AS_KERNEL),y)
LINUX_HEADERS_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
# Compute LINUX_HEADERS_SOURCE and LINUX_HEADERS_SITE from the configuration
ifeq ($(BR2_LINUX_KERNEL_CUSTOM_TARBALL),y)
LINUX_HEADERS_TARBALL = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION))
LINUX_HEADERS_SITE = $(patsubst %/,%,$(dir $(LINUX_HEADERS_TARBALL)))
LINUX_HEADERS_SOURCE = $(notdir $(LINUX_HEADERS_TARBALL))
BR_NO_CHECK_HASH_FOR += $(LINUX_HEADERS_SOURCE)
else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_LOCAL),y)
LINUX_HEADERS_SITE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_LOCAL_PATH))
LINUX_HEADERS_SITE_METHOD = local
else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_GIT),y)
LINUX_HEADERS_SITE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL))
LINUX_HEADERS_SITE_METHOD = git
# use same git tarball as linux kernel
LINUX_HEADERS_SOURCE = linux-$(LINUX_HEADERS_VERSION).tar.gz
else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_HG),y)
LINUX_HEADERS_SITE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL))
LINUX_HEADERS_SITE_METHOD = hg
# use same hg tarball as linux kernel
LINUX_HEADERS_SOURCE = linux-$(LINUX_HEADERS_VERSION).tar.gz
else
LINUX_HEADERS_SOURCE = linux-$(LINUX_HEADERS_VERSION).tar.xz
ifeq ($(BR2_LINUX_KERNEL_CUSTOM_VERSION),y)
BR_NO_CHECK_HASH_FOR += $(LINUX_HEADERS_SOURCE)
endif
# In X.Y.Z, get X and Y. We replace dots and dashes by spaces in order
# to use the $(word) function. We support versions such as 4.0, 3.1,
# 2.6.32, 2.6.32-rc1, 3.0-rc6, etc.
ifeq ($(findstring x2.6.,x$(LINUX_HEADERS_VERSION)),x2.6.)
LINUX_HEADERS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/v2.6
else ifeq ($(findstring x3.,x$(LINUX_HEADERS_VERSION)),x3.)
LINUX_HEADERS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/v3.x
else ifeq ($(findstring x4.,x$(LINUX_HEADERS_VERSION)),x4.)
LINUX_HEADERS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/v4.x
endif
# release candidates are in testing/ subdir
ifneq ($(findstring -rc,$(LINUX_HEADERS_VERSION)),)
LINUX_HEADERS_SITE := $(LINUX_HEADERS_SITE)/testing
endif # -rc
endif
package/linux-headers: add option to use same sources as the kernel Some heavily (and most often improperly) modified Linux kernels may export new APIs to userland, so as to speak to custom hardware or custom kernel facilities. However, we currently have no easy way to use such kernels as a source for the linux-headers package, which precludes having those userland headers intalled for userland applications to use them. We do have a way for the kernel to use the same version as for the headers, but that is definitely not enough, as the linux-headers package has a version choice that is far less versatile and capable than that of the linux package. Add a new option for the linux-headers package, for the user to specify that the version (really, the sources) of the kernel be used to install the headers from. We do that by making linux-headers patch-depend on the linux package. We can't have linux-header simply depend on linux, because the simple dependency means the the dependee will be configured, built and installed before the dependent is configured. And since linux is a target package, it depends on the toolchain, which internally dependes on linux-headers, which would depend on linux, and we'd get a circular dependency. Using patch-depend will ensure that linux is extracted and patched before linux-headers is extracted, which is really all we need. Then, we install the headers from the linux source tree, rather than from linux-headers' source tree (as there's nothing in there!). Since we need to install a private set for uClibc (see cde947f, uclibc: prevent rebuilding after installation to staging), we explicitly set INSTALL_HDR_PATH when calling the kernel' install-headers rule in LINUX_HEADERS_CONFIGURE_CMDS, so that the headers are installed in linux-headers' $(@D) instead of linux' $(@D). Finally, as there is no way to know the kernel version in this case, we must still prompt the user for the kernel series the headers are from (like we do for a custom version) and check for consistency at build time. Note however that this still leaves users that want to built their such-kernel outside of Buildroot out in the cold. [Peter: drop comment as suggested by Thomas] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Karoly Kasza <kaszak@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <jacmet@uclibc.org> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-01-20 19:34:28 +01:00
LINUX_HEADERS_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH))
# We rely on the generic package infrastructure to download and apply
# remote patches (downloaded from ftp, http or https). For local
# patches, we can't rely on that infrastructure, because there might
# be directories in the patch list (unlike for other packages).
LINUX_HEADERS_PATCH = $(filter ftp://% http://% https://%,$(LINUX_HEADERS_PATCHES))
define LINUX_HEADERS_APPLY_LOCAL_PATCHES
for p in $(filter-out ftp://% http://% https://%,$(LINUX_HEADERS_PATCHES)) ; do \
if test -d $$p ; then \
$(APPLY_PATCHES) $(@D) $$p \*.patch || exit 1 ; \
else \
$(APPLY_PATCHES) $(@D) `dirname $$p` `basename $$p` || exit 1; \
fi \
done
endef
package/linux-headers: add option to use same sources as the kernel Some heavily (and most often improperly) modified Linux kernels may export new APIs to userland, so as to speak to custom hardware or custom kernel facilities. However, we currently have no easy way to use such kernels as a source for the linux-headers package, which precludes having those userland headers intalled for userland applications to use them. We do have a way for the kernel to use the same version as for the headers, but that is definitely not enough, as the linux-headers package has a version choice that is far less versatile and capable than that of the linux package. Add a new option for the linux-headers package, for the user to specify that the version (really, the sources) of the kernel be used to install the headers from. We do that by making linux-headers patch-depend on the linux package. We can't have linux-header simply depend on linux, because the simple dependency means the the dependee will be configured, built and installed before the dependent is configured. And since linux is a target package, it depends on the toolchain, which internally dependes on linux-headers, which would depend on linux, and we'd get a circular dependency. Using patch-depend will ensure that linux is extracted and patched before linux-headers is extracted, which is really all we need. Then, we install the headers from the linux source tree, rather than from linux-headers' source tree (as there's nothing in there!). Since we need to install a private set for uClibc (see cde947f, uclibc: prevent rebuilding after installation to staging), we explicitly set INSTALL_HDR_PATH when calling the kernel' install-headers rule in LINUX_HEADERS_CONFIGURE_CMDS, so that the headers are installed in linux-headers' $(@D) instead of linux' $(@D). Finally, as there is no way to know the kernel version in this case, we must still prompt the user for the kernel series the headers are from (like we do for a custom version) and check for consistency at build time. Note however that this still leaves users that want to built their such-kernel outside of Buildroot out in the cold. [Peter: drop comment as suggested by Thomas] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Karoly Kasza <kaszak@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <jacmet@uclibc.org> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-01-20 19:34:28 +01:00
LINUX_HEADERS_POST_PATCH_HOOKS += LINUX_HEADERS_APPLY_LOCAL_PATCHES
package/linux-headers: add option to use same sources as the kernel Some heavily (and most often improperly) modified Linux kernels may export new APIs to userland, so as to speak to custom hardware or custom kernel facilities. However, we currently have no easy way to use such kernels as a source for the linux-headers package, which precludes having those userland headers intalled for userland applications to use them. We do have a way for the kernel to use the same version as for the headers, but that is definitely not enough, as the linux-headers package has a version choice that is far less versatile and capable than that of the linux package. Add a new option for the linux-headers package, for the user to specify that the version (really, the sources) of the kernel be used to install the headers from. We do that by making linux-headers patch-depend on the linux package. We can't have linux-header simply depend on linux, because the simple dependency means the the dependee will be configured, built and installed before the dependent is configured. And since linux is a target package, it depends on the toolchain, which internally dependes on linux-headers, which would depend on linux, and we'd get a circular dependency. Using patch-depend will ensure that linux is extracted and patched before linux-headers is extracted, which is really all we need. Then, we install the headers from the linux source tree, rather than from linux-headers' source tree (as there's nothing in there!). Since we need to install a private set for uClibc (see cde947f, uclibc: prevent rebuilding after installation to staging), we explicitly set INSTALL_HDR_PATH when calling the kernel' install-headers rule in LINUX_HEADERS_CONFIGURE_CMDS, so that the headers are installed in linux-headers' $(@D) instead of linux' $(@D). Finally, as there is no way to know the kernel version in this case, we must still prompt the user for the kernel series the headers are from (like we do for a custom version) and check for consistency at build time. Note however that this still leaves users that want to built their such-kernel outside of Buildroot out in the cold. [Peter: drop comment as suggested by Thomas] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Karoly Kasza <kaszak@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <jacmet@uclibc.org> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-01-20 19:34:28 +01:00
else # ! BR2_KERNEL_HEADERS_AS_KERNEL
LINUX_HEADERS_VERSION = $(call qstrip,$(BR2_DEFAULT_KERNEL_HEADERS))
ifeq ($(findstring x2.6.,x$(LINUX_HEADERS_VERSION)),x2.6.)
LINUX_HEADERS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/v2.6
else ifeq ($(findstring x3.,x$(LINUX_HEADERS_VERSION)),x3.)
LINUX_HEADERS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/v3.x
else ifeq ($(findstring x4.,x$(LINUX_HEADERS_VERSION)),x4.)
LINUX_HEADERS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/v4.x
endif
LINUX_HEADERS_SOURCE = linux-$(LINUX_HEADERS_VERSION).tar.xz
package/linux-headers: add option to use same sources as the kernel Some heavily (and most often improperly) modified Linux kernels may export new APIs to userland, so as to speak to custom hardware or custom kernel facilities. However, we currently have no easy way to use such kernels as a source for the linux-headers package, which precludes having those userland headers intalled for userland applications to use them. We do have a way for the kernel to use the same version as for the headers, but that is definitely not enough, as the linux-headers package has a version choice that is far less versatile and capable than that of the linux package. Add a new option for the linux-headers package, for the user to specify that the version (really, the sources) of the kernel be used to install the headers from. We do that by making linux-headers patch-depend on the linux package. We can't have linux-header simply depend on linux, because the simple dependency means the the dependee will be configured, built and installed before the dependent is configured. And since linux is a target package, it depends on the toolchain, which internally dependes on linux-headers, which would depend on linux, and we'd get a circular dependency. Using patch-depend will ensure that linux is extracted and patched before linux-headers is extracted, which is really all we need. Then, we install the headers from the linux source tree, rather than from linux-headers' source tree (as there's nothing in there!). Since we need to install a private set for uClibc (see cde947f, uclibc: prevent rebuilding after installation to staging), we explicitly set INSTALL_HDR_PATH when calling the kernel' install-headers rule in LINUX_HEADERS_CONFIGURE_CMDS, so that the headers are installed in linux-headers' $(@D) instead of linux' $(@D). Finally, as there is no way to know the kernel version in this case, we must still prompt the user for the kernel series the headers are from (like we do for a custom version) and check for consistency at build time. Note however that this still leaves users that want to built their such-kernel outside of Buildroot out in the cold. [Peter: drop comment as suggested by Thomas] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Karoly Kasza <kaszak@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <jacmet@uclibc.org> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-01-20 19:34:28 +01:00
endif # ! BR2_KERNEL_HEADERS_AS_KERNEL
LINUX_HEADERS_LICENSE = GPLv2
LINUX_HEADERS_LICENSE_FILES = COPYING
LINUX_HEADERS_INSTALL_STAGING = YES
# linux-headers is part of the toolchain so disable the toolchain dependency
LINUX_HEADERS_ADD_TOOLCHAIN_DEPENDENCY = NO
# For some architectures (eg. Arc, Cris, Hexagon, ia64, parisc,
# score and xtensa), the Linux buildsystem tries to call the
# cross-compiler, although it is not needed at all.
# This results in seemingly errors like:
# [...]/scripts/gcc-version.sh: line 26: arc-linux-uclibc-gcc: command not found
# Those can be safely ignored.
uclibc: prevent rebuilding after installation to staging Currently we configure uClibc to use kernel headers from "staging" folder with KERNEL_HEADERS="$(STAGING_DIR)/usr/include". This path is added to include search path of uClibc build system in Rules.mak "CFLAGS += -I$(KERNEL_HEADERS)". At the same time on uClibc installation to "staging" we point to the same location "$(STAGING_DIR)/usr" (headers effectively go in "usr/include"). So after every installation to "staging" dependences get touched (even though we copy the same headers every time) and so we may see lots of sources in uClibc get rebuilt. This has 2 consequences: 1. Longer build time - becase even on ordinary buildroot build uClibc is built twice. On "uclibc building" and on "uclibc installation to target". 2. Symbols in libuClibc built initially (that is later installed in "staging/sysroot") are situated with different offset compared to second build (later copied in "target"). This happens because as described above only part of sources get rebuilt and then on final linkage object files are linked in different order. And (2) leads to problems on remote rebugging: gdbserver reports offsets that correspond to pointless assembly in libuClibc on host. Here's how it looks like. Before this patch: $ cd ~/br2_output/i586/target/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000c42c 54 FUNC GLOBAL DEFAULT 7 kill $ cd ~/br2_output/i586/staging/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000b518 54 FUNC GLOBAL DEFAULT 7 kill After this patch: $ cd ~/br2_output/i586/target/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000b518 54 FUNC GLOBAL DEFAULT 7 kill $ cd ~/br2_output/i586/staging/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000b518 54 FUNC GLOBAL DEFAULT 7 kill Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Noam Camus <noamc@ezchip.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-06-04 22:27:33 +02:00
# This step is required to have a separate linux headers location for
# uClibc building. This way uClibc doesn't modify linux headers on installation
# of "its" headers
define LINUX_HEADERS_CONFIGURE_CMDS
(cd $(@D); \
uclibc: prevent rebuilding after installation to staging Currently we configure uClibc to use kernel headers from "staging" folder with KERNEL_HEADERS="$(STAGING_DIR)/usr/include". This path is added to include search path of uClibc build system in Rules.mak "CFLAGS += -I$(KERNEL_HEADERS)". At the same time on uClibc installation to "staging" we point to the same location "$(STAGING_DIR)/usr" (headers effectively go in "usr/include"). So after every installation to "staging" dependences get touched (even though we copy the same headers every time) and so we may see lots of sources in uClibc get rebuilt. This has 2 consequences: 1. Longer build time - becase even on ordinary buildroot build uClibc is built twice. On "uclibc building" and on "uclibc installation to target". 2. Symbols in libuClibc built initially (that is later installed in "staging/sysroot") are situated with different offset compared to second build (later copied in "target"). This happens because as described above only part of sources get rebuilt and then on final linkage object files are linked in different order. And (2) leads to problems on remote rebugging: gdbserver reports offsets that correspond to pointless assembly in libuClibc on host. Here's how it looks like. Before this patch: $ cd ~/br2_output/i586/target/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000c42c 54 FUNC GLOBAL DEFAULT 7 kill $ cd ~/br2_output/i586/staging/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000b518 54 FUNC GLOBAL DEFAULT 7 kill After this patch: $ cd ~/br2_output/i586/target/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000b518 54 FUNC GLOBAL DEFAULT 7 kill $ cd ~/br2_output/i586/staging/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000b518 54 FUNC GLOBAL DEFAULT 7 kill Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Noam Camus <noamc@ezchip.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-06-04 22:27:33 +02:00
$(TARGET_MAKE_ENV) $(MAKE) \
ARCH=$(KERNEL_ARCH) \
HOSTCC="$(HOSTCC)" \
HOSTCFLAGS="$(HOSTCFLAGS)" \
HOSTCXX="$(HOSTCXX)" \
package/linux-headers: add option to use same sources as the kernel Some heavily (and most often improperly) modified Linux kernels may export new APIs to userland, so as to speak to custom hardware or custom kernel facilities. However, we currently have no easy way to use such kernels as a source for the linux-headers package, which precludes having those userland headers intalled for userland applications to use them. We do have a way for the kernel to use the same version as for the headers, but that is definitely not enough, as the linux-headers package has a version choice that is far less versatile and capable than that of the linux package. Add a new option for the linux-headers package, for the user to specify that the version (really, the sources) of the kernel be used to install the headers from. We do that by making linux-headers patch-depend on the linux package. We can't have linux-header simply depend on linux, because the simple dependency means the the dependee will be configured, built and installed before the dependent is configured. And since linux is a target package, it depends on the toolchain, which internally dependes on linux-headers, which would depend on linux, and we'd get a circular dependency. Using patch-depend will ensure that linux is extracted and patched before linux-headers is extracted, which is really all we need. Then, we install the headers from the linux source tree, rather than from linux-headers' source tree (as there's nothing in there!). Since we need to install a private set for uClibc (see cde947f, uclibc: prevent rebuilding after installation to staging), we explicitly set INSTALL_HDR_PATH when calling the kernel' install-headers rule in LINUX_HEADERS_CONFIGURE_CMDS, so that the headers are installed in linux-headers' $(@D) instead of linux' $(@D). Finally, as there is no way to know the kernel version in this case, we must still prompt the user for the kernel series the headers are from (like we do for a custom version) and check for consistency at build time. Note however that this still leaves users that want to built their such-kernel outside of Buildroot out in the cold. [Peter: drop comment as suggested by Thomas] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Karoly Kasza <kaszak@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <jacmet@uclibc.org> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-01-20 19:34:28 +01:00
INSTALL_HDR_PATH=$(@D)/usr \
uclibc: prevent rebuilding after installation to staging Currently we configure uClibc to use kernel headers from "staging" folder with KERNEL_HEADERS="$(STAGING_DIR)/usr/include". This path is added to include search path of uClibc build system in Rules.mak "CFLAGS += -I$(KERNEL_HEADERS)". At the same time on uClibc installation to "staging" we point to the same location "$(STAGING_DIR)/usr" (headers effectively go in "usr/include"). So after every installation to "staging" dependences get touched (even though we copy the same headers every time) and so we may see lots of sources in uClibc get rebuilt. This has 2 consequences: 1. Longer build time - becase even on ordinary buildroot build uClibc is built twice. On "uclibc building" and on "uclibc installation to target". 2. Symbols in libuClibc built initially (that is later installed in "staging/sysroot") are situated with different offset compared to second build (later copied in "target"). This happens because as described above only part of sources get rebuilt and then on final linkage object files are linked in different order. And (2) leads to problems on remote rebugging: gdbserver reports offsets that correspond to pointless assembly in libuClibc on host. Here's how it looks like. Before this patch: $ cd ~/br2_output/i586/target/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000c42c 54 FUNC GLOBAL DEFAULT 7 kill $ cd ~/br2_output/i586/staging/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000b518 54 FUNC GLOBAL DEFAULT 7 kill After this patch: $ cd ~/br2_output/i586/target/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000b518 54 FUNC GLOBAL DEFAULT 7 kill $ cd ~/br2_output/i586/staging/lib $ i586-buildroot-linux-uclibc-readelf -s libuClibc-0.9.33.2.so | grep kill 423: 0000b518 54 FUNC GLOBAL DEFAULT 7 kill Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Noam Camus <noamc@ezchip.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-06-04 22:27:33 +02:00
headers_install)
endef
define LINUX_HEADERS_INSTALL_STAGING_CMDS
(cd $(@D); \
$(TARGET_MAKE_ENV) $(MAKE) \
ARCH=$(KERNEL_ARCH) \
HOSTCC="$(HOSTCC)" \
HOSTCFLAGS="$(HOSTCFLAGS)" \
HOSTCXX="$(HOSTCXX)" \
INSTALL_HDR_PATH=$(STAGING_DIR)/usr \
headers_install)
endef
package/linux-headers: add option to use same sources as the kernel Some heavily (and most often improperly) modified Linux kernels may export new APIs to userland, so as to speak to custom hardware or custom kernel facilities. However, we currently have no easy way to use such kernels as a source for the linux-headers package, which precludes having those userland headers intalled for userland applications to use them. We do have a way for the kernel to use the same version as for the headers, but that is definitely not enough, as the linux-headers package has a version choice that is far less versatile and capable than that of the linux package. Add a new option for the linux-headers package, for the user to specify that the version (really, the sources) of the kernel be used to install the headers from. We do that by making linux-headers patch-depend on the linux package. We can't have linux-header simply depend on linux, because the simple dependency means the the dependee will be configured, built and installed before the dependent is configured. And since linux is a target package, it depends on the toolchain, which internally dependes on linux-headers, which would depend on linux, and we'd get a circular dependency. Using patch-depend will ensure that linux is extracted and patched before linux-headers is extracted, which is really all we need. Then, we install the headers from the linux source tree, rather than from linux-headers' source tree (as there's nothing in there!). Since we need to install a private set for uClibc (see cde947f, uclibc: prevent rebuilding after installation to staging), we explicitly set INSTALL_HDR_PATH when calling the kernel' install-headers rule in LINUX_HEADERS_CONFIGURE_CMDS, so that the headers are installed in linux-headers' $(@D) instead of linux' $(@D). Finally, as there is no way to know the kernel version in this case, we must still prompt the user for the kernel series the headers are from (like we do for a custom version) and check for consistency at build time. Note however that this still leaves users that want to built their such-kernel outside of Buildroot out in the cold. [Peter: drop comment as suggested by Thomas] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Karoly Kasza <kaszak@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <jacmet@uclibc.org> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-01-20 19:34:28 +01:00
ifeq ($(BR2_KERNEL_HEADERS_VERSION)$(BR2_KERNEL_HEADERS_AS_KERNEL),y)
define LINUX_HEADERS_CHECK_VERSION
$(call check_kernel_headers_version,\
support/check-kernel-headers: fix old custom toolchains without -print-sysroot Old toolchains, with old gcc that do not support -print-sysroot, break the kernel-headers version check script: it fails to find the sysroot of the toolchain, and thus ends up including the host's linux/version.h. Most of the time, this will break early, since the host's kernel headers will not match the toolchain settings. But it can happen that the check is succesful, although the configuration of the toolchain is wrong: - the custom toolchain has kernel headers vX.Y - the user selected vX.Z (Z!=Y) - the host has headers vX.Y In this case, the check passes OK, but the build of some packages later on will break (which is exactly what those _AT_LEAST_XXX options were added to avoid). Fix that by passing the sysroot to the check script, instead of the cross compiler. We get the sysroot as thus: - for custom toolchains, we use the macro toolchain_find_sysroot. We can do that, because we already have a complete sysroot with libc.a at that time. - for internal toolchain using a custom kernel headers version, we just use $(STAGING_DIR). We can't use the macro as for custom toolchains above, because at the time we install the kernel headers, we do not yet have a complete sysroot with a libc.a. But we can just use $(STAGING_DIR), since we're only interested in the kernel headers. For all other types of toolchains, we already have the _AT_LEAST_XXX options properly set, so we need not add a check in this case. Fixes: http://autobuild.buildroot.net/results/f33/f331a6eff0b0b93c73af52db3a6b43e4e598577e/ http://autobuild.buildroot.net/results/a57/a5797c025bec50c10efdcff74945aab4021d05e4/ [...] [Thanks to Thomas for pointing out the toolchain_find_sysroot macro!] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-04-07 20:19:12 +02:00
$(STAGING_DIR),\
$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)))
endef
LINUX_HEADERS_POST_INSTALL_STAGING_HOOKS += LINUX_HEADERS_CHECK_VERSION
endif
$(eval $(generic-package))