# # configuration written to .config # make[1]: Leaving directory '/var/tmp/portage/sys-kernel/gentoo-kernel-5.8.10/work/modprep' make -j5 O=/var/tmp/portage/sys-kernel/gentoo-kernel-5.8.10/work/modprep V=1 HOSTCC=x86_64-pc-linux-gnu-gcc HOSTCXX=x86_64-pc-linux-gnu-g++ 'HOSTCFLAGS=-mtune=native -O2 -pipe' 'HOSTLDFLAGS=-Wl,-O1 -Wl,--as-needed' CROSS_COMPILE=x86_64-pc-linux-gnu- AS=x86_64-pc-linux-gnu-as CC=x86_64-pc-linux-gnu-gcc LD=x86_64-pc-linux-gnu-ld.bfd AR=x86_64-pc-linux-gnu-ar NM=x86_64-pc-linux-gnu-nm STRIP=: OBJCOPY=x86_64-pc-linux-gnu-objcopy OBJDUMP=x86_64-pc-linux-gnu-objdump ARCH=x86 modules_prepare make -C /var/tmp/portage/sys-kernel/gentoo-kernel-5.8.10/work/modprep -f /var/tmp/portage/sys-kernel/gentoo-kernel-5.8.10/work/linux-5.8/Makefile modules_prepare make[1]: Entering directory '/var/tmp/portage/sys-kernel/gentoo-kernel-5.8.10/work/modprep' make[1]: *** No rule to make target 'modules_prepare'. Stop. make[1]: Leaving directory '/var/tmp/portage/sys-kernel/gentoo-kernel-5.8.10/work/modprep' make: *** [Makefile:185: __sub-make] Error 2 Maybe gentoo-kernel incorrectly assumes that all configurations have enabled support for loadable modules (CONFIG_MODULES)?
kernel-build.eclass ineed assumes that modules enabled.
Had the same issue on my embedded system with no modules, ended up enabling it anyway but it wasn't ideal.
A patch (to kernel-build.eclass) would be helpful.
Is there any patch for this or at least a workaround I don't really need modules
I use grep in my ebuilds to find out if modules are used: grep "CONFIG_MODULES=y" .config >/dev/null RETVAL=$? if [ $RETVAL -ne 0 ]; then export DO_I_HAVE_MODULES=false else export DO_I_HAVE_MODULES=true fi and: if ${DO_I_HAVE_MODULES}; then emake modules ${xmakeopts} fi and finally: if ${DO_I_HAVE_MODULES}; then emake modules_install ${xmakeopts} INSTALL_MOD_PATH="${D}"; fi Is it a good solution for kernel-build.eclass?
CONFIG_MODULES=n works fine nowadays[1]. Not sure what changed but it seems like the behaviour of the kernel build system is different now because running modules_prepare when CONFIG_MODULES=n silently does nothing instead of causing a 'target does not exist' error. [1] https://gitweb.gentoo.org/repo/gentoo.git/commit/eclass/kernel-build.eclass?id=e19b3318171fe5482417c00e0ff198091080944b