diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2021-07-08 18:31:03 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2021-07-08 18:35:51 +0200 |
commit | ceeff435c0b4dc92c30c26b7f3ec8da3fbbd77c0 (patch) | |
tree | 0d92af3017f83331c0d72b6fa8f7d0e6ec04e733 | |
parent | gen_cmdline.sh: parse_cmdline(): Allow to override AS, AR, NM & Co via CLI (diff) | |
download | genkernel-ceeff435c0b4dc92c30c26b7f3ec8da3fbbd77c0.tar.gz genkernel-ceeff435c0b4dc92c30c26b7f3ec8da3fbbd77c0.tar.bz2 genkernel-ceeff435c0b4dc92c30c26b7f3ec8da3fbbd77c0.zip |
gen_moddeps.sh: Move modules_kext() to determine_KEXT()
We want debug output but then we cannot use return value
from this function.
Transforming function to determine_KEXT() like determine_KV()
will fix the problem and allows us to keep debug output.
Fixes: 234ce29 ("gen_moddeps.sh: modules_kext() refactored")
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rwxr-xr-x | gen_determineargs.sh | 35 | ||||
-rwxr-xr-x | gen_initramfs.sh | 3 | ||||
-rwxr-xr-x | gen_moddeps.sh | 31 |
3 files changed, 37 insertions, 32 deletions
diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 3e6e4ddc..21d3b228 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -1,6 +1,41 @@ #!/bin/bash # $Id$ +determine_KEXT() { + local kconfig_file_used="${KERNEL_CONFIG}" + if isTrue "${BUILD_KERNEL}" + then + kconfig_file_used="${KERNEL_OUTPUTDIR}/.config" + fi + + KEXT='.ko' + + declare -A module_compression_algorithms=() + module_compression_algorithms[NONE]='.ko' + module_compression_algorithms[GZIP]='.ko.gz' + module_compression_algorithms[XZ]='.ko.xz' + module_compression_algorithms[ZSTD]='.ko.zst' + + local module_compression_algorithm + for module_compression_algorithm in "${!module_compression_algorithms[@]}" + do + print_info 5 "Checking if module compression algorithm '${module_compression_algorithm}' is being used ..." + + local koption="CONFIG_MODULE_COMPRESS_${module_compression_algorithm}" + local value_koption=$(kconfig_get_opt "${kconfig_file_used}" "${koption}") + if [[ "${value_koption}" != "y" ]] + then + print_info 5 "Cannot use '${module_compression_algorithm}' algorithm for module compression, kernel option '${koption}' is not set!" + continue + fi + + print_info 5 "Will use '${module_compression_algorithm}' algorithm for kernel module compression!" + KEXT="${module_compression_algorithms[${module_compression_algorithm}]}" + break + done + unset module_compression_algorithms module_compression_algorithm koption value_koption +} + determine_KV() { local old_KV= [ -n "${KV}" ] && old_KV="${KV}" diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 52c5cb8d..b9aeb0be 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -1754,12 +1754,13 @@ append_modules() { gen_die "${error_message}" fi + determine_KEXT + cd "${modules_srcdir}" || gen_die "Failed to chdir to '${modules_srcdir}'!" print_info 2 "$(get_indent 2)modules: >> Copying modules from '${modules_srcdir}' to initramfs ..." local i= mymod= - local -x KEXT="$(modules_kext)" local n_copied_modules=0 for i in $(gen_dep_list) do diff --git a/gen_moddeps.sh b/gen_moddeps.sh index 30e17099..89a562b7 100755 --- a/gen_moddeps.sh +++ b/gen_moddeps.sh @@ -53,37 +53,6 @@ modules_dep_list() { fi } -modules_kext() { - local KEXT='.ko' - - declare -A module_compression_algorithms=() - module_compression_algorithms[NONE]='.ko' - module_compression_algorithms[GZIP]='.ko.gz' - module_compression_algorithms[XZ]='.ko.xz' - module_compression_algorithms[ZSTD]='.ko.zst' - - local module_compression_algorithm - for module_compression_algorithm in "${!module_compression_algorithms[@]}" - do - print_info 5 "Checking if module compression algorithm '${module_compression_algorithm}' is being used ..." - - local koption="CONFIG_MODULE_COMPRESS_${module_compression_algorithm}" - local value_koption=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "${koption}") - if [[ "${value_koption}" != "y" ]] - then - print_info 5 "Cannot use '${module_compression_algorithm}' algorithm for module compression, kernel option '${koption}' is not set!" - continue - fi - - print_info 5 "Will use '${module_compression_algorithm}' algorithm for kernel module compression!" - KEXT="${module_compression_algorithms[${module_compression_algorithm}]}" - break - done - unset module_compression_algorithms module_compression_algorithm koption value_koption - - echo ${KEXT} -} - # Pass module deps list strip_mod_paths() { local x |