1*4882a593SmuzhiyunSUMMARY = "Sanitized set of kernel headers for the C library's use" 2*4882a593SmuzhiyunHOMEPAGE = "https://www.kernel.org/" 3*4882a593SmuzhiyunDESCRIPTION = "Designed to maintain an Application Programming Interface (API) stable version of the Linux headers" 4*4882a593SmuzhiyunSECTION = "devel" 5*4882a593SmuzhiyunLICENSE = "GPL-2.0-only" 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun######################################################################### 8*4882a593Smuzhiyun#### PLEASE READ 9*4882a593Smuzhiyun######################################################################### 10*4882a593Smuzhiyun# 11*4882a593Smuzhiyun# You're probably looking here thinking you need to create some new copy 12*4882a593Smuzhiyun# of linux-libc-headers since you have your own custom kernel. To put 13*4882a593Smuzhiyun# this simply, you DO NOT. 14*4882a593Smuzhiyun# 15*4882a593Smuzhiyun# Why? These headers are used to build the libc. If you customise the 16*4882a593Smuzhiyun# headers you are customising the libc and the libc becomes machine 17*4882a593Smuzhiyun# specific. Most people do not add custom libc extensions to the kernel 18*4882a593Smuzhiyun# and have a machine specific libc. 19*4882a593Smuzhiyun# 20*4882a593Smuzhiyun# But you have some kernel headers you need for some driver? That is fine 21*4882a593Smuzhiyun# but get them from STAGING_KERNEL_BUILDDIR where the kernel installs itself. 22*4882a593Smuzhiyun# This will make the package using them machine specific but this is much 23*4882a593Smuzhiyun# better than having a machine specific C library. This does mean your 24*4882a593Smuzhiyun# recipe needs a 25*4882a593Smuzhiyun# do_configure[depends] += "virtual/kernel:do_shared_workdir" 26*4882a593Smuzhiyun# but again, that is fine and makes total sense. 27*4882a593Smuzhiyun# 28*4882a593Smuzhiyun# There can also be a case where your kernel extremely old and you want 29*4882a593Smuzhiyun# an older libc ABI for that old kernel. The headers installed by this 30*4882a593Smuzhiyun# recipe should still be a standard mainline kernel, not your own custom 31*4882a593Smuzhiyun# one. 32*4882a593Smuzhiyun# 33*4882a593Smuzhiyun# -- RP 34*4882a593Smuzhiyun 35*4882a593SmuzhiyunLIC_FILES_CHKSUM ?= "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" 36*4882a593Smuzhiyun 37*4882a593SmuzhiyunRECIPE_NO_UPDATE_REASON = "Recipe is updated through a separate process" 38*4882a593Smuzhiyun 39*4882a593Smuzhiyunpython __anonymous () { 40*4882a593Smuzhiyun major = d.getVar("PV").split('.')[0] 41*4882a593Smuzhiyun if major == "3": 42*4882a593Smuzhiyun d.setVar("HEADER_FETCH_VER", "3.0") 43*4882a593Smuzhiyun elif major == "4": 44*4882a593Smuzhiyun d.setVar("HEADER_FETCH_VER", "4.x") 45*4882a593Smuzhiyun elif major == "5": 46*4882a593Smuzhiyun d.setVar("HEADER_FETCH_VER", "5.x") 47*4882a593Smuzhiyun else: 48*4882a593Smuzhiyun d.setVar("HEADER_FETCH_VER", "2.6") 49*4882a593Smuzhiyun} 50*4882a593Smuzhiyun 51*4882a593SmuzhiyunMAJ_VER = "${@oe.utils.trim_version("${PV}", 2).split('.')[0]}" 52*4882a593SmuzhiyunMIN_VER = "${@oe.utils.trim_version("${PV}", 2).split('.')[1]}" 53*4882a593Smuzhiyun 54*4882a593Smuzhiyuninherit kernel-arch pkgconfig multilib_header 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunKORG_ARCHIVE_COMPRESSION ?= "xz" 57*4882a593Smuzhiyun 58*4882a593SmuzhiyunSRC_URI = "${KERNELORG_MIRROR}/linux/kernel/v${HEADER_FETCH_VER}/linux-${PV}.tar.${KORG_ARCHIVE_COMPRESSION}" 59*4882a593SmuzhiyunUPSTREAM_CHECK_URI = "https://www.kernel.org/" 60*4882a593Smuzhiyun 61*4882a593SmuzhiyunS = "${WORKDIR}/linux-${PV}" 62*4882a593Smuzhiyun 63*4882a593SmuzhiyunEXTRA_OEMAKE = " HOSTCC="${BUILD_CC}" HOSTCPP="${BUILD_CPP}"" 64*4882a593Smuzhiyun 65*4882a593Smuzhiyundo_configure[noexec] = "1" 66*4882a593Smuzhiyun 67*4882a593Smuzhiyundo_compile[noexec] = "1" 68*4882a593Smuzhiyun 69*4882a593Smuzhiyundo_install() { 70*4882a593Smuzhiyun oe_runmake headers_install INSTALL_HDR_PATH=${D}${exec_prefix} 71*4882a593Smuzhiyun # Kernel should not be exporting this header 72*4882a593Smuzhiyun rm -f ${D}${exec_prefix}/include/scsi/scsi.h 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun # The ..install.cmd conflicts between various configure runs 75*4882a593Smuzhiyun find ${D}${includedir} -name ..install.cmd | xargs rm -f 76*4882a593Smuzhiyun} 77*4882a593Smuzhiyun 78*4882a593Smuzhiyundo_install:append:aarch64 () { 79*4882a593Smuzhiyun do_install_armmultilib 80*4882a593Smuzhiyun} 81*4882a593Smuzhiyun 82*4882a593Smuzhiyundo_install:append:arm () { 83*4882a593Smuzhiyun do_install_armmultilib 84*4882a593Smuzhiyun} 85*4882a593Smuzhiyun 86*4882a593Smuzhiyundo_install:append:armeb () { 87*4882a593Smuzhiyun do_install_armmultilib 88*4882a593Smuzhiyun} 89*4882a593Smuzhiyun 90*4882a593Smuzhiyundo_install_armmultilib () { 91*4882a593Smuzhiyun if [ ${MAJ_VER} -gt 5 ]; then 92*4882a593Smuzhiyun ARM_KVM_HEADER="" 93*4882a593Smuzhiyun else 94*4882a593Smuzhiyun if [ ${MAJ_VER} -eq 5 ] && [ ${MIN_VER} -ge 8 ]; then 95*4882a593Smuzhiyun ARM_KVM_HEADER="" 96*4882a593Smuzhiyun else 97*4882a593Smuzhiyun ARM_KVM_HEADER="asm/kvm.h" 98*4882a593Smuzhiyun fi 99*4882a593Smuzhiyun fi 100*4882a593Smuzhiyun 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 101*4882a593Smuzhiyun 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 102*4882a593Smuzhiyun} 103*4882a593Smuzhiyun 104*4882a593SmuzhiyunBBCLASSEXTEND = "nativesdk" 105*4882a593Smuzhiyun 106*4882a593SmuzhiyunRDEPENDS:${PN}-dev = "" 107*4882a593SmuzhiyunRRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})" 108*4882a593Smuzhiyun 109*4882a593SmuzhiyunINHIBIT_DEFAULT_DEPS = "1" 110*4882a593SmuzhiyunDEPENDS += "unifdef-native bison-native rsync-native" 111