From 6a1ff0e7eacef595738f2fed086986fd622ec32a Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Thu, 15 Jan 2015 11:54:15 +0000 Subject: kernel: move source and build output to work-shared commit 3b3f7e785e279 [kernel: Rearrange for 1.8] began the process of moving the kernel source and build artefacts out of sstate control and into a shared location. This changed triggered some workflow issues, as well as bugs related to the kernel source containing build output, and hence being dirty and breaking kernel rebuilds. To solve these issues, and to make it clear that the kernel is not under sstate control, we move the source and build outputs to: work-shared/MACHINE/kernel-source work-shared/MACHINE/kernel-build-artifacts Where kernel-build-artifacts is the kernel build output and kernel-source is kept "pristine". The build-artifacts contain everything that is required to build external modules against the kernel source, and includes the defconfig, the kernel-abiversion, System.map files and output from "make scripts". External module builds should either pass O= on the command line, or set KBUILD_OUTPUT to point to the build-artifacts. module-base.bbclass takes care of setting KBUILD_OUTPUT, so most existing external module recipes are transparently adapted to the new source/build layout. recipes that depend on the kernel source must have a depedency on the do_shared_workdir task: do_configure[depends] += "virtual/kernel:do_shared_workdir" With this dependency added, the STAGING_KERNEL_DIR will be populated and available to the rest of the build. Signed-off-by: Bruce Ashfield Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/classes/module-base.bbclass | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'meta/classes/module-base.bbclass') diff --git a/meta/classes/module-base.bbclass b/meta/classes/module-base.bbclass index 9537ba9f43..3eb2e9226e 100644 --- a/meta/classes/module-base.bbclass +++ b/meta/classes/module-base.bbclass @@ -3,16 +3,24 @@ inherit kernel-arch export OS = "${TARGET_OS}" export CROSS_COMPILE = "${TARGET_PREFIX}" -export KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}" +# This points to the build artefacts from the main kernel build +# such as .config and System.map +# Confusingly it is not the module build output (which is ${B}) but +# we didn't pick the name. +export KBUILD_OUTPUT = "${STAGING_KERNEL_BUILDDIR}" + +export KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}" KERNEL_OBJECT_SUFFIX = ".ko" # kernel modules are generally machine specific PACKAGE_ARCH = "${MACHINE_ARCH}" +do_configure[depends] += "virtual/kernel:do_shared_workdir" + # Function to ensure the kernel scripts are created. Expected to # be called before do_compile. See module.bbclass for an exmaple. do_make_scripts() { unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS make CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \ - -C ${STAGING_KERNEL_DIR} scripts + -C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} scripts } -- cgit v1.2.3