blob: 7ec94024c3c1eab066d510173b605f5db6681316 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Sanitized set of kernel headers for the C library's use"
Andrew Geissler90fd73c2021-03-05 15:25:55 -06002DESCRIPTION = "Designed to maintain an Application Programming Interface (API) stable version of the Linux headers"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05003SECTION = "devel"
4LICENSE = "GPLv2"
5
6#########################################################################
7#### PLEASE READ
8#########################################################################
9#
10# You're probably looking here thinking you need to create some new copy
11# of linux-libc-headers since you have your own custom kernel. To put
12# this simply, you DO NOT.
13#
14# Why? These headers are used to build the libc. If you customise the
15# headers you are customising the libc and the libc becomes machine
16# specific. Most people do not add custom libc extensions to the kernel
17# and have a machine specific libc.
18#
19# But you have some kernel headers you need for some driver? That is fine
Andrew Geisslerc9f78652020-09-18 14:11:35 -050020# but get them from STAGING_KERNEL_BUILDDIR where the kernel installs itself.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021# This will make the package using them machine specific but this is much
Patrick Williamsc0f7c042017-02-23 20:41:17 -060022# better than having a machine specific C library. This does mean your
23# recipe needs a
24# do_configure[depends] += "virtual/kernel:do_shared_workdir"
25# but again, that is fine and makes total sense.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026#
27# There can also be a case where your kernel extremely old and you want
28# an older libc ABI for that old kernel. The headers installed by this
29# recipe should still be a standard mainline kernel, not your own custom
30# one.
31#
32# -- RP
33
Andrew Geissler635e0e42020-08-21 15:58:33 -050034LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035
Andrew Geissler5a43b432020-06-13 10:46:56 -050036RECIPE_NO_UPDATE_REASON = "Recipe is updated through a separate process"
37
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038python __anonymous () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050039 major = d.getVar("PV").split('.')[0]
Patrick Williamsc124f4f2015-09-15 14:41:29 -050040 if major == "3":
41 d.setVar("HEADER_FETCH_VER", "3.0")
42 elif major == "4":
43 d.setVar("HEADER_FETCH_VER", "4.x")
Brad Bishop19323692019-04-05 15:28:33 -040044 elif major == "5":
45 d.setVar("HEADER_FETCH_VER", "5.x")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046 else:
47 d.setVar("HEADER_FETCH_VER", "2.6")
48}
49
Andrew Geissler635e0e42020-08-21 15:58:33 -050050MAJ_VER = "${@oe.utils.trim_version("${PV}", 2).split('.')[0]}"
51MIN_VER = "${@oe.utils.trim_version("${PV}", 2).split('.')[1]}"
52
Brad Bishop6e60e8b2018-02-01 10:27:11 -050053inherit kernel-arch pkgconfig multilib_header
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050055KORG_ARCHIVE_COMPRESSION ?= "xz"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056
57SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/v${HEADER_FETCH_VER}/linux-${PV}.tar.${KORG_ARCHIVE_COMPRESSION}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050058UPSTREAM_CHECK_URI = "https://www.kernel.org/"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059
60S = "${WORKDIR}/linux-${PV}"
61
Patrick Williamsc0f7c042017-02-23 20:41:17 -060062EXTRA_OEMAKE = " HOSTCC="${BUILD_CC}" HOSTCPP="${BUILD_CPP}""
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050063
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080064do_configure[noexec] = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050065
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080066do_compile[noexec] = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067
68do_install() {
69 oe_runmake headers_install INSTALL_HDR_PATH=${D}${exec_prefix}
70 # Kernel should not be exporting this header
71 rm -f ${D}${exec_prefix}/include/scsi/scsi.h
72
73 # The ..install.cmd conflicts between various configure runs
74 find ${D}${includedir} -name ..install.cmd | xargs rm -f
75}
76
Brad Bishop6e60e8b2018-02-01 10:27:11 -050077do_install_append_aarch64 () {
78 do_install_armmultilib
79}
80
81do_install_append_arm () {
82 do_install_armmultilib
83}
84
Brad Bishopd5ae7d92018-06-14 09:52:03 -070085do_install_append_armeb () {
86 do_install_armmultilib
87}
88
Brad Bishop6e60e8b2018-02-01 10:27:11 -050089do_install_armmultilib () {
Andrew Geissler635e0e42020-08-21 15:58:33 -050090 if [ ${MAJ_VER} -gt 5 ]; then
91 ARM_KVM_HEADER=""
92 else
93 if [ ${MAJ_VER} -eq 5 ] && [ ${MIN_VER} -ge 8 ]; then
94 ARM_KVM_HEADER=""
95 else
96 ARM_KVM_HEADER="asm/kvm.h"
97 fi
98 fi
99 oe_multilib_header asm/auxvec.h asm/bitsperlong.h asm/byteorder.h asm/fcntl.h asm/hwcap.h asm/ioctls.h $ARM_KVM_HEADER asm/kvm_para.h asm/mman.h asm/param.h asm/perf_regs.h asm/bpf_perf_event.h
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500100 oe_multilib_header asm/posix_types.h asm/ptrace.h asm/setup.h asm/sigcontext.h asm/siginfo.h asm/signal.h asm/stat.h asm/statfs.h asm/swab.h asm/types.h asm/unistd.h
101}
102
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500103BBCLASSEXTEND = "nativesdk"
104
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500105RDEPENDS_${PN}-dev = ""
106RRECOMMENDS_${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
107
108INHIBIT_DEFAULT_DEPS = "1"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500109DEPENDS += "unifdef-native bison-native rsync-native"