The virtual/linux-sources depends from sys-kernel/gentoo-kernel or sys-kernel/gentoo-kernel-bin packages which not provide sources. The virtual/linux-sources should not depend from this packages or the packages should provide sources.
Can you explain why this matters? virtual/linux-sources is for ebuilds to depend on when they, really, need you to just have some kernel to build modules against or whatever. It's not intended for users to just emerge the virtual hence it shouldn't matter. Please elaborate.
There are two types of modules. The usual that require only the headers for build. And modules that depend of kernel source and require reuse some of kernel sources (*.c files for example) for build. With traditional source based kernels virtual/linux-sources is sufficient for any type of module because the headers and sources are in /usr/src/linux. When dist kernels are used only the headers are provided by virtual/linux-sources and only the first type of modules can be build. I think that should be a way for an all types of modules to be build. And somehow providing sources (not only headers) for dist kernels with virtual/linux-sources is look as the best way for me. For exmaple adding sys-kernel/gentoo-kernel-sources and sys-kernel/gentoo-kernel-bin-source packages of some USE flags for existing packages can help. Or if the virtual/linux-sources are exist only to provide headers than it should be renamed to virtual/linux-headers or the corresponding description should be added.
(In reply to romikb from comment #2) > There are two types of modules. The usual that require only the headers for > build. And modules that depend of kernel source and require reuse some of > kernel sources (*.c files for example) for build. Can you give an example of one of the latter so we can look into it? > [...] Yeah, this is a fair point, I think. I'm just surprised to learn such modules exist. Can you show me a few?
I am new to Gentoo and can't say anything about the modules in main tree. May be some overlays have. My example is https://github.com/amnezia-vpn/amneziawg-linux-kernel-module. It have packages for other distros. Some month ago I wrote a simple ebuild for Funtoo for this module. Funtoo prebuild kernel provide sources by default. Now I try to add an ebuild to my Gentoo overlay. I attach my Funtoo module ebuild as example after this post.
Created attachment 899603 [details] Example ebuild
It is my understanding that it is bad practice for an out-of-tree kernel module to directly rely on the kernel sources. That being said, I suppose we could add USE=source to optionally also install the kernel source code.
Created attachment 899604 [details] proof of concept patch for kernel-build.eclass Just as a quick proof of concept, the attached patch installs the dist-kernel with the kernel sources included if USE=source.
> It is my understanding that it is bad practice for an out-of-tree kernel module to directly rely on the kernel sources. I agree with this. Module dev says that source they require is different on different kernels and different distros and they can't put it in repo. >That being said, I suppose we could add USE=source to optionally also install the kernel source code. It looks like one of solutions. But if the module ebuild is depend from virtual/linux-sources and if virtual/linux-sources will be dependent from sys-kernel/gentoo-kernel[source] will it require the kernel rebuild if user have sys-kernel/gentoo-kernel without USE=sources? I look at having a separate sys-kernel/gentoo-kernel(-bin)-source package that emerge source when module emerge virtual/linux-sources and remove them after module build on unmerge virtual/linux-sources. But it look weird.
(In reply to romikb from comment #8). > It looks like one of solutions. But if the module ebuild is depend from > virtual/linux-sources and if virtual/linux-sources will be dependent from > sys-kernel/gentoo-kernel[source] will it require the kernel rebuild if user > have sys-kernel/gentoo-kernel without USE=sources? Yes > I look at having a separate sys-kernel/gentoo-kernel(-bin)-source package > that emerge source when module emerge virtual/linux-sources and remove them > after module build on unmerge virtual/linux-sources. But it look weird. We already have a separate package package providing the sources for sys-kernel/gentoo-kernel(-bin). That is what sys-kernel/gentoo-sources is. Is your proposal to adjust virtual/linux-sources to depend only on sys-kernel/*-sources packages? I suppose it could be done, but it would require adjusting a bunch of dependencies elsewhere, and possibly introducing a new virtual/linux that depends on either virtual/linux-sources or virtual/dist-kernel.
I'd rather look into providing the specific source files that specific modules need. The whole set can be rather big.
(In reply to romikb from comment #8) > > It is my understanding that it is bad practice for an out-of-tree kernel module to directly rely on the kernel sources. > I agree with this. Module dev says that source they require is different on > different kernels and different distros and they can't put it in repo. On another note, this seems *extremely* fragile. It really needs a better solution upstream.
(In reply to Andrew Nowa Ammerlaan from comment #9) > We already have a separate package package providing the sources for > sys-kernel/gentoo-kernel(-bin). That is what sys-kernel/gentoo-sources is. Can I somehow ask the portage to emerge gentoo-sources of the same version as gentoo-kernel(-bin) is installed? > Is your proposal to adjust virtual/linux-sources to depend only on > sys-kernel/*-sources packages? I would like to propose to eliminate the uncertainty. Remove packages that not provide sources or make this packages provide sources or change the description to "Provide headers and sources (if available)" or anything else. I am too new in Gentoo and don't know the right way. > I'd rather look into providing the specific source files that specific modules > need. The whole set can be rather big. Possibly I can fork the module repo later. Now I don't sure how different required for module kernel sources in different kernels in Gentoo.
(In reply to romikb from comment #12) > (In reply to Andrew Nowa Ammerlaan from comment #9) > > We already have a separate package package providing the sources for > > sys-kernel/gentoo-kernel(-bin). That is what sys-kernel/gentoo-sources is. > > Can I somehow ask the portage to emerge gentoo-sources of the same version > as gentoo-kernel(-bin) is installed? Sort off, you can specifically choose which kernel version to emerge: emerge sys-kernel/gentoo-sources:x.y.z sys-kernel/gentoo-kernel:x.y.z > > Is your proposal to adjust virtual/linux-sources to depend only on > > sys-kernel/*-sources packages? > > I would like to propose to eliminate the uncertainty. > > Remove packages that not provide sources or make this packages provide > sources or change the description to "Provide headers and sources (if > available)" or anything else. I am too new in Gentoo and don't know the > right way. I suppose it does make sense for the package named linux-sources to actually provide the sources. The difficulty is just that a lot of stuff depends on this, so changing it is probably a lot of work (not to mention that the documentation would need updating as well).
Reassigning to Distribution Kernel folks as this discussion is around those ebuilds and proposed changes to them