2003-09-14 13:38:35 +02:00
|
|
|
#############################################################
|
|
|
|
#
|
2007-08-22 14:35:41 +02:00
|
|
|
# Setup the kernel headers. I include a generic package of
|
2003-09-14 13:38:35 +02:00
|
|
|
# kernel headers here, so you shouldn't need to include your
|
2007-08-22 14:35:41 +02:00
|
|
|
# own. Be aware these kernel headers _will_ get blown away
|
2003-09-14 13:38:35 +02:00
|
|
|
# by a 'make clean' so don't put anything sacred in here...
|
|
|
|
#
|
|
|
|
#############################################################
|
2008-06-13 16:28:57 +02:00
|
|
|
|
2009-07-30 17:35:26 +02:00
|
|
|
DEFAULT_KERNEL_HEADERS:=$(call qstrip,$(BR2_DEFAULT_KERNEL_HEADERS))
|
2008-01-10 10:30:11 +01:00
|
|
|
|
2004-10-05 09:16:53 +02:00
|
|
|
LINUX_HEADERS_SITE:=127.0.0.1
|
|
|
|
LINUX_HEADERS_SOURCE:=unspecified-kernel-headers
|
2009-09-23 01:30:00 +02:00
|
|
|
LINUX_HEADERS_UNPACK_DIR:=$(TOOLCHAIN_DIR)/linux-libc-headers-null
|
2004-09-03 02:49:43 +02:00
|
|
|
|
2010-12-13 21:52:16 +01:00
|
|
|
# parse linux version string
|
|
|
|
LNXVER:=$(subst ., , $(strip $(DEFAULT_KERNEL_HEADERS)))
|
|
|
|
VERSION:=$(word 1, $(LNXVER))
|
|
|
|
PATCHLEVEL:=$(word 2, $(LNXVER))
|
|
|
|
SUBLEVEL:=$(word 3, $(LNXVER))
|
|
|
|
EXTRAVERSION:=$(word 4, $(LNXVER))
|
|
|
|
LOCALVERSION:=
|
|
|
|
|
|
|
|
# should contain prepended dot
|
|
|
|
SUBLEVEL:=$(if $(SUBLEVEL),.$(SUBLEVEL),)
|
|
|
|
EXTRAVERSION:=$(if $(EXTRAVERSION),.$(EXTRAVERSION),)
|
|
|
|
|
|
|
|
LINUX_HEADERS_VERSION:=$(VERSION).$(PATCHLEVEL)$(SUBLEVEL)$(EXTRAVERSION)
|
2011-07-22 09:08:36 +02:00
|
|
|
ifeq ($(findstring x2.6.,x$(DEFAULT_KERNEL_HEADERS)),x2.6.)
|
2013-04-12 11:40:30 +02:00
|
|
|
LINUX_HEADERS_SITE:=$(BR2_KERNEL_MIRROR:/=)/linux/kernel/v2.6/
|
2011-07-22 09:08:36 +02:00
|
|
|
else
|
2013-04-12 11:40:30 +02:00
|
|
|
LINUX_HEADERS_SITE:=$(BR2_KERNEL_MIRROR:/=)/linux/kernel/v3.x/
|
2011-07-22 09:08:36 +02:00
|
|
|
endif
|
2010-12-13 21:52:16 +01:00
|
|
|
LINUX_HEADERS_SOURCE:=linux-$(LINUX_HEADERS_VERSION).tar.bz2
|
|
|
|
LINUX_HEADERS_CAT:=$(BZCAT)
|
|
|
|
LINUX_HEADERS_UNPACK_DIR:=$(TOOLCHAIN_DIR)/linux-$(LINUX_HEADERS_VERSION)
|
|
|
|
LINUX_HEADERS_DIR:=$(TOOLCHAIN_DIR)/linux
|
|
|
|
|
|
|
|
LINUX_HEADERS_DEPENDS:=
|
|
|
|
|
|
|
|
$(LINUX_HEADERS_UNPACK_DIR)/.unpacked: $(DL_DIR)/$(LINUX_HEADERS_SOURCE)
|
2013-01-20 07:03:48 +01:00
|
|
|
$(Q)$(call MESSAGE,"Extracting kernel headers")
|
2010-12-13 21:52:16 +01:00
|
|
|
rm -rf $(LINUX_HEADERS_DIR)
|
|
|
|
$(INSTALL) -d $(@D)
|
|
|
|
$(LINUX_HEADERS_CAT) $(DL_DIR)/$(LINUX_HEADERS_SOURCE) | \
|
|
|
|
tar $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(LINUX_HEADERS_UNPACK_DIR)/.patched: $(LINUX_HEADERS_UNPACK_DIR)/.unpacked $(LINUX_HEADERS_DEPENDS)
|
2013-01-20 07:03:48 +01:00
|
|
|
$(Q)$(call MESSAGE,"Patching kernel headers")
|
2011-08-31 23:35:04 +02:00
|
|
|
support/scripts/apply-patches.sh $(LINUX_HEADERS_UNPACK_DIR) toolchain/kernel-headers \
|
2010-12-13 21:52:16 +01:00
|
|
|
linux-$(LINUX_HEADERS_VERSION)-\*.patch{,.gz,.bz2}
|
|
|
|
ifneq ($(KERNEL_HEADERS_PATCH_DIR),)
|
2011-08-31 23:35:04 +02:00
|
|
|
support/scripts/apply-patches.sh $(LINUX_HEADERS_UNPACK_DIR) $(KERNEL_HEADERS_PATCH_DIR) \
|
2010-12-13 21:52:16 +01:00
|
|
|
linux-$(LINUX_HEADERS_VERSION)-\*.patch{,.gz,.bz2}
|
|
|
|
endif
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(LINUX_HEADERS_DIR)/.configured: $(LINUX_HEADERS_UNPACK_DIR)/.patched
|
2013-01-20 07:03:48 +01:00
|
|
|
$(Q)$(call MESSAGE,"Installing kernel headers")
|
2010-12-13 21:52:16 +01:00
|
|
|
(cd $(LINUX_HEADERS_UNPACK_DIR); \
|
|
|
|
$(MAKE) ARCH=$(KERNEL_ARCH) \
|
|
|
|
HOSTCC="$(HOSTCC)" HOSTCFLAGS="$(HOSTCFLAGS)" \
|
|
|
|
HOSTCXX="$(HOSTCXX)" \
|
|
|
|
INSTALL_HDR_PATH=$(LINUX_HEADERS_DIR) headers_install; \
|
|
|
|
)
|
|
|
|
touch $@
|
2004-09-03 02:49:43 +02:00
|
|
|
|
2006-12-13 12:49:19 +01:00
|
|
|
$(DL_DIR)/$(LINUX_HEADERS_SOURCE):
|
2009-12-06 15:40:03 +01:00
|
|
|
ifeq ($(BR2_KERNEL_HEADERS_SNAP),y)
|
|
|
|
$(error No local $@ found, cannot continue. Are you sure you wanted to enable BR2_KERNEL_HEADERS_SNAP?)
|
|
|
|
endif
|
2013-03-23 23:26:32 +01:00
|
|
|
$(Q)$(call MESSAGE,"Downloading kernel headers")
|
2013-04-12 11:40:30 +02:00
|
|
|
$(call DOWNLOAD,$(LINUX_HEADERS_SITE:/=)/$(LINUX_HEADERS_SOURCE))
|
2003-09-14 13:38:35 +02:00
|
|
|
|
2004-10-05 09:10:07 +02:00
|
|
|
kernel-headers: $(LINUX_HEADERS_DIR)/.configured
|
2003-09-14 13:38:35 +02:00
|
|
|
|
2004-10-05 09:16:53 +02:00
|
|
|
kernel-headers-source: $(DL_DIR)/$(LINUX_HEADERS_SOURCE)
|
2003-11-12 10:31:12 +01:00
|
|
|
|
|
|
|
kernel-headers-clean: clean
|
2004-10-05 09:10:07 +02:00
|
|
|
rm -rf $(LINUX_HEADERS_DIR)
|
2003-09-14 13:38:35 +02:00
|
|
|
|
2003-11-12 10:31:12 +01:00
|
|
|
kernel-headers-dirclean:
|
2004-10-05 09:10:07 +02:00
|
|
|
rm -rf $(LINUX_HEADERS_DIR)
|
2007-08-24 07:36:46 +02:00
|
|
|
rm -rf $(LINUX_HEADERS_UNPACK_DIR)
|
2003-09-14 13:38:35 +02:00
|
|
|
|
2006-07-19 08:37:58 +02:00
|
|
|
.PHONY: kernel-headers
|