Bug 5992

Summary: linux-yocto: externsrc is broken
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Darren Hart <dvhart>
Component: kernelAssignee: Bruce Ashfield <bruce.ashfield>
Status: VERIFIED FIXED QA Contact: Andra Necula <andrax.g.necula>
Severity: major    
Priority: High CC: alexandru.c.georgescu, andrax.g.necula, bruce.ashfield, fabien.chereau, richard.purdie, tom.zanussi
Version: 1.6   
Target Milestone: 1.6 M5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Fix kernel build issue in externalsrc and B != S none

Description Darren Hart 2014-03-17 20:17:46 UTC
Using external src per the kernel-dev manual:

http://www.yoctoproject.org/docs/1.5.1/dev-manual/dev-manual.html#building-software-from-an-external-source

does not work with linux-yocto and recipes derived from linux-yocto-custom (or any recipe using separate source and build directories according to Bruce).

Reported errors include the externalsrc class being effectively ignored and unknown config fragments being searched for and not found. The one reported case I've seen fails in the do_kernel_configme task.
Comment 1 Richard Purdie 2014-04-07 14:03:11 UTC
I tried a build here, creating an external checkout of linux yocto, adding a defconfig and then changing the recipe to add:

inherit externalsrc
EXTERNALSRC = "/media/build1/poky/linux-rp"
EXTERNALSRC_BUILD = "/media/build1/poky/linux-rp"
PV = "3.14"

which then build fine.

The report is odd since it says it fails in  do_kernel_configme yet in linux-yocto.bbclass has:

SRCTREECOVEREDTASKS += "do_kernel_link_vmlinux do_kernel_configme do_validate_branches do_kernel_configcheck do_kernel_checkout do_patch"

i.e. do_kernel_configme shouldn't get run, its marked as a covered task.
Comment 2 Richard Purdie 2014-04-07 15:15:09 UTC
Since there would likely be concern I didn't do exactly what the manual says, I also tried:

INHERIT += "externalsrc"
EXTERNALSRC_pn-linux-yocto = "/media/build1/poky/linux-rp"
EXTERNALSRC_BUILD_pn-linux-yocto = "/media/build1/poky/linux-rp"
PV_pn-linux-yocto = "3.14"

in local.conf and this also works...
Comment 3 Darren Hart 2014-04-07 15:35:49 UTC
We're unable to reproduce the failure as it was reported to us, and the steps in the manual result in a successful build. Closing as WORKSFORME.

If you feel this is still an error and wish to reopen, please provide a specific failure reproduction scenario.
Comment 4 Fabien Chéreau 2014-05-22 16:08:45 UTC
Created attachment 1973 [details]
Fix kernel build issue in externalsrc and B != S
Comment 5 Fabien Chéreau 2014-05-22 16:12:03 UTC
Hi Darren and Richard,

the main problem here come from the fact that when using external sources, we can also define a custom build directory (B != S)
In this case some build / install problems occurs.

I used a patch originally given by Bruce Ashfield and modified it a bit to allow my recipe to work (attached).

My custom recipe also defines the KBUILD_OUTPUT variable to tell the kernel where to put build outputs.

Here is an extract:


--------------
inherit externalsrc
EXTERNALSRC_pn-linux-externalsrc = "${S}"
EXTERNALSRC_BUILD_pn-linux-externalsrc = "${B}"

LINUX_VERSION ?= "3.10"
LINUX_VERSION_EXTENSION = "-edison-${LINUX_KERNEL_TYPE}"

S = "my/custom/linux-kernel"
B = "${WORKDIR}/${BP}"

# This is required for kernel to do the build out-of-tree.
# If this is not set, most of the kernel make targets won't work properly
# as they'll be executed in the sources
export KBUILD_OUTPUT="${B}"

# The previous line should not be necessary when those 2 are added
# but it doesn't work..
KBUILD_OUTPUT = "${B}"
OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
Comment 6 Fabien Chéreau 2014-05-22 16:13:24 UTC
The patch applies on the last yocto-1.6 release (tag).
Comment 7 Andra Necula 2014-09-17 15:50:57 UTC
Hi,
I re-tested the issue on my Ubuntu 14.04, 
commit a44006262cf3b810ec78b4cccd8076102a7a0f3e
On my system I couldn't reproduce the bug.
Comment 8 Andra Necula 2014-09-17 15:51:21 UTC
Hi,
I re-tested the issue on my Ubuntu 14.04, 
commit a44006262cf3b810ec78b4cccd8076102a7a0f3e
On my system I couldn't reproduce the bug.