commit:     610671453f2a29a453facb500c1e7185ae32ec89
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 23 08:57:28 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Mar 23 09:18:25 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=61067145

We cannot set new KERNEL_OUTPUTDIR when "make" has already been executed in 
KERNEL_DIR

This would cause build failures. [Link 1]

Link 1: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Makefile?h=v5.0#n1067
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_compile.sh | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gen_compile.sh b/gen_compile.sh
index 14d059d..5c402c8 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -280,7 +280,24 @@ compile_generic() {
        esac
 
        case "${argstype}" in
-               kernel|kernelruntask) ARGS="`compile_kernel_args`" ;;
+               kernel|kernelruntask)
+                       ARGS="`compile_kernel_args`"
+                       if [[ "${ARGS}" = *O=* ]]
+                       then
+                               if [ -f "${KERNEL_DIR}/.config" -o -d 
"${KERNEL_DIR}/include/config" ]
+                               then
+                                       # Kernel's build system doesn't remove 
all files
+                                       # even when "make clean" was called 
which will cause
+                                       # build failures when KERNEL_OUTPUTDIR 
will change.
+                                       #
+                                       # See 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Makefile?h=v5.0#n1067
 for details
+                                       error_message="'${KERNEL_DIR}' is 
tainted and cannot be used"
+                                       error_message+=" to compile a kernel 
with different KERNEL_OUTPUTDIR set."
+                                       error_message+=" Please re-install a 
fresh kernel source!"
+                                       gen_die "${error_message}"
+                               fi
+                       fi
+                       ;;
                utils) ARGS="`compile_utils_args`" ;;
                *) ARGS="" ;;
        esac

Reply via email to