blob: 196c8c7a24e2f8640cc0f4bec54b805a4c4e65c1 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Linux kernel Development Source"
2DESCRIPTION = "Development source linux kernel. When built, this recipe packages the \
3source of the preferred virtual/kernel provider and makes it available for full kernel \
4development or external module builds"
5
6SECTION = "kernel"
7
8LICENSE = "GPLv2"
9LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
10
11inherit linux-kernel-base
12
13# Whilst not a module, this ensures we don't get multilib extended (which would make no sense)
14inherit 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.
19do_install[depends] += "virtual/kernel:do_shared_workdir"
20# Need the source, not just the output of populate_sysroot
21do_install[depends] += "virtual/kernel:do_install"
22
23# There's nothing to do here, except install the source where we can package it
24do_fetch[noexec] = "1"
25do_unpack[noexec] = "1"
26do_patch[noexec] = "1"
27do_configure[noexec] = "1"
28do_compile[noexec] = "1"
29do_populate_sysroot[noexec] = "1"
30
31# Define where the kernel headers are installed on the target as well as where
32# they are staged.
33KERNEL_SRC_PATH = "/usr/src/kernel"
34S = "${STAGING_KERNEL_DIR}"
35B = "${STAGING_KERNEL_BUILDDIR}"
36
37KERNEL_VERSION = "${@get_kernelversion_headers('${S}')}"
38
39PACKAGE_ARCH = "${MACHINE_ARCH}"
40
41do_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
72do_install[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
73
74PACKAGES = "kernel-devsrc"
75FILES_${PN} = "${KERNEL_SRC_PATH}"
76RDEPENDS_${PN} = "bc"