Bug 6753

Summary: Problems with kernel config fragments in dirs with common prefix
Product: [Yocto Project Subprojects] Kernel Reporter: Ola Nilsson <ola.x.nilsson>
Component: kernel-toolingAssignee: Bruce Ashfield <bruce.ashfield>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: yp.kernel.watcher, yp.watcher
Version: 1.7   
Target Milestone: 1.7 M4   
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
Actual recipe files
none
Complete BSP layer that reproduces the problem none

Description Ola Nilsson 2014-09-23 14:47:26 UTC
kern-tools on master (but not daisy) gets confused when kernel config fragments are loaded from several directories and the common prefix is not a complete directory.

An example: 

My kernel recipes is called mylinux_3.15.bb, mylinux_3.14.bb, and mylinux_3.12.bb.

They are stored in my layer at recipes-kernel/linux together with one set of kernel config fragments per kernel major version.  I also have a directory for common fragments that are the same for several versions:

recipes/kernel/
  - mylinux_3.12/
      - defconfig
  - mylinux_3.14/
      - defconfig
  - mylinux_3.15/
      - defconfig
  - mylinux/
      - patches/
          - a_patch.scc
          - 0001-the_patch.patch
  - mylinux.inc
  - mylinux_3.12.bb
  - mylinux_3.14.bb
  - mylinux_3.15.bb

In mylinux.inc I set up FILESEXTRAPATHS, SRC_URI, and KERNEL_FEATURES like this: 

    FILESEXTRAPATHS .= ":${THISDIR}/${PN}:${THISDIR}/${PN}_${LINUX_VERSION}"
    SRC_URI += "file://defconfig"
    SRC_URI += "file://patches/0001-Do-not-copy-zImage-to-AXIS_KERNEL_DIR.patch"
    KERNEL_FEATURES_append = " no-kernel-image-copy"

KERNEL_FEATURES is also added to from the MACHINE.conf file.

When building mylinux_3.15 the do_patch task will create a folder

    .../.meta/cfg/_3.15/

that contain the necessary fragments.

But the do_kernel_configme task will look for those fragments in 

    .../.meta/cfg_3.15/

Changing the name of recepies-kernel/linux/mylinux/  to recipes-kernel/linux/common-mylinux  makes the problem go away.

I have not been able to figure out where the problem is, but I think it is in the kern-tools package, but possibly in combination with kernel-yocto.bbclass.  In kern-tools there is some comments about using full paths but cutting away the common prefix.  I think this is what doesn't work correctly.
Comment 1 Bruce Ashfield 2014-09-23 14:54:51 UTC
Can you attach a copy of your actual recipes and fragments ? I can turn something around
much faster if I don't have to spend the time to create a parallel infrastructure and reproducer.

Shouldn't be hard to fix.
Comment 2 Ola Nilsson 2014-09-23 15:20:04 UTC
Created attachment 2137 [details]
Actual recipe files

Here is a tarball with the actual contents of recipes-kernel/linux.

/Ola
Comment 3 Bruce Ashfield 2014-09-23 15:21:20 UTC
Thanks. I'll have a look.
Comment 4 Ola Nilsson 2014-09-24 06:26:08 UTC
I realized after I left the office that I sent the working version of the recipes.  It should be trivial to break it again according to the bug description, but let me know if you need more assistance from me.
Comment 5 Bruce Ashfield 2014-09-24 19:12:07 UTC
I've changed a few things to get up and building here, like switching to a korg tree, versus the
one I can't reference.

I've also changed common-linux-porky to linux-porky, and adjusted accordingly.

One last thing I'm missing. What configuration fragment are you pulling into the
build that starts consuming the fragments ?  I must be missing it, since I'm only
getting the defconfig. I assume the machine.conf file that I don't have in the
attachment.

I've seen a few things in the files, but would rather reproduce the problem here, 
before commenting specifically.
Comment 6 Ola Nilsson 2014-09-25 07:41:38 UTC
Created attachment 2138 [details]
Complete BSP layer that reproduces the problem

I've attached a complete BSP layer that I can use to reproduce the bug.

I set MACHINE = "p3367" and use the following layers:

meta              
meta-yocto        = "master:b73082598f97e2351b2c694676057ab2396387f6"
meta-oe           = "master:28e26a9b0ad37d0c92ba42b2727215eef1edf5a2"
meta-linux-porky  = "<unknown>:<unknown>"

bitbake linux-porky triggers the bug for me. 

In the meta-linux-porky layer there are two patches for kern-tools that I've never gotten around to sending to the mailing list.  They concern two failure cases I've run into when using recipe-space kernel configuration fragments.
Comment 7 Bruce Ashfield 2014-09-25 14:54:08 UTC
I'm up and building with the layer, but I needed to make a few mods, since I can't
get to the git repo that is the default, I've switched in a korg repository instead. 
Which of course meant that I had to update the SRCREV (which doesn't matter,
since I'm not actually compiling), and then the Makefile patch, since my context
is different.

So I'm up and running now. Fix pending.
Comment 8 Bruce Ashfield 2014-11-13 17:55:33 UTC
Fixed in Yocto 1.7.