| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Sanitized set of kernel headers for the C library's use" | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 2 | HOMEPAGE = "https://www.kernel.org/" | 
| Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 3 | DESCRIPTION = "Designed to maintain an Application Programming Interface (API) stable version of the Linux headers" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | SECTION = "devel" | 
| Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 5 | LICENSE = "GPL-2.0-only" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 |  | 
|  | 7 | ######################################################################### | 
|  | 8 | ####                        PLEASE READ | 
|  | 9 | ######################################################################### | 
|  | 10 | # | 
|  | 11 | # You're probably looking here thinking you need to create some new copy | 
|  | 12 | # of linux-libc-headers since you have your own custom kernel. To put | 
|  | 13 | # this simply, you DO NOT. | 
|  | 14 | # | 
|  | 15 | # Why? These headers are used to build the libc. If you customise the | 
|  | 16 | # headers you are customising the libc and the libc becomes machine | 
|  | 17 | # specific. Most people do not add custom libc extensions to the kernel | 
|  | 18 | # and have a machine specific libc. | 
|  | 19 | # | 
|  | 20 | # But you have some kernel headers you need for some driver? That is fine | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 21 | # but get them from STAGING_KERNEL_BUILDDIR where the kernel installs itself. | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | # This will make the package using them machine specific but this is much | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 23 | # better than having a machine specific C library. This does mean your | 
|  | 24 | # recipe needs a | 
|  | 25 | #    do_configure[depends] += "virtual/kernel:do_shared_workdir" | 
|  | 26 | # but again, that is fine and makes total sense. | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | # | 
|  | 28 | # There can also be a case where your kernel extremely old and you want | 
|  | 29 | # an older libc ABI for that old kernel. The headers installed by this | 
|  | 30 | # recipe should still be a standard mainline kernel, not your own custom | 
|  | 31 | # one. | 
|  | 32 | # | 
|  | 33 | # -- RP | 
|  | 34 |  | 
| Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 35 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 36 |  | 
| Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 37 | RECIPE_NO_UPDATE_REASON = "Recipe is updated through a separate process" | 
|  | 38 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | python __anonymous () { | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 40 | major = d.getVar("PV").split('.')[0] | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 41 | if major == "3": | 
|  | 42 | d.setVar("HEADER_FETCH_VER", "3.0") | 
|  | 43 | elif major == "4": | 
|  | 44 | d.setVar("HEADER_FETCH_VER", "4.x") | 
| Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 45 | elif major == "5": | 
|  | 46 | d.setVar("HEADER_FETCH_VER", "5.x") | 
| Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 47 | elif major == "6": | 
|  | 48 | d.setVar("HEADER_FETCH_VER", "6.x") | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 49 | else: | 
|  | 50 | d.setVar("HEADER_FETCH_VER", "2.6") | 
|  | 51 | } | 
|  | 52 |  | 
| Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 53 | MAJ_VER = "${@oe.utils.trim_version("${PV}", 2).split('.')[0]}" | 
|  | 54 | MIN_VER = "${@oe.utils.trim_version("${PV}", 2).split('.')[1]}" | 
|  | 55 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 56 | inherit kernel-arch pkgconfig multilib_header | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 58 | KORG_ARCHIVE_COMPRESSION ?= "xz" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 |  | 
|  | 60 | SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/v${HEADER_FETCH_VER}/linux-${PV}.tar.${KORG_ARCHIVE_COMPRESSION}" | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 61 | UPSTREAM_CHECK_URI = "https://www.kernel.org/" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 |  | 
|  | 63 | S = "${WORKDIR}/linux-${PV}" | 
|  | 64 |  | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 65 | EXTRA_OEMAKE = " HOSTCC="${BUILD_CC}" HOSTCPP="${BUILD_CPP}"" | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 66 |  | 
| Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 67 | do_configure[noexec] = "1" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 68 |  | 
| Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 69 | do_compile[noexec] = "1" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 70 |  | 
|  | 71 | do_install() { | 
|  | 72 | oe_runmake headers_install INSTALL_HDR_PATH=${D}${exec_prefix} | 
|  | 73 | # Kernel should not be exporting this header | 
|  | 74 | rm -f ${D}${exec_prefix}/include/scsi/scsi.h | 
|  | 75 |  | 
|  | 76 | # The ..install.cmd conflicts between various configure runs | 
|  | 77 | find ${D}${includedir} -name ..install.cmd | xargs rm -f | 
|  | 78 | } | 
|  | 79 |  | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 80 | do_install:append:aarch64 () { | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 81 | do_install_armmultilib | 
|  | 82 | } | 
|  | 83 |  | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 84 | do_install:append:arm () { | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 85 | do_install_armmultilib | 
|  | 86 | } | 
|  | 87 |  | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 88 | do_install:append:armeb () { | 
| Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 89 | do_install_armmultilib | 
|  | 90 | } | 
|  | 91 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 92 | do_install_armmultilib () { | 
| Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 93 | if [ ${MAJ_VER} -gt 5 ]; then | 
|  | 94 | ARM_KVM_HEADER="" | 
|  | 95 | else | 
|  | 96 | if [ ${MAJ_VER} -eq 5 ] && [ ${MIN_VER} -ge 8 ]; then | 
|  | 97 | ARM_KVM_HEADER="" | 
|  | 98 | else | 
|  | 99 | ARM_KVM_HEADER="asm/kvm.h" | 
|  | 100 | fi | 
|  | 101 | fi | 
|  | 102 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 103 | 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 | 
|  | 104 | } | 
|  | 105 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 106 | BBCLASSEXTEND = "nativesdk" | 
|  | 107 |  | 
| Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 108 | DEV_PKG_DEPENDENCY = "" | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 109 | RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 |  | 
|  | 111 | INHIBIT_DEFAULT_DEPS = "1" | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 112 | DEPENDS += "unifdef-native bison-native rsync-native" |