<?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>13360</bug_id>
          
          <creation_ts>2019-05-23 14:43:41 +0000</creation_ts>
          <short_desc>kernel-dev: package full kernel source and headers for reference purposes</short_desc>
          <delta_ts>2026-02-26 16:06:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>kernel</component>
          <version>0.0.0</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>IN PROGRESS REVIEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>6.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Bruce Ashfield">bruce.ashfield</reporter>
          <assigned_to name="Bruce Ashfield">bruce.ashfield</assigned_to>
          <cc>mklntf</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>tom.zanussi</cc>
    
    <cc>zhe.he</cc>
    
    <cc>zoran.stojsavljevic</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>83894</commentid>
    <comment_count>0</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-05-23 14:43:41 +0000</bug_when>
    <thetext>kernel-devsrc is a curated / minimal set of kernel artifacts and build infrastructure to support out of tree module builds, and header files (similar to the RH packaging of the development artifacts).

There are still cases where the full kernel source, or headers, can be useful as a reference against the running kernel (until the in kernel headers tgz is widely available).

The issue with the multiple kernel source providers is really about test cycles. The smaller devsrc is for on-target module development and builds against the exported uapi headers, and that is what the nightly / automated tests will use. We had issues with both the amount of time it took to package the entire source, and the amount of space that it took up on the images. Hence the creation of devsrc.

With new kernel-source and kernel-headers packages (the working names), they are provided as references to the running kernel, and will largely be an exercise left up to the developer to use them as they want.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83897</commentid>
    <comment_count>1</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-05-23 14:46:12 +0000</bug_when>
    <thetext>current status: rebasing patches to master, and performing multi-arch tests. Some symlinks, etc, need to be moved to post install scripts as they conflict and prevent some packages from being installed at the same time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83956</commentid>
    <comment_count>2</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-05-27 18:27:14 +0000</bug_when>
    <thetext>FYI: The new reference headers and source packages are following the debian/ubuntu naming strategy of: linux-headers-&lt;version&gt; and linux-source-&lt;version&gt;

The only real difference between linux-headers-&lt;version&gt; and kernel-devsrc is that there are extra headers. So it is essential a super-set of kernel-devsrc. This is due to the fact that to actually make the headers useful, you&apos;d want to build against them. kernel-devsrc already has minimal headers + everything we need to do this. The request for linux-headers is to grab more &quot;what if&quot; header files. So it is a larger package and works similarly to the debian version.

The details are:

The linux-source-&lt;version&gt; package install to /usr/src/linux-source-&lt;version&gt;
The kernel-headers-&lt;version&gt; package install to /usr/src/linux-headers-&lt;version&gt;

It is also possible that we can make a postinst convenience symlink from /usr/src/linux-source to the currently installed linux-source, and likewise for the linux-headers package.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83961</commentid>
    <comment_count>3</comment_count>
    <who name="Zoran Stojsavljevic">zoran.stojsavljevic</who>
    <bug_when>2019-05-28 03:19:34 +0000</bug_when>
    <thetext>Hello Bruce,

It seems that my bugzilla entry 13361 is duplicate of 13360. I apologize for that. I did not spot this one, although I searched the entries. My bad.

@13360:

It is simple impossible what you have wrote here. If you use minimalistic kernel with all source code in it, it is impossible that the same header tree would be 2x bigger.

I did explicit investigation about my latest host (HP Elite Book 840-G1) where I have dual-boot system (WIN10 and Fedora 29) F29 kernel, and results are speaking for themselves (obviously opposing your statements).

Here is what my F29 5.0.17 kernel headers are in size (installed):
[user@fedora29-ssd 5.0.17-200.fc29.x86_64]$ pwd
/usr/src/kernels/5.0.17-200.fc29.x86_64
[user@fedora29-ssd 5.0.17-200.fc29.x86_64]$ du --summarize 
102124	.
[user@fedora29-ssd 5.0.17-200.fc29.x86_64]$

And here is what the size of the whole kernel, compressed is:
https://rpmfind.net/linux/RPM/fedora/updates/29/x86_64/Packages/k/kernel-5.0.17-200.fc29.x86_64.html

You can download it, unpack, and see how big it is!
Here is just the basic kernel source in .xz format (I did not include patches and support shell files, after unpacking):
[vuser@fedora29-ssd kernel.fedora]$ pwd
/home/vuser/projects/kernel.fedora
[vuser@fedora29-ssd kernel.fedora]$ ls -al linux-5.0.tar.xz
-rw-rw-r--. 1 vuser vboxusers 105235152 Mar  4 15:57 linux-5.0.tar.xz
[vuser@fedora29-ssd kernel.fedora]$

