<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>7095</bug_id>
          
          <creation_ts>2014-12-20 11:18:22 +0000</creation_ts>
          <short_desc>Can&apos;t install kernel-dev and kernel-devsrc together</short_desc>
          <delta_ts>2016-07-29 16:00:33 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Kernel</product>
          <component>linux-yocto</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.2 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Richard Purdie">richard.purdie</reporter>
          <assigned_to name="Bruce Ashfield">bruce.ashfield</assigned_to>
          <cc>bruce.ashfield</cc>
    
    <cc>dvhart</cc>
    
    <cc>jose.perez.carranza</cc>
    
    <cc>juro.bystricky</cc>
    
    <cc>net147</cc>
    
    <cc>sgw</cc>
    
    <cc>tom.zanussi</cc>
          
          <qa_contact name="David Rodriguez">david.israelx.rodriguez.castellanos</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>47646</commentid>
    <comment_count>0</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2014-12-20 11:18:22 +0000</bug_when>
    <thetext>If you try and install kernel-dev and kernel-devsrc into the same image you can&apos;t since they have overlapping files. For now I tweaked core-image-sato-sdk just to install kernel-devsrc but this needs to be fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47771</commentid>
    <comment_count>1</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2015-01-07 19:58:08 +0000</bug_when>
    <thetext>So these packages serve different purposes.

kernel-dev allows for building out-of-tree modules by including headers, sources, and generated files necessary for that task. The vmlinux and such are also useful for other debugging tasks independent from module building.

kernel-devsrc provides the complete kernel source.

As they serve different purposes, we should be able to install them to different locations.

Debian uses a similar approach with:
linux-headers-*: this package aligns with kernel-dev and installs to /usr/src/linux-headers-&lt;VERSION&gt;-(common|&lt;ARCH&gt;)

linux-sourc-*: this package is analogous to kernel-devsrc, and includes a tarball of the sources as well as a set of configurations, installed to /usr/src/linux-source* and /usr/src/linux-config*.

