summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2015-01-15 11:54:15 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-16 23:08:18 +0000
commit46cdaf1c7bc597735d926af6a46f9483f7e57ce5 (patch)
treee3e9a582d734bc1c6b09dbc3d9af6f5cdd364dbd /meta/classes
parent92725ad46f4d331bea6a2fa65964158d78a7add8 (diff)
downloadpoky-46cdaf1c7bc597735d926af6a46f9483f7e57ce5.tar.gz
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. (From OE-Core rev: 6a1ff0e7eacef595738f2fed086986fd622ec32a) Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/kernel-module-split.bbclass2
-rw-r--r--meta/classes/kernel.bbclass30
-rw-r--r--meta/classes/module-base.bbclass12
-rw-r--r--meta/classes/module.bbclass2
4 files changed, 31 insertions, 15 deletions
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index 9a95b72744..2d43b512df 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -70,7 +70,7 @@ python split_kernel_module_packages () {
70 m = kerverrexp.match(kernelver) 70 m = kerverrexp.match(kernelver)
71 if m: 71 if m:
72 kernelver_stripped = m.group(1) 72 kernelver_stripped = m.group(1)
73 staging_kernel_dir = d.getVar("STAGING_KERNEL_DIR", True) 73 staging_kernel_dir = d.getVar("STAGING_KERNEL_BUILDDIR", True)
74 system_map_file = "%s/boot/System.map-%s" % (dvar, kernelver) 74 system_map_file = "%s/boot/System.map-%s" % (dvar, kernelver)
75 if not os.path.exists(system_map_file): 75 if not os.path.exists(system_map_file):
76 system_map_file = "%s/System.map-%s" % (staging_kernel_dir, kernelver) 76 system_map_file = "%s/System.map-%s" % (staging_kernel_dir, kernelver)
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 78c8c7cf00..a60de8cc9e 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -230,28 +230,33 @@ kernel_do_install() {
230 [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION} 230 [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION}
231 install -d ${D}${sysconfdir}/modules-load.d 231 install -d ${D}${sysconfdir}/modules-load.d
232 install -d ${D}${sysconfdir}/modprobe.d 232 install -d ${D}${sysconfdir}/modprobe.d
233}
234do_install[prefuncs] += "package_get_auto_pr"
233 235
234 # 236addtask shared_workdir after do_compile before do_install
235 # Support for external module building - create a minimal copy of the 237
236 # kernel source tree. 238do_shared_workdir () {
237 # 239 cd ${B}
238 kerneldir=${D}${KERNEL_SRC_PATH} 240
241 kerneldir=${STAGING_KERNEL_BUILDDIR}
239 install -d $kerneldir 242 install -d $kerneldir
240 mkdir -p ${D}/lib/modules/${KERNEL_VERSION}
241 ln -sf ${KERNEL_SRC_PATH} "${D}/lib/modules/${KERNEL_VERSION}/build"
242 243
243 # 244 #
244 # Store the kernel version in sysroots for module-base.bbclass 245 # Store the kernel version in sysroots for module-base.bbclass
245 # 246 #
246 247
247 echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion 248 echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
248 249
249 # Copy files required for module builds 250 # Copy files required for module builds
250 cp System.map $kerneldir/System.map-${KERNEL_VERSION} 251 cp System.map $kerneldir/System.map-${KERNEL_VERSION}
251 cp Module.symvers $kerneldir/ 252 cp Module.symvers $kerneldir/
252 cp .config $kerneldir/ 253 cp .config $kerneldir/
253 mkdir -p $kerneldir/include/config 254 mkdir -p $kerneldir/include/config
254 cp include/config/kernel.release $kerneldir/include/config/kernel.release 255 cp include/config/kernel.release $kerneldir/include/config/kernel.release
256
257 # We can also copy over all the generated files and avoid special cases
258 # like version.h, but we've opted to keep this small until file creep starts
259 # to happen
255 if [ -e include/linux/version.h ]; then 260 if [ -e include/linux/version.h ]; then
256 mkdir -p $kerneldir/include/linux 261 mkdir -p $kerneldir/include/linux
257 cp include/linux/version.h $kerneldir/include/linux/version.h 262 cp include/linux/version.h $kerneldir/include/linux/version.h
@@ -273,10 +278,11 @@ kernel_do_install() {
273 cp -fR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/ 278 cp -fR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/
274 fi 279 fi
275} 280}
276do_install[prefuncs] += "package_get_auto_pr"
277 281
278python sysroot_stage_all () { 282# We have an empty sysroot_stage_all to keep the default routine from
279 oe.path.copyhardlinktree(d.expand("${D}${KERNEL_SRC_PATH}"), d.expand("${SYSROOT_DESTDIR}${KERNEL_SRC_PATH}")) 283# package.bbclass from expanding the kernel source into the sysroot and
284# colliding with linux-firmware files
285sysroot_stage_all () {
280} 286}
281 287
282KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} O=${B} oldnoconfig || yes '' | oe_runmake -C ${S} O=${B} oldconfig" 288KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} O=${B} oldnoconfig || yes '' | oe_runmake -C ${S} O=${B} oldconfig"
@@ -467,7 +473,7 @@ kernel_do_deploy() {
467do_deploy[dirs] = "${DEPLOYDIR} ${B}" 473do_deploy[dirs] = "${DEPLOYDIR} ${B}"
468do_deploy[prefuncs] += "package_get_auto_pr" 474do_deploy[prefuncs] += "package_get_auto_pr"
469 475
470addtask deploy before do_build after do_install 476addtask deploy after do_populate_sysroot
471 477
472EXPORT_FUNCTIONS do_deploy 478EXPORT_FUNCTIONS do_deploy
473 479
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
3export OS = "${TARGET_OS}" 3export OS = "${TARGET_OS}"
4export CROSS_COMPILE = "${TARGET_PREFIX}" 4export CROSS_COMPILE = "${TARGET_PREFIX}"
5 5
6export KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}" 6# This points to the build artefacts from the main kernel build
7# such as .config and System.map
8# Confusingly it is not the module build output (which is ${B}) but
9# we didn't pick the name.
10export KBUILD_OUTPUT = "${STAGING_KERNEL_BUILDDIR}"
11
12export KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}"
7KERNEL_OBJECT_SUFFIX = ".ko" 13KERNEL_OBJECT_SUFFIX = ".ko"
8 14
9# kernel modules are generally machine specific 15# kernel modules are generally machine specific
10PACKAGE_ARCH = "${MACHINE_ARCH}" 16PACKAGE_ARCH = "${MACHINE_ARCH}"
11 17
18do_configure[depends] += "virtual/kernel:do_shared_workdir"
19
12# Function to ensure the kernel scripts are created. Expected to 20# Function to ensure the kernel scripts are created. Expected to
13# be called before do_compile. See module.bbclass for an exmaple. 21# be called before do_compile. See module.bbclass for an exmaple.
14do_make_scripts() { 22do_make_scripts() {
15 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS 23 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
16 make CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \ 24 make CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
17 -C ${STAGING_KERNEL_DIR} scripts 25 -C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} scripts
18} 26}
diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
index 5cb8623a66..a03cc74de4 100644
--- a/meta/classes/module.bbclass
+++ b/meta/classes/module.bbclass
@@ -14,6 +14,7 @@ module_do_compile() {
14 KERNEL_VERSION=${KERNEL_VERSION} \ 14 KERNEL_VERSION=${KERNEL_VERSION} \
15 CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ 15 CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
16 AR="${KERNEL_AR}" \ 16 AR="${KERNEL_AR}" \
17 O=${STAGING_KERNEL_BUILDDIR} \
17 ${MAKE_TARGETS} 18 ${MAKE_TARGETS}
18} 19}
19 20
@@ -21,6 +22,7 @@ module_do_install() {
21 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS 22 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
22 oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" \ 23 oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" \
23 CC="${KERNEL_CC}" LD="${KERNEL_LD}" \ 24 CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
25 O=${STAGING_KERNEL_BUILDDIR} \
24 modules_install 26 modules_install
25} 27}
26 28