I unpacked it, to see/experience for myself:
[vuser@fedora29-ssd linux-5.0]$ pwd
/home/vuser/projects/kernel.fedora/linux-5.0
[vuser@fedora29-ssd linux-5.0]$ du --summarize 
955756	.
[vuser@fedora29-ssd linux-5.0]$

I hope this clears the confusion.

Zoran</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83962</commentid>
    <comment_count>4</comment_count>
    <who name="Zoran Stojsavljevic">zoran.stojsavljevic</who>
    <bug_when>2019-05-28 04:14:25 +0000</bug_when>
    <thetext>https://bugzilla.yoctoproject.org/show_bug.cgi?id=13360#c3

Zoran</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83965</commentid>
    <comment_count>5</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-05-28 15:49:31 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Hello Bruce,
&gt; 
&gt; It seems that my bugzilla entry 13361 is duplicate of 13360. I apologize for
&gt; that. I did not spot this one, although I searched the entries. My bad.
&gt; 
&gt; @13360:
&gt; 
&gt; It is simple impossible what you have wrote here. If you use minimalistic
&gt; kernel with all source code in it, it is impossible that the same header
&gt; tree would be 2x bigger.

This is *not* what I am saying. The existing kernel-devsrc package is not the entire kernel source tree. It is already a minimal set of headers + build infrastructure for building out of three modules. You cannot get any smaller than it via a headers package.

As such, there&apos;s nothing really to do on that front. kernel-devsrc is already the smallest.

This bug will provide two new packages for those that want them: linux-headers (which is slightly larger than kernel-devsrc) and linux-source, which is a compressed capture of the entire kernel source tree (which is large, but is only intended for reference).

Bruce

&gt; 
&gt; I did explicit investigation about my latest host (HP Elite Book 840-G1)
&gt; where I have dual-boot system (WIN10 and Fedora 29) F29 kernel, and results
&gt; are speaking for themselves (obviously opposing your statements).
&gt; 
&gt; Here is what my F29 5.0.17 kernel headers are in size (installed):
&gt; [user@fedora29-ssd 5.0.17-200.fc29.x86_64]$ pwd
&gt; /usr/src/kernels/5.0.17-200.fc29.x86_64
&gt; [user@fedora29-ssd 5.0.17-200.fc29.x86_64]$ du --summarize 
&gt; 102124	.
&gt; [user@fedora29-ssd 5.0.17-200.fc29.x86_64]$
&gt; 
&gt; And here is what the size of the whole kernel, compressed is:
&gt; https://rpmfind.net/linux/RPM/fedora/updates/29/x86_64/Packages/k/kernel-5.0.
&gt; 17-200.fc29.x86_64.html
&gt; 
&gt; You can download it, unpack, and see how big it is!
&gt; Here is just the basic kernel source in .xz format (I did not include
&gt; patches and support shell files, after unpacking):
&gt; [vuser@fedora29-ssd kernel.fedora]$ pwd
&gt; /home/vuser/projects/kernel.fedora
&gt; [vuser@fedora29-ssd kernel.fedora]$ ls -al linux-5.0.tar.xz
&gt; -rw-rw-r--. 1 vuser vboxusers 105235152 Mar  4 15:57 linux-5.0.tar.xz
&gt; [vuser@fedora29-ssd kernel.fedora]$
&gt; 
&gt; I unpacked it, to see/experience for myself:
&gt; [vuser@fedora29-ssd linux-5.0]$ pwd
&gt; /home/vuser/projects/kernel.fedora/linux-5.0
&gt; [vuser@fedora29-ssd linux-5.0]$ du --summarize 
&gt; 955756	.
&gt; [vuser@fedora29-ssd linux-5.0]$
&gt; 
&gt; I hope this clears the confusion.
&gt; 
&gt; Zoran</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83966</commentid>
    <comment_count>6</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-05-28 15:57:32 +0000</bug_when>
    <thetext>Logging the latest numbers for reference:

root@qemux86-64:/usr/src# ls -alF
total 16
drwxr-xr-x  4 root root 4096 May 28 15:52 ./
drwxr-xr-x 10 root root 4096 May 28 13:38 ../
lrwxrwxrwx  1 root root   46 May 28 13:38 kernel -&gt; ../../lib/modules/5.0.17-yocto-standard/source/
lrwxrwxrwx  1 root root   35 May 28 15:51 linux-headers -&gt; linux-headers-5.0.17-yocto-standard/
drwxr-xr-x 23 root root 4096 May 28 15:49 linux-headers-5.0.17-yocto-standard/
lrwxrwxrwx  1 root root   34 May 28 15:52 linux-source -&gt; linux-source-5.0.17-yocto-standard/
drwxr-xr-x  2 root root 4096 May 28 15:49 linux-source-5.0.17-yocto-standard/
root@qemux86-64:/usr/src# du -shL kernel
89M     kernel
root@qemux86-64:/usr/src# du -shL linux-headers
114M    linux-headers
root@qemux86-64:/usr/src# du -shL linux-source
123M    linux-source
root@qemux86-64:/usr/src# ls -alF linux-source/
total 125764
drwxr-xr-x 2 root root      4096 May 28 15:49 ./
drwxr-xr-x 4 root root      4096 May 28 15:52 ../
-rw-r--r-- 1 root root 128771907 May 28 13:41 linux-source-5.0.17-yocto-standard.tar.bz2