This split makes sense to me and seems to mirror our requirements pretty well. Any objections to resolving this issue by having the two packages install to different /usr/src/* locations?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47772</commentid>
    <comment_count>2</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2015-01-07 20:08:06 +0000</bug_when>
    <thetext>No objection here. I can live with that. We have almost no users of the new
recipes/names, so the switch should be straight forward from that point of view.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47773</commentid>
    <comment_count>3</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2015-01-07 20:11:18 +0000</bug_when>
    <thetext>There is still some overlap in the packages, since you can also build modules
against kernel-devsrc. 

Does our debian example have the capability of building modules against both
the headers and the source ?

If we have the capability of building modules against both .. do we run the risk of
them getting out of sync ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47777</commentid>
    <comment_count>4</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2015-01-07 21:32:44 +0000</bug_when>
    <thetext>The Debian example installs a tarball of the source, so specifically not intended to build modules. I don&apos;t think devsrc should either.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47778</commentid>
    <comment_count>5</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2015-01-07 21:35:00 +0000</bug_when>
    <thetext>But one of the goals of devsrc is that you can install it, and build the entire
kernel on the target. If you can do that, you can build modules. 

We need a package that has that capability. So either it is added to the 
headers (which seems wrong), or it is part of devsrc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47779</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-01-07 21:43:19 +0000</bug_when>
    <thetext>I believe that we do need to split these into two locations, but there still should not be an overlap of files between them.

kernel-devsrc is the kernel source code. kernel-dev should probably become a &quot;kernel-buildconfig&quot; type package containing the build artifacts like the defconfig, System.map file and other key components needed for the build of modules (other than the source).

Basically, kernel-devvsrc is work-shared/MACHINE/kernel-source
and kernel-dev would have the do_shared_workdir parts of work-shared/MACHINE/kernel-build (but not the make scripts ones). We do need to figure out the &quot;make scripts&quot; part at some later date, if may also become part of kernel-dev.

Fixing this bug is hard right now with the single usr/src/kernel dir, once we split it, this should become much easier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47782</commentid>
    <comment_count>7</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2015-01-07 22:01:06 +0000</bug_when>
    <thetext>Hrm.... so this packages things as they are on the host effectively, and I can see the appeal there. The typical distro considers these two packages to be very different things and they provide partially duplicated data (ascii ven diagram, without the circles):

linux-headers    both       linux-source
=============    ====       ============
                 headers
                 config
systemmap                   all source files
generated files


linux-headers is a minimal subset of the sources, plus any necessary generated files. This fills the &quot;build out of tree modules against the running kernel&quot; requirement. The full source is also available for rebuilding the full kernel, patching, etc. Debian splits out headers and generated files with the source and build symlinks to common and arch dirs respectively. The linux-source package provides config and a tarball. I can see this appealing to users as they only get as much as they require with each package.

In order to improve our build time, it sounds like the proposal from Richard is to forgo the manual pruning of only the required bits, and require the use of the complete source for the build external modules use case.

I suspect we&apos;ll have users that care about each use case, and some of those that just want to build modules really won&apos;t want to have to install all the sources.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47816</commentid>
    <comment_count>8</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-01-08 20:52:37 +0000</bug_when>
    <thetext>How is the &quot;minimal subset of the sources&quot; built? It his the make install_headers or whatever linux-libc-headers does?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52918</commentid>
    <comment_count>9</comment_count>
      <attachid>2642</attachid>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2015-08-08 17:33:41 +0000</bug_when>
    <thetext>Created attachment 2642
kernel.bbclass patch to populate kernel-dev</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52919</commentid>
    <comment_count>10</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2015-08-08 17:34:22 +0000</bug_when>
    <thetext>A typical out-of-tree kernel module build process is described in
http://www.cyberciti.biz/tips/build-linux-kernel-module-against-installed-kernel-source-tree.html

The build relies on the existence of  
&quot;/lib/modules/&lt;kernel-version&gt;/build&quot;, containing (or symlink to) a 
necessary set of kernel development files. 

This necessary set should be provided by kernel-dev. The subset should be located at /lib/modules/&lt;kernel-version&gt;/build directly or at a location specified by the symlink (which at present should be something else then /usr/src/&lt;kernel-version&gt;):

/lib/modules/&lt;kernel-version&gt;/build-&gt;/usr/src/&lt;kernel-headers&gt;

Typical content of the subset can be seen here:
https://www.archlinux.org/packages/core/i686/linux-headers/

Users usually install these &quot;kernel-headers&quot; or &quot;linux-headers&quot; via 
# apt-get install linux-headers-$(uname -r)

The easiest way to support both kernel-dev and kernel-devsrc at the same time  is to make sure they don&apos;t reside at the same place. 
Of course this could be optimized, as the bulk of all files for kernel-dev and kernel-devsrc is identical. 

(see the attached patch for kernel.bbclass as one possible way to implement kernel-dev)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54638</commentid>
    <comment_count>11</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2015-09-24 16:55:43 +0000</bug_when>
    <thetext>This won&apos;t make 2.0, so I&apos;m bumping it to 2.1 (even though this is assigned to
Darren). I have some preliminary work on this, so targeting M1 seems reasonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60240</commentid>
    <comment_count>12</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2016-03-21 23:22:53 +0000</bug_when>
    <thetext>The implementation of this @ Wind River, showed some compatibility issues and isn&apos;t aligned with any defacto standard (or standard) at all.

I&apos;m going to take the implementation of this myself, and move it to 2.2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60384</commentid>
    <comment_count>13</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2016-03-24 13:37:59 +0000</bug_when>
    <thetext>I&apos;m now able to install both at the same time, further testing required, but the basics are in place.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60405</commentid>
    <comment_count>14</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2016-03-24 17:03:40 +0000</bug_when>
    <thetext>Packaging and contents aside, we can now install both:

root@qemux86-64:~# opkg list |grep kernel
kernel-4.4.3-yocto-standard - 4.4.3+git0+194a6c1c4b_3d2455f9da-r0
kernel-dev - 4.4.3+git0+194a6c1c4b_3d2455f9da-r0
kernel-devsrc - 1.0-r0
kernel-module-uvesafb - 4.4.3+git0+194a6c1c4b_3d2455f9da-r0

This is a core image minimal with::

CORE_IMAGE_EXTRA_INSTALL = &quot; kernel-dev kernel-devsrc perf perf-python&quot;
PERF_FEATURES_ENABLE += &quot;perf-scripting perf-tui&quot;
IMAGE_FEATURES += &quot;package-management&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61022</commentid>
    <comment_count>15</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2016-04-11 16:16:21 +0000</bug_when>
    <thetext>Works fine, both kernel-dev, kernel-devsrc co-exist peacefully.
Tested with a modified build-appliance-image 
https://bugzilla.yoctoproject.org/show_bug.cgi?id=8073
where I was able to build out-of-tree-kernel module.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>2642</attachid>
            <date>2015-08-08 17:33:41 +0000</date>
            <delta_ts>2015-08-08 17:33:41 +0000</delta_ts>
            <desc>kernel.bbclass patch to populate kernel-dev</desc>
            <filename>kernel.bbclass.patch</filename>
            <type>text/plain</type>
            <size>1181</size>
            <attacher name="Juro Bystricky">juro.bystricky</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL21ldGEvY2xhc3Nlcy9rZXJuZWwuYmJjbGFzcyBiL21ldGEvY2xhc3Nlcy9r
ZXJuZWwuYmJjbGFzcwppbmRleCBkMDZmNmNmLi5jNDhlNDM1IDEwMDY0NAotLS0gYS9tZXRhL2Ns
YXNzZXMva2VybmVsLmJiY2xhc3MKKysrIGIvbWV0YS9jbGFzc2VzL2tlcm5lbC5iYmNsYXNzCkBA
IC0yNDYsNiArMjQ2LDM1IEBAIGtlcm5lbF9kb19pbnN0YWxsKCkgewogCVsgLWUgTW9kdWxlLnN5
bXZlcnMgXSAmJiBpbnN0YWxsIC1tIDA2NDQgTW9kdWxlLnN5bXZlcnMgJHtEfS9ib290L01vZHVs
ZS5zeW12ZXJzLSR7S0VSTkVMX1ZFUlNJT059CiAJaW5zdGFsbCAtZCAke0R9JHtzeXNjb25mZGly
fS9tb2R1bGVzLWxvYWQuZAogCWluc3RhbGwgLWQgJHtEfSR7c3lzY29uZmRpcn0vbW9kcHJvYmUu
ZAorCisJIyBDcmVhdGUgYSBzdWJzZXQgb2Yga2VybmVsIHNvdXJjZXMsIG5lZWRlZCBmb3Igb3V0
LW9mLXRyZWUgbW9kdWxlIGNvbXBpbGF0aW9uLgorCisJa2VybmVsZGlyPSR7RH0vbGliL21vZHVs
ZXMvJHtL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