commit:     bcfd48957adc57003821b6801eac84a46139298b
Author:     Boris Staletic <boris.staletic <AT> protonmail <DOT> com>
AuthorDate: Thu Aug 17 17:05:40 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Aug 20 15:46:45 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcfd4895

kernel-build.class: Allow usage with module-less kernel configs

With CONFIG_MODULES not set to either y or m, kernel-build.eclass runs
into two issues:

1. Modules.symvers does not get generated. doins build/Module.symvers
   thus fails.
2. kernel.release exists,
   but in ${WORKDIR}/build/include/config/kernel.release
   while kernel-build_src_install() seems to expect to to find it
   in ${PWD}/include/config.

Closes: https://bugs.gentoo.org/904694
Signed-off-by: Boris Staletic <boris.staletic <AT> protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/32358
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/kernel-build.eclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 276a08a104e0..49462df7d518 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -291,10 +291,18 @@ kernel-build_src_install() {
                ')' -delete || die
        rm modprep/source || die
        cp -p -R modprep/. "${ED}${kernel_dir}"/ || die
+       # If CONFIG_MODULES=y, then kernel.release will be found in modprep as 
well, but not
+       # in case of CONFIG_MODULES is not set.
+       # The one in build is exactly the same as the one in modprep, but the 
one in build
+       # always exists, so it can just be copied unconditionally.
+       cp "${WORKDIR}/build/include/config/kernel.release" \
+               "${ED}${kernel_dir}/include/config/" || die
 
        # install the kernel and files needed for module builds
        insinto "${kernel_dir}"
-       doins build/{System.map,Module.symvers}
+       doins build/System.map
+       # build/Module.symvers does not exist if CONFIG_MODULES is not set.
+       [[ -f build/Module.symvers ]] && doins build/Module.symvers
        local image_path=$(dist-kernel_get_image_path)
        cp -p "build/${image_path}" "${ED}${kernel_dir}/${image_path}" || die
 

Reply via email to