commit:     9cca61dcffd3969ce31898541a50bafedc4dd6d9
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  7 20:06:19 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Jan  7 20:09:54 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=9cca61dc

gen_compile.sh: compile_modules(): Add parameter "copy_kernel"

When building kernel with integrated initramfs we don't want to
copy kernel to its final location before we integrated initramfs or
otherwise, the second call to compile_modules() would preserve
previous incomplete image.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_compile.sh | 19 +++++++++++++++++++
 genkernel      |  9 +++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/gen_compile.sh b/gen_compile.sh
index 9c6b6f0..4942a0c 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -254,7 +254,20 @@ compile_modules() {
        fi
 }
 
+# @FUNCTION: compile_kernel
+# @USAGE: <copy_kernel>
+# @DESCRIPTION:
+# Will compile and optionally copy compiled kernel and System.map
+# to its final location.
+#
+# <copy_kernel> Boolean which indicates if kernel and System.map should
+#               get copied to its final location
 compile_kernel() {
+       [[ ${#} -ne 1 ]] \
+               && gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid 
usage of ${FUNCNAME}(): Function takes exactly one argument (${#} given)!"
+
+       local copy_kernel="${1}"
+
        [ -z "${KERNEL_MAKE}" ] \
                && gen_die "KERNEL_MAKE undefined - I don't know how to compile 
a kernel for this arch!"
 
@@ -295,6 +308,12 @@ compile_kernel() {
                print_info 1 "$(get_indent 1)>> Skipping installation of 
bundled firmware due to --no-firmware-install ..."
        fi
 
+       if ! isTrue "${copy_kernel}"
+       then
+               print_info 5 "Not copying compiled kernel yet (${FUNCNAME} 
called with copy_kernel=no) ..."
+               return
+       fi
+
        local tmp_kernel_binary=$(find_kernel_binary 
${KERNEL_BINARY_OVERRIDE:-${KERNEL_BINARY}})
        local tmp_kernel_binary2=$(find_kernel_binary ${KERNEL_BINARY_2})
        if [ -z "${tmp_kernel_binary}" ]

diff --git a/genkernel b/genkernel
index 8435350..127844a 100755
--- a/genkernel
+++ b/genkernel
@@ -250,7 +250,12 @@ then
                print_info 2 "$(get_indent 1)>> Kernel version has not changed 
since genkernel start"
        fi
 
-       compile_kernel
+       if isTrue "${INTEGRATED_INITRAMFS}"
+       then
+               compile_kernel no
+       else
+               compile_kernel yes
+       fi
 
        # Compile modules
        if isTrue "${BUILD_MODULES}" && ! isTrue "${BUILD_STATIC}"
@@ -372,7 +377,7 @@ then
        unset cfg_CONFIG_INITRAMFS_SOURCE
 
        # We build the kernel a second time to include the initramfs
-       compile_kernel
+       compile_kernel yes
 fi
 
 if [ -n "${KERNCACHE}" ]

Reply via email to