Bug 3293

Summary: kernel.bbclass do_compile fails on include/linux/version.h on current linux git tree
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Darren Hart <dvhart>
Component: kernelAssignee: Bruce Ashfield <bruce.ashfield>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: bruce.ashfield, tom.zanussi
Version: unspecified   
Target Milestone: 1.4 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Darren Hart 2012-10-16 22:54:24 UTC
At some point in the recent past the Linux kernel Makefile changed and include/linux/version.h is no longer a valid target. We use this in kernel.bbclass (not sure why exactly). Before we can update our recipes much further we need to address this:

| DEBUG: Executing shell function do_compile
| NOTE: make -j 12 include/linux/version.h CC=i586-poky-linux-gcc
--sysroot=/build/poky/master/qemux86_SZ60LW/tmp/sysroots/qemux86
LD=i586-poky-linux-ld
--sysroot=/build/poky/master/qemux86_SZ60LW/tmp/sysroots/qemux86
|   GEN
/build/poky/master/qemux86_SZ60LW/tmp/work/qemux86-poky-linux/linux-yocto-custom-3.4+git3+505590204542709b58d454f8ad20013f5cdcfede-r1/linux-qemux86-standard-build/Makefile
| scripts/kconfig/conf --silentoldconfig Kconfig
| make[2]: *** No rule to make target `include/linux/version.h'.  Stop.
Comment 1 Bruce Ashfield 2012-10-17 02:27:00 UTC
What exactly are you doing to trigger this ? Just a straight compile ?
Is that tree really 3.4 ? or is the recipe name just masking the
true version ?

I've dealt with this in some of my dev trees, but I'm not sure how
you are seeing this in your builds .. everyone should be broken if this
is the case.
Comment 2 Darren Hart 2012-10-17 05:10:44 UTC
Linus' tree, commit dd8e8c4a2c902d8350b702e7bc7c2799e5e7e331 with some meta-data added on top.

The error was during do_compile after executing "bitbake linux-yocto-custom" with a linux-yocto-custom recipe pointing to a local Linux git repository.
Comment 3 Bruce Ashfield 2012-10-18 13:18:37 UTC
I'm seeing this on my 3.7-rc1 kernel. I'll work on a fix.
Comment 4 Darren Hart 2012-10-18 13:27:41 UTC
OK, I'm traveling for a few days, so I'll assign this to you :-). Should be a simple version check conditional in the bbclass - although I think checking why we ran that make target explicitly in the first place would be a good thing to do. Perhaps we can get by without it at all.
Comment 5 Bruce Ashfield 2012-10-18 13:35:14 UTC
I had exactly the same thought about the version.h being needed at all, otherwise, we'll definitely make it conditional. I'll send it out for comment either way.
Comment 6 Bruce Ashfield 2012-10-18 13:43:46 UTC
As I thought, this is just the uapi changes breaking yet something else (I took 3 hours upreving patches past this yesterday).

-       oe_runmake include/linux/version.h CC="${KERNEL_CC}" LD="${KERNEL_LD}"
+       oe_runmake include/generated/uapi/linux/version.h CC="${KERNEL_CC}" LD="${KERNEL_LD}"

Fixes this for 3.7 kernels, I'll either remove it or make it conditional next.
Comment 7 Bruce Ashfield 2012-10-31 01:53:25 UTC
The fix was merged to master.

commit 4211de44e093f698604bbbb6c6ad70f63893cc14
Author: Bruce Ashfield <bruce.ashfield@windriver.com>
Date:   Thu Oct 18 10:47:05 2012 -0400

    kernel.bbclass: remove explicit version.h target
    
    The compilation routine for the kernel has an explicit call to
    build version.h, which works fine for most kernels, but the
    location of it has recently changes.
    
    commit d183e6f5 [UAPI: Move linux/version.h]
    commit 10b63956 [UAPI: Plumb the UAPI Kbuilds into the user
                     header installation and checking]
    
    moves the file to include/generated/linux/version.h and then to
    include/generated/uapi/linux/version.h.
    
    As a result kernel builds of 3.7 or bisection builds of intermediate
    kernel commits will fail with:
    
      make[2]: *** No rule to make target `include/linux/version.h'.  Stop.
    
    Making the explicit version.h build conditional on the version, or
    via a file test would fix the problem, but it introduces some complexity
    to the build.
    
    Even without an explicit call to build version.h, it is always produced
    by the kernel build, so it can simply be removed.
    
    This extra make line was originally so that the kernel version could be
    determined, so that then different instructions could be executed depending
    on whether it was a 2.4 or 2.6 kernel. Since we no longer support 2.4, this
    code is no longer needed.
    
    [YOCTO: #3293]
    
    (From OE-Core rev: 4cb20fa89e571ffbc448c579a758db0b9074acf4)
    
    Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Comment 8 Bruce Ashfield 2012-10-31 01:53:54 UTC
linux-yocto-dev (3.7-rc3) confirmed to build on master.