1 |
commit: 9cca61dcffd3969ce31898541a50bafedc4dd6d9 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jan 7 20:06:19 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 7 20:09:54 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=9cca61dc |
7 |
|
8 |
gen_compile.sh: compile_modules(): Add parameter "copy_kernel" |
9 |
|
10 |
When building kernel with integrated initramfs we don't want to |
11 |
copy kernel to its final location before we integrated initramfs or |
12 |
otherwise, the second call to compile_modules() would preserve |
13 |
previous incomplete image. |
14 |
|
15 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
16 |
|
17 |
gen_compile.sh | 19 +++++++++++++++++++ |
18 |
genkernel | 9 +++++++-- |
19 |
2 files changed, 26 insertions(+), 2 deletions(-) |
20 |
|
21 |
diff --git a/gen_compile.sh b/gen_compile.sh |
22 |
index 9c6b6f0..4942a0c 100755 |
23 |
--- a/gen_compile.sh |
24 |
+++ b/gen_compile.sh |
25 |
@@ -254,7 +254,20 @@ compile_modules() { |
26 |
fi |
27 |
} |
28 |
|
29 |
+# @FUNCTION: compile_kernel |
30 |
+# @USAGE: <copy_kernel> |
31 |
+# @DESCRIPTION: |
32 |
+# Will compile and optionally copy compiled kernel and System.map |
33 |
+# to its final location. |
34 |
+# |
35 |
+# <copy_kernel> Boolean which indicates if kernel and System.map should |
36 |
+# get copied to its final location |
37 |
compile_kernel() { |
38 |
+ [[ ${#} -ne 1 ]] \ |
39 |
+ && gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid usage of ${FUNCNAME}(): Function takes exactly one argument (${#} given)!" |
40 |
+ |
41 |
+ local copy_kernel="${1}" |
42 |
+ |
43 |
[ -z "${KERNEL_MAKE}" ] \ |
44 |
&& gen_die "KERNEL_MAKE undefined - I don't know how to compile a kernel for this arch!" |
45 |
|
46 |
@@ -295,6 +308,12 @@ compile_kernel() { |
47 |
print_info 1 "$(get_indent 1)>> Skipping installation of bundled firmware due to --no-firmware-install ..." |
48 |
fi |
49 |
|
50 |
+ if ! isTrue "${copy_kernel}" |
51 |
+ then |
52 |
+ print_info 5 "Not copying compiled kernel yet (${FUNCNAME} called with copy_kernel=no) ..." |
53 |
+ return |
54 |
+ fi |
55 |
+ |
56 |
local tmp_kernel_binary=$(find_kernel_binary ${KERNEL_BINARY_OVERRIDE:-${KERNEL_BINARY}}) |
57 |
local tmp_kernel_binary2=$(find_kernel_binary ${KERNEL_BINARY_2}) |
58 |
if [ -z "${tmp_kernel_binary}" ] |
59 |
|
60 |
diff --git a/genkernel b/genkernel |
61 |
index 8435350..127844a 100755 |
62 |
--- a/genkernel |
63 |
+++ b/genkernel |
64 |
@@ -250,7 +250,12 @@ then |
65 |
print_info 2 "$(get_indent 1)>> Kernel version has not changed since genkernel start" |
66 |
fi |
67 |
|
68 |
- compile_kernel |
69 |
+ if isTrue "${INTEGRATED_INITRAMFS}" |
70 |
+ then |
71 |
+ compile_kernel no |
72 |
+ else |
73 |
+ compile_kernel yes |
74 |
+ fi |
75 |
|
76 |
# Compile modules |
77 |
if isTrue "${BUILD_MODULES}" && ! isTrue "${BUILD_STATIC}" |
78 |
@@ -372,7 +377,7 @@ then |
79 |
unset cfg_CONFIG_INITRAMFS_SOURCE |
80 |
|
81 |
# We build the kernel a second time to include the initramfs |
82 |
- compile_kernel |
83 |
+ compile_kernel yes |
84 |
fi |
85 |
|
86 |
if [ -n "${KERNCACHE}" ] |