root@qemux86-64:/usr/src# rpm -qa | grep linux-headers
linux-headers-5.0.17-yocto-standard-1.0-r0.qemux86_64
root@qemux86-64:/usr/src# rpm -qa | grep linux-source 
linux-source-5.0.17-yocto-standard-1.0-r0.qemux86_64</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83968</commentid>
    <comment_count>7</comment_count>
    <who name="Zoran Stojsavljevic">zoran.stojsavljevic</who>
    <bug_when>2019-05-28 16:40:22 +0000</bug_when>
    <thetext>*** Bug 13361 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83971</commentid>
    <comment_count>8</comment_count>
    <who name="Zoran Stojsavljevic">zoran.stojsavljevic</who>
    <bug_when>2019-05-29 12:27:04 +0000</bug_when>
    <thetext>&gt; root@qemux86-64:/usr/src# du -shL kernel
&gt; 89M     kernel
&gt; root@qemux86-64:/usr/src# du -shL linux-headers
&gt; 114M    linux-headers
&gt; root@qemux86-64:/usr/src# du -shL linux-source
&gt; 123M    linux-source
&gt; root@qemux86-64:/usr/src# ls -alF linux-source/
&gt; total 125764
&gt; drwxr-xr-x 2 root root      4096 May 28 15:49 ./
&gt; drwxr-xr-x 4 root root      4096 May 28 15:52 ../
&gt; -rw-r--r-- 1 root root 128771907 May 28 13:41 linux-source-5.0.17-yocto-standard.tar.bz2

Here I assume that the package linux-headers is made out of linux-source (linux-source-5.0.17-yocto-standard.tar.bz2 size 123M), NOT out of minimalistic kernel (how you called it). In this case, everything follows the right pattern.

To be politically correct, you should make another package linux-headers out of your minimalistic kernel, and this (my best guess) will follow the rules, known for so long.

Zoran</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84756</commentid>
    <comment_count>9</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-08-27 15:21:58 +0000</bug_when>
    <thetext>Implementation is done for this. 

The patches work, but there&apos;s an overhead to do the extra copying in devsrc. I can make the patches available, but really, this should probably be split to avoid the copying unless required. It may not make the release due to that last issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89470</commentid>
    <comment_count>10</comment_count>
    <who name="He Zhe">zhe.he</who>
    <bug_when>2021-03-02 03:36:17 +0000</bug_when>
    <thetext>Do we have any plan to get this merged to Yocto? Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89472</commentid>
    <comment_count>11</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2021-03-02 13:17:58 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; Do we have any plan to get this merged to Yocto? Thanks.

I may propose it in the next release cycle, but there are still some changes required.

But it is still a bad idea. Your comment implies that you think you have a valid use case for it, so please, share that here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89480</commentid>
    <comment_count>12</comment_count>
    <who name="He Zhe">zhe.he</who>
    <bug_when>2021-03-03 02:13:40 +0000</bug_when>
    <thetext>Before https://git.openembedded.org/openembedded-core/commit/?id=007ef1f468110b2698a27ea9a6d43fed5a0a9fc2
