Some packages provide kernel modules, and need a kernel source from which a kernel was built. Currently gentoo-kernel-bin does not suffice for it, but a slight change does. The fix will be to retain some files, i.e. gentoo-kernel-bin drops many files after building the kernel, but some files deserve to be there. With the files listed below, I was able to build games-util/xpadneo, sys-fs/zfs-kmod, and sys-power/acpi_call. Hereafter <src> means /usr/src/linux. 1. Kernel detection: Portage fails to detect the kernel version. This can be fixed by keeping <src>/scripts/{Makefile*},{*include} and <src>/arch/x86/Makefile (I'm an amd64 user.) It's a linux-info.eclass issue, and not limited to the above mentioned packages. 2. To build the above packages, further they require: 2-a. some other files in <src>/scripts/. 2-b. <src>/tools/objtools/objtool The points 1 and 2-b should be innocuous. For 2-a, you don't need all from scripts/ , but the situation depends on each package. It obviously is an excess to guarantee the build success of *any* packages, but for users' convenience, it could be nice to provide the "scripts/" directory.( For gentoo-kernel-bin-6.5.10, scripts/ is 5.7MB big.) Or if you think it should be optional, you can add the use flag like "scripts-dir". (Then einfo-ing '''If you build other packages that rely on the kernel tree, consider enabling USE="scripts-dir"''' would be instructive.) # I picked up random packages, and I don't know if they really work. (What I observed is that the install phase was reached for them.) ## If you want to test more packages, AUR packages with the name suffix "-dkms" can be candidates: https://aur.archlinux.org/packages?O=0&K=dkms That's all. Thanks Gentoo developers for reading. Reproducible: Always
I think there's some sort of misunderstanding going on here. You can *absolutely* build out-of-tree modules like xpadneo and zfs-kmod against the sources that gentoo-kernel or gentoo-kernel-bin installs. Please include the full build.log and emerge --info when something fails version detection.
Created attachment 874721 [details] emerge --info sys-kernel/gentoo-kernel-bin:6.5.10 First let us make it clear that sys-kernel/gentoo-kernel is different from gentoo-kernel-bin, and that difference is the point. Let me show an imaginary "stacktrace" of kernel detection failure: --- * Determining the location of the kernel source code * Found kernel source directory: * /usr/src/linux * Could not detect kernel version. * Please ensure that /usr/src/linux points to a complete set of Linux sources. --- Though not fatal, this happens for www-client/firefox-bin, too. (In that case ebuild instead uses the running kernel version. In fact, this has been the case for years for me, and I've been wondering why.) In linux-info.eclass, the above message comes from here: ---[quote]-- get_version() { .... KV_MAJOR=$(getfilevar VERSION "${KERNEL_MAKEFILE}") KV_MINOR=$(getfilevar PATCHLEVEL "${KERNEL_MAKEFILE}") KV_PATCH=$(getfilevar SUBLEVEL "${KERNEL_MAKEFILE}") KV_EXTRA=$(getfilevar EXTRAVERSION "${KERNEL_MAKEFILE}") if [[ -z "${KV_MAJOR}" || -z "${KV_MINOR}" || -z "${KV_PATCH}" ]]; then if [[ -z "${get_version_warning_done}" ]]; then get_version_warning_done=1 qeerror "Could not detect kernel version." qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources." fi ---[/quote] I saw the return value of$( getfilevar ), which was empty. What's the code there? ---[quote] getfilevar() { ... echo -e "e:\\n\\t@echo \$(${1})\\ninclude ${basefname}" | \ nonfatal emake -C "${basedname}" --no-print-directory M="${T}" \ dot-config=0 need-config= need-compiler= \ ${BUILD_FIXES} -s -f - 2>/dev/null ---[/quote] It's echo-ing 'e:\n\t@echo $(VERSION | PATCHLEVEL | etc)\ninclude Makefile' into make. Removing 2>/dev/null, make's error message is: --- Makefile:1108: scripts/Makefile.extrawarn: No such file or directory make: *** No rule to make target 'scripts/Makefile.extrawarn'. Stop. --- Thus scripts/Makefile.extrawarn is necessary, which is lacking in the gentoo-kernel-bin. (I've got sys-kernel/gentoo-kernel-bin-6.5.10 .) Believe me, my "fix" in the original post actually works as a remedy. (I built a kernel from sys-kernel/gentoo-sources, and copied scripts/ and objtool into /usr/src/linux, which points to linux-6.5.10-gentoo-dist, which comes from gentoo-kernel-bin .) At the very least, kernel detection fails. # I'd like to believe you as a good Gentoo user; I also think my claim should already have been made by others — gentoo-kernel-bin has been there for at least three years.
Created attachment 874722 [details] build.log of "emerge www-client/firefox-bin"
gentoo-kernel-bin is built using gentoo-kernel (it's just a binpkg created from the gentoo-kernel ebuild) so it follows the same procedure. It is therefore very unlikely you'd have a file missing from gentoo-kernel-bin which is in gentoo-kernel. Taking /var/cache/distfiles/gentoo-kernel-6.5.8-1.amd64.gpkg.tar and untarring the image within: ``` /tmp/foo/gentoo-kernel-6.5.8-1/image $ stat ./usr/src/linux-6.5.8-gentoo-dist/scripts/Makefile.extrawarn File: ./usr/src/linux-6.5.8-gentoo-dist/scripts/Makefile.extrawarn Size: 3572 Blocks: 8 IO Block: 4096 regular file Device: 0,37 Inode: 78496 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ sam) Gid: ( 1000/ sam) Access: 2023-11-14 05:45:34.141318147 +0000 Modify: 2023-08-27 22:49:51.000000000 +0100 Change: 2023-11-14 05:45:34.141318147 +0000 Birth: 2023-11-14 05:45:34.141318147 +0000 ``` The file you're talking about is there. I believe your workaround works for you, I'm saying it shouldn't be necessary at all, and it's indicative of something else being wrong.
It would help to see 'find /usr/src/linux' to see what other files you're missing. You can compare it with the image output from the gpkg.
I am sorry. I have been doing a silly thing in /etc/portage/env, and I have forgotten it. I apologize for making you spare your time and mental energy.
No worries, it happens. Thank you for the closure / explanation as it helps if someone turns up with a similar thing in the future.