1 |
commit: ceeff435c0b4dc92c30c26b7f3ec8da3fbbd77c0 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jul 8 16:31:03 2021 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jul 8 16:35:51 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=ceeff435 |
7 |
|
8 |
gen_moddeps.sh: Move modules_kext() to determine_KEXT() |
9 |
|
10 |
We want debug output but then we cannot use return value |
11 |
from this function. |
12 |
|
13 |
Transforming function to determine_KEXT() like determine_KV() |
14 |
will fix the problem and allows us to keep debug output. |
15 |
|
16 |
Fixes: 234ce29 ("gen_moddeps.sh: modules_kext() refactored") |
17 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
18 |
|
19 |
gen_determineargs.sh | 35 +++++++++++++++++++++++++++++++++++ |
20 |
gen_initramfs.sh | 3 ++- |
21 |
gen_moddeps.sh | 31 ------------------------------- |
22 |
3 files changed, 37 insertions(+), 32 deletions(-) |
23 |
|
24 |
diff --git a/gen_determineargs.sh b/gen_determineargs.sh |
25 |
index 3e6e4dd..21d3b22 100755 |
26 |
--- a/gen_determineargs.sh |
27 |
+++ b/gen_determineargs.sh |
28 |
@@ -1,6 +1,41 @@ |
29 |
#!/bin/bash |
30 |
# $Id$ |
31 |
|
32 |
+determine_KEXT() { |
33 |
+ local kconfig_file_used="${KERNEL_CONFIG}" |
34 |
+ if isTrue "${BUILD_KERNEL}" |
35 |
+ then |
36 |
+ kconfig_file_used="${KERNEL_OUTPUTDIR}/.config" |
37 |
+ fi |
38 |
+ |
39 |
+ KEXT='.ko' |
40 |
+ |
41 |
+ declare -A module_compression_algorithms=() |
42 |
+ module_compression_algorithms[NONE]='.ko' |
43 |
+ module_compression_algorithms[GZIP]='.ko.gz' |
44 |
+ module_compression_algorithms[XZ]='.ko.xz' |
45 |
+ module_compression_algorithms[ZSTD]='.ko.zst' |
46 |
+ |
47 |
+ local module_compression_algorithm |
48 |
+ for module_compression_algorithm in "${!module_compression_algorithms[@]}" |
49 |
+ do |
50 |
+ print_info 5 "Checking if module compression algorithm '${module_compression_algorithm}' is being used ..." |
51 |
+ |
52 |
+ local koption="CONFIG_MODULE_COMPRESS_${module_compression_algorithm}" |
53 |
+ local value_koption=$(kconfig_get_opt "${kconfig_file_used}" "${koption}") |
54 |
+ if [[ "${value_koption}" != "y" ]] |
55 |
+ then |
56 |
+ print_info 5 "Cannot use '${module_compression_algorithm}' algorithm for module compression, kernel option '${koption}' is not set!" |
57 |
+ continue |
58 |
+ fi |
59 |
+ |
60 |
+ print_info 5 "Will use '${module_compression_algorithm}' algorithm for kernel module compression!" |
61 |
+ KEXT="${module_compression_algorithms[${module_compression_algorithm}]}" |
62 |
+ break |
63 |
+ done |
64 |
+ unset module_compression_algorithms module_compression_algorithm koption value_koption |
65 |
+} |
66 |
+ |
67 |
determine_KV() { |
68 |
local old_KV= |
69 |
[ -n "${KV}" ] && old_KV="${KV}" |
70 |
|
71 |
diff --git a/gen_initramfs.sh b/gen_initramfs.sh |
72 |
index 52c5cb8..b9aeb0b 100755 |
73 |
--- a/gen_initramfs.sh |
74 |
+++ b/gen_initramfs.sh |
75 |
@@ -1754,12 +1754,13 @@ append_modules() { |
76 |
gen_die "${error_message}" |
77 |
fi |
78 |
|
79 |
+ determine_KEXT |
80 |
+ |
81 |
cd "${modules_srcdir}" || gen_die "Failed to chdir to '${modules_srcdir}'!" |
82 |
|
83 |
print_info 2 "$(get_indent 2)modules: >> Copying modules from '${modules_srcdir}' to initramfs ..." |
84 |
|
85 |
local i= mymod= |
86 |
- local -x KEXT="$(modules_kext)" |
87 |
local n_copied_modules=0 |
88 |
for i in $(gen_dep_list) |
89 |
do |
90 |
|
91 |
diff --git a/gen_moddeps.sh b/gen_moddeps.sh |
92 |
index 30e1709..89a562b 100755 |
93 |
--- a/gen_moddeps.sh |
94 |
+++ b/gen_moddeps.sh |
95 |
@@ -53,37 +53,6 @@ modules_dep_list() { |
96 |
fi |
97 |
} |
98 |
|
99 |
-modules_kext() { |
100 |
- local KEXT='.ko' |
101 |
- |
102 |
- declare -A module_compression_algorithms=() |
103 |
- module_compression_algorithms[NONE]='.ko' |
104 |
- module_compression_algorithms[GZIP]='.ko.gz' |
105 |
- module_compression_algorithms[XZ]='.ko.xz' |
106 |
- module_compression_algorithms[ZSTD]='.ko.zst' |
107 |
- |
108 |
- local module_compression_algorithm |
109 |
- for module_compression_algorithm in "${!module_compression_algorithms[@]}" |
110 |
- do |
111 |
- print_info 5 "Checking if module compression algorithm '${module_compression_algorithm}' is being used ..." |
112 |
- |
113 |
- local koption="CONFIG_MODULE_COMPRESS_${module_compression_algorithm}" |
114 |
- local value_koption=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "${koption}") |
115 |
- if [[ "${value_koption}" != "y" ]] |
116 |
- then |
117 |
- print_info 5 "Cannot use '${module_compression_algorithm}' algorithm for module compression, kernel option '${koption}' is not set!" |
118 |
- continue |
119 |
- fi |
120 |
- |
121 |
- print_info 5 "Will use '${module_compression_algorithm}' algorithm for kernel module compression!" |
122 |
- KEXT="${module_compression_algorithms[${module_compression_algorithm}]}" |
123 |
- break |
124 |
- done |
125 |
- unset module_compression_algorithms module_compression_algorithm koption value_koption |
126 |
- |
127 |
- echo ${KEXT} |
128 |
-} |
129 |
- |
130 |
# Pass module deps list |
131 |
strip_mod_paths() { |
132 |
local x |