We were able to build kernel from full source on target and our customers have been using that for further development since.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89481</commentid>
    <comment_count>13</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2021-03-03 03:06:49 +0000</bug_when>
    <thetext>(In reply to comment #12)
&gt; Before
&gt; https://git.openembedded.org/openembedded-core/commit/
&gt; ?id=007ef1f468110b2698a27ea9a6d43fed5a0a9fc2
&gt; We were able to build kernel from full source on target and our customers
&gt; have been using that for further development since.

That&apos;s a very old commit at this point, so what did, or didn&apos;t work before isn&apos;t really relevant when it wasn&apos;t an issue for the past two plus years.

The intention of this package is not to support a full kernel rebuild, it is simply to make the sources available as a reference.

That being said, I&apos;ll complete work on this and taint it properly such that it can&apos;t be used instead of the devsrc, but instead be a variant of devsrc and it should be acceptable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89482</commentid>
    <comment_count>14</comment_count>
    <who name="Zoran Stojsavljevic">zoran.stojsavljevic</who>
    <bug_when>2021-03-03 04:32:12 +0000</bug_when>
    <thetext>&gt; The intention of this package is not to support
&gt; a full kernel rebuild, it is simply to make the
&gt; sources available as a reference.

Wrong reason, if you, Bruce, allow me. The main reason is to allow OOT module support/development on the target platforms, without full kernel source tree support (saving lot of mmc&apos;s target space).

REFERENCES:
       Debian: linux-headers packages
       Fedora: kernel-devel packages.

Zoran
_______</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89487</commentid>
    <comment_count>15</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2021-03-03 13:15:30 +0000</bug_when>
    <thetext>(In reply to comment #14)
&gt; &gt; The intention of this package is not to support
&gt; &gt; a full kernel rebuild, it is simply to make the
&gt; &gt; sources available as a reference.
&gt; 
&gt; Wrong reason, if you, Bruce, allow me. The main reason is to allow OOT
&gt; module support/development on the target platforms, without full kernel
&gt; source tree support (saving lot of mmc&apos;s target space).
&gt; 
&gt; REFERENCES:
&gt;        Debian: linux-headers packages
&gt;        Fedora: kernel-devel packages.
&gt; 
&gt; Zoran
&gt; _______


No, I meant what I typed. kernel-devsrc already provides that capability. This variant was only added as a potential reference to the entire source tree.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89488</commentid>
    <comment_count>16</comment_count>
    <who name="Zoran Stojsavljevic">zoran.stojsavljevic</who>
    <bug_when>2021-03-03 14:01:52 +0000</bug_when>
    <thetext>&gt; kernel-devsrc already provides that capability.

So, all other distros (RHEL, Fedora, SuSE, Debian, Ubuntu...) are wrong, taking for the target OOT drivers&apos; compilation ONLY kernel headers approach, NOT the entire kernel source.

This is what you are trying to tell to/convince us, or ... ???

Z</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89489</commentid>
    <comment_count>17</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2021-03-03 14:31:17 +0000</bug_when>
    <thetext>(In reply to comment #16)
&gt; &gt; kernel-devsrc already provides that capability.
&gt; 
&gt; So, all other distros (RHEL, Fedora, SuSE, Debian, Ubuntu...) are wrong,
&gt; taking for the target OOT drivers&apos; compilation ONLY kernel headers approach,
&gt; NOT the entire kernel source.
&gt; 
&gt; This is what you are trying to tell to/convince us, or ... ???
&gt; 
&gt; Z

kernel-devsrc IS the minimal subset of the kernel source for building, so Im not sure what you are trying to say above.

That&apos;s not what I&apos;m saying, and I&apos;m aware of what is, or isn&apos;t done in other distros, and am not trying to validate or invalidate what they do, nor are we trying to copy what they do.

We HAD full kernel source, it caused problems with I/O, we are using a curated kernel source, similar to what RHEL does (in fact, the basis of the package are file selections from RHEL).

The points are:

  - The history and other practices are understood.
  - We already fully support out of tree module builds
  - I&apos;ve said that I have a way to tweak the existing package to have a variant and not double the support, and I&apos;ll revisit it in the next dev cycle.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89490</commentid>
    <comment_count>18</comment_count>
    <who name="Zoran Stojsavljevic">zoran.stojsavljevic</who>
    <bug_when>2021-03-03 18:15:35 +0000</bug_when>
    <thetext>&gt; I&apos;ve said that I have a way to tweak the
&gt; existing package to have a variant and
&gt; not double the support, and I&apos;ll revisit
&gt; it in the next dev cycle.

Argument accepted. But before revisiting, please, read the following important remark (Debian build for armv7 A8 on target and tested - prepared on target)

Kernel &gt;= 5.10.0: to prepare out-of-tree device driver compilation in /usr/src/$(uname -r)/

debian@arm:/usr/src/$(uname -r)# make modules_prepare

root@arm:/usr/src/5.10.14-bone22# make modules_prepare
	CALL	scripts/checksyscalls.sh
	CALL	scripts/atomic/check-atomics.sh
	LDS	scripts/module.lds		&lt;&lt;======= NEW ADDITION =======

Please, do note the difference from previous kernels and 5.10.0 onward: LDS scripts/module.lds

The 5.10.0 patch changing the behavior is the following:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Makefile?id=746b25b1aa0f5736d585728ded70a8141da91edb

Just mentioning, since this change might take you of the guard! ;-)

Zoran</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99925</commentid>
    <comment_count>19</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-10-17 19:04:12 +0000</bug_when>
    <thetext>Bulk move of medium importance bugs from 5.1 to 5.2 on behalf of Bruce.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104416</commentid>
    <comment_count>20</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-02-26 16:06:40 +0000</bug_when>
    <thetext>Parked in 6.99</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>