Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame^] | 1 | SUMMARY = "Linux kernel Development Source" |
| 2 | DESCRIPTION = "Development source linux kernel. When built, this recipe packages the \ |
| 3 | source of the preferred virtual/kernel provider and makes it available for full kernel \ |
| 4 | development or external module builds" |
| 5 | |
| 6 | SECTION = "kernel" |
| 7 | |
| 8 | LICENSE = "GPLv2" |
| 9 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" |
| 10 | |
| 11 | inherit linux-kernel-base |
| 12 | |
| 13 | # Whilst not a module, this ensures we don't get multilib extended (which would make no sense) |
| 14 | inherit module-base |
| 15 | |
| 16 | # We need the kernel to be staged (unpacked, patched and configured) before |
| 17 | # we can grab the source and make the source package. We also need the bits from |
| 18 | # ${B} not to change while we install, so virtual/kernel must finish do_compile. |
| 19 | do_install[depends] += "virtual/kernel:do_shared_workdir" |
| 20 | # Need the source, not just the output of populate_sysroot |
| 21 | do_install[depends] += "virtual/kernel:do_install" |
| 22 | |
| 23 | # There's nothing to do here, except install the source where we can package it |
| 24 | do_fetch[noexec] = "1" |
| 25 | do_unpack[noexec] = "1" |
| 26 | do_patch[noexec] = "1" |
| 27 | do_configure[noexec] = "1" |
| 28 | do_compile[noexec] = "1" |
| 29 | do_populate_sysroot[noexec] = "1" |
| 30 | |
| 31 | # Define where the kernel headers are installed on the target as well as where |
| 32 | # they are staged. |
| 33 | KERNEL_SRC_PATH = "/usr/src/kernel" |
| 34 | S = "${STAGING_KERNEL_DIR}" |
| 35 | B = "${STAGING_KERNEL_BUILDDIR}" |
| 36 | |
| 37 | KERNEL_VERSION = "${@get_kernelversion_headers('${S}')}" |
| 38 | |
| 39 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 40 | |
| 41 | do_install() { |
| 42 | kerneldir=${D}${KERNEL_SRC_PATH} |
| 43 | install -d $kerneldir |
| 44 | |
| 45 | # |
| 46 | # Copy the staging dir source (and module build support) into the devsrc structure. |
| 47 | # We can keep this copy simple and take everything, since a we'll clean up any build |
| 48 | # artifacts afterwards, and the extra i/o is not significant |
| 49 | # |
| 50 | cd ${B} |
| 51 | find . -type d -name '.git*' -prune -o -path '.debug' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir |
| 52 | cd ${S} |
| 53 | find . -type d -name '.git*' -prune -o -type f -print0 | cpio --null -pdlu $kerneldir |
| 54 | |
| 55 | # Explicitly set KBUILD_OUTPUT to ensure that the image directory is cleaned and not |
| 56 | # The main build artifacts. We clean the directory to avoid QA errors on mismatched |
| 57 | # architecture (since scripts and helpers are native format). |
| 58 | KBUILD_OUTPUT="$kerneldir" |
| 59 | oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts |
| 60 | |
| 61 | # As of Linux kernel version 3.0.1, the clean target removes |
| 62 | # arch/powerpc/lib/crtsavres.o which is present in |
| 63 | # KBUILD_LDFLAGS_MODULE, making it required to build external modules. |
| 64 | if [ ${ARCH} = "powerpc" ]; then |
| 65 | mkdir -p $kerneldir/arch/powerpc/lib/ |
| 66 | cp ${B}/arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o |
| 67 | fi |
| 68 | |
| 69 | chown -R root:root ${D} |
| 70 | } |
| 71 | # Ensure we don't race against "make scripts" during cpio |
| 72 | do_install[lockfiles] = "${TMPDIR}/kernel-scripts.lock" |
| 73 | |
| 74 | PACKAGES = "kernel-devsrc" |
| 75 | FILES_${PN} = "${KERNEL_SRC_PATH}" |
| 76 | RDEPENDS_${PN} = "bc" |