summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-19 17:46:27 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-21 12:37:55 +0000
commit1dd37a2a9960ad26e27567d1871d78bec336e1a2 (patch)
treec9e15e20e8bc3808eef6bbb5556cefd36de3d194 /meta/classes/kernel.bbclass
parent6eb95d654e6e674f43170a906f8aee1ef90c6827 (diff)
downloadpoky-1dd37a2a9960ad26e27567d1871d78bec336e1a2.tar.gz
kernel: Fix non linux-yocto builds
After the recent kernel changes, non linux-yocto builds stopped working properly for two reasons: a) ${S} was being reset to ${WORKDIR}/git for example and STAGING_KERNEL_DIR did not contain the source b) Most builds were using ${B} == ${S} This patch adds a fixup to the unpack function to handle the case where ${S} != ${STAGING_KERNEL_DIR} and also set up the infrastrcture so that B != S for kernel builds from now on. The kernel build system is one of the best for supporting this and there is no good reason not to take advantage of it. (From OE-Core rev: 106dab2fd0321e6b4e77b40111e59a3a31d329d4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/kernel.bbclass')
-rw-r--r--meta/classes/kernel.bbclass29
1 files changed, 25 insertions, 4 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index c9e1c363e8..5cabc2ce1c 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -3,9 +3,10 @@ inherit linux-kernel-base kernel-module-split
3PROVIDES += "virtual/kernel" 3PROVIDES += "virtual/kernel"
4DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native" 4DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native"
5 5
6S = "${STAGING_DIR_TARGET}/${KERNEL_SRC_PATH}" 6S = "${STAGING_KERNEL_DIR}"
7 7B = "${WORKDIR}/build"
8do_unpack[cleandirs] = "${S}" 8KBUILD_OUTPUT = "${B}"
9OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
9 10
10# we include gcc above, we dont need virtual/libc 11# we include gcc above, we dont need virtual/libc
11INHIBIT_DEFAULT_DEPS = "1" 12INHIBIT_DEFAULT_DEPS = "1"
@@ -35,6 +36,22 @@ python __anonymous () {
35 d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}') 36 d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
36} 37}
37 38
39# Old style kernels may set ${S} = ${WORKDIR}/git for example
40# We need to move these over to STAGING_KERNEL_DIR. We can't just
41# create the symlink in advance as the git fetcher can't cope with
42# the symlink.
43do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B}"
44base_do_unpack_append () {
45 s = d.getVar("S", True)
46 kernsrc = d.getVar("STAGING_KERNEL_DIR", True)
47 if s != kernsrc:
48 bb.utils.mkdirhier(kernsrc)
49 bb.utils.remove(kernsrc, recurse=True)
50 import subprocess
51 subprocess.call(d.expand("mv ${S} ${STAGING_KERNEL_DIR}"), shell=True)
52 os.symlink(kernsrc, s)
53}
54
38inherit kernel-arch deploy 55inherit kernel-arch deploy
39 56
40PACKAGES_DYNAMIC += "^kernel-module-.*" 57PACKAGES_DYNAMIC += "^kernel-module-.*"
@@ -255,7 +272,7 @@ python sysroot_stage_all () {
255 oe.path.copyhardlinktree(d.expand("${D}${KERNEL_SRC_PATH}"), d.expand("${SYSROOT_DESTDIR}${KERNEL_SRC_PATH}")) 272 oe.path.copyhardlinktree(d.expand("${D}${KERNEL_SRC_PATH}"), d.expand("${SYSROOT_DESTDIR}${KERNEL_SRC_PATH}"))
256} 273}
257 274
258KERNEL_CONFIG_COMMAND ?= "oe_runmake_call oldnoconfig || yes '' | oe_runmake oldconfig" 275KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} O=${B} oldnoconfig || yes '' | oe_runmake -C ${S} O=${B} oldconfig"
259 276
260kernel_do_configure() { 277kernel_do_configure() {
261 # fixes extra + in /lib/modules/2.6.37+ 278 # fixes extra + in /lib/modules/2.6.37+
@@ -264,6 +281,10 @@ kernel_do_configure() {
264 # $ make kernelrelease => 2.6.37+ 281 # $ make kernelrelease => 2.6.37+
265 touch ${B}/.scmversion ${S}/.scmversion 282 touch ${B}/.scmversion ${S}/.scmversion
266 283
284 if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then
285 mv "${S}/.config" "${B}/.config"
286 fi
287
267 # Copy defconfig to .config if .config does not exist. This allows 288 # Copy defconfig to .config if .config does not exist. This allows
268 # recipes to manage the .config themselves in do_configure_prepend(). 289 # recipes to manage the .config themselves in do_configure_prepend().
269 if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then 290 if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then