1 ################################################################################
5 ################################################################################
7 # This package is used to provide Linux kernel headers for the
8 # internal toolchain backend.
10 ifeq ($(BR2_KERNEL_HEADERS_AS_KERNEL
),y
)
12 LINUX_HEADERS_VERSION
= $(call qstrip
,$(BR2_LINUX_KERNEL_VERSION
))
14 # Compute LINUX_HEADERS_SOURCE and LINUX_HEADERS_SITE from the configuration
15 ifeq ($(BR2_LINUX_KERNEL_CUSTOM_TARBALL
),y
)
16 LINUX_HEADERS_TARBALL
= $(call qstrip
,$(BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION
))
17 LINUX_HEADERS_SITE
= $(patsubst %/,%,$(dir $(LINUX_HEADERS_TARBALL
)))
18 LINUX_HEADERS_SOURCE
= $(notdir $(LINUX_HEADERS_TARBALL
))
19 BR_NO_CHECK_HASH_FOR
+= $(LINUX_HEADERS_SOURCE
)
20 else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_GIT
),y
)
21 LINUX_HEADERS_SITE
= $(call qstrip
,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL
))
22 LINUX_HEADERS_SITE_METHOD
= git
23 # use same git tarball as linux kernel
24 LINUX_HEADERS_SOURCE
= linux-
$(LINUX_HEADERS_VERSION
).
tar.gz
25 else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_HG
),y
)
26 LINUX_HEADERS_SITE
= $(call qstrip
,$(BR2_LINUX_KERNEL_CUSTOM_REPO_URL
))
27 LINUX_HEADERS_SITE_METHOD
= hg
28 # use same hg tarball as linux kernel
29 LINUX_HEADERS_SOURCE
= linux-
$(LINUX_HEADERS_VERSION
).
tar.gz
31 LINUX_HEADERS_SOURCE
= linux-
$(LINUX_HEADERS_VERSION
).
tar.xz
32 ifeq ($(BR2_LINUX_KERNEL_CUSTOM_VERSION
),y
)
33 BR_NO_CHECK_HASH_FOR
+= $(LINUX_HEADERS_SOURCE
)
35 # In X.Y.Z, get X and Y. We replace dots and dashes by spaces in order
36 # to use the $(word) function. We support versions such as 4.0, 3.1,
37 # 2.6.32, 2.6.32-rc1, 3.0-rc6, etc.
38 ifeq ($(findstring x2.6.
,x
$(LINUX_HEADERS_VERSION
)),x2.6.
)
39 LINUX_HEADERS_SITE
= $(BR2_KERNEL_MIRROR
)/linux
/kernel
/v2.6
40 else ifeq ($(findstring x3.
,x
$(LINUX_HEADERS_VERSION
)),x3.
)
41 LINUX_HEADERS_SITE
= $(BR2_KERNEL_MIRROR
)/linux
/kernel
/v3.x
42 else ifeq ($(findstring x4.
,x
$(LINUX_HEADERS_VERSION
)),x4.
)
43 LINUX_HEADERS_SITE
= $(BR2_KERNEL_MIRROR
)/linux
/kernel
/v4.x
45 # release candidates are in testing/ subdir
46 ifneq ($(findstring -rc
,$(LINUX_HEADERS_VERSION
)),)
47 LINUX_HEADERS_SITE
:= $(LINUX_HEADERS_SITE
)/testing
51 LINUX_HEADERS_PATCHES
= $(call qstrip
,$(BR2_LINUX_KERNEL_PATCH
))
53 # We rely on the generic package infrastructure to download and apply
54 # remote patches (downloaded from ftp, http or https). For local
55 # patches, we can't rely on that infrastructure, because there might
56 # be directories in the patch list (unlike for other packages).
57 LINUX_HEADERS_PATCH
= $(filter ftp
://% http
://% https
://%,$(LINUX_HEADERS_PATCHES
))
59 define LINUX_HEADERS_APPLY_LOCAL_PATCHES
60 for p in
$(filter-out ftp
://% http
://% https
://%,$(LINUX_HEADERS_PATCHES
)) ; do \
61 if
test -d
$$p ; then \
62 $(APPLY_PATCHES
) $(@D
) $$p \
*.patch || exit
1 ; \
64 $(APPLY_PATCHES
) $(@D
) `dirname $$p` `basename $$p` || exit
1; \
69 LINUX_HEADERS_POST_PATCH_HOOKS
+= LINUX_HEADERS_APPLY_LOCAL_PATCHES
71 else # ! BR2_KERNEL_HEADERS_AS_KERNEL
73 LINUX_HEADERS_VERSION
= $(call qstrip
,$(BR2_DEFAULT_KERNEL_HEADERS
))
74 ifeq ($(findstring x2.6.
,x
$(LINUX_HEADERS_VERSION
)),x2.6.
)
75 LINUX_HEADERS_SITE
= $(BR2_KERNEL_MIRROR
)/linux
/kernel
/v2.6
76 else ifeq ($(findstring x3.
,x
$(LINUX_HEADERS_VERSION
)),x3.
)
77 LINUX_HEADERS_SITE
= $(BR2_KERNEL_MIRROR
)/linux
/kernel
/v3.x
78 else ifeq ($(findstring x4.
,x
$(LINUX_HEADERS_VERSION
)),x4.
)
79 LINUX_HEADERS_SITE
= $(BR2_KERNEL_MIRROR
)/linux
/kernel
/v4.x
81 LINUX_HEADERS_SOURCE
= linux-
$(LINUX_HEADERS_VERSION
).
tar.xz
83 endif # ! BR2_KERNEL_HEADERS_AS_KERNEL
85 LINUX_HEADERS_LICENSE
= GPLv2
86 LINUX_HEADERS_LICENSE_FILES
= COPYING
88 LINUX_HEADERS_INSTALL_STAGING
= YES
90 # linux-headers is part of the toolchain so disable the toolchain dependency
91 LINUX_HEADERS_ADD_TOOLCHAIN_DEPENDENCY
= NO
93 # For some architectures (eg. Arc, Cris, Hexagon, ia64, parisc,
94 # score and xtensa), the Linux buildsystem tries to call the
95 # cross-compiler, although it is not needed at all.
96 # This results in seemingly errors like:
97 # [...]/scripts/gcc-version.sh: line 26: arc-linux-uclibc-gcc: command not found
98 # Those can be safely ignored.
100 # This step is required to have a separate linux headers location for
101 # uClibc building. This way uClibc doesn't modify linux headers on installation
103 define LINUX_HEADERS_CONFIGURE_CMDS
105 $(TARGET_MAKE_ENV
) $(MAKE
) \
106 ARCH
=$(KERNEL_ARCH
) \
108 HOSTCFLAGS
="$(HOSTCFLAGS)" \
109 HOSTCXX
="$(HOSTCXX)" \
110 INSTALL_HDR_PATH
=$(@D
)/usr \
114 define LINUX_HEADERS_INSTALL_STAGING_CMDS
116 $(TARGET_MAKE_ENV
) $(MAKE
) \
117 ARCH
=$(KERNEL_ARCH
) \
119 HOSTCFLAGS
="$(HOSTCFLAGS)" \
120 HOSTCXX
="$(HOSTCXX)" \
121 INSTALL_HDR_PATH
=$(STAGING_DIR
)/usr \
125 ifeq ($(BR2_KERNEL_HEADERS_VERSION
)$(BR2_KERNEL_HEADERS_AS_KERNEL
),y
)
126 define LINUX_HEADERS_CHECK_VERSION
127 $(call check_kernel_headers_version
,\
129 $(call qstrip
,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST
)))
131 LINUX_HEADERS_POST_INSTALL_STAGING_HOOKS
+= LINUX_HEADERS_CHECK_VERSION
134 $(eval
$(generic-package
))