aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2021-07-06 00:04:41 +0200
committerThomas Deutschmann <whissi@gentoo.org>2021-07-06 01:40:51 +0200
commit234ce291bece29b012edcb0482a3b170c86be631 (patch)
tree1739a71c920299395a769f922bb40c4973a17627
parentlinuxrc: Don't mess with console log level in quiet mode (diff)
downloadgenkernel-234ce291.tar.gz
genkernel-234ce291.tar.bz2
genkernel-234ce291.zip
gen_moddeps.sh: modules_kext() refactored
CONFIG_MODULE_COMPRESS is gone in >=5.13. Refactor to check for compression algorithm instead which is backward compatible. Link 1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d4bbe942098b0c9b487d424a3c545c9ed56462d7 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rwxr-xr-xgen_moddeps.sh28
1 files changed, 23 insertions, 5 deletions
diff --git a/gen_moddeps.sh b/gen_moddeps.sh
index 193338d..0842249 100755
--- a/gen_moddeps.sh
+++ b/gen_moddeps.sh
@@ -57,11 +57,29 @@ modules_dep_list() {
modules_kext() {
local KEXT='.ko'
- if grep -sq '^CONFIG_MODULE_COMPRESS=y' "${KERNEL_OUTPUTDIR}"/.config
- then
- grep -sq '^CONFIG_MODULE_COMPRESS_XZ=y' "${KERNEL_OUTPUTDIR}"/.config && KEXT='.ko.xz'
- grep -sq '^CONFIG_MODULE_COMPRESS_GZIP=y' "${KERNEL_OUTPUTDIR}"/.config && KEXT='.ko.gz'
- fi
+ declare -A module_compression_algorithms=()
+ module_compression_algorithms[NONE]='.ko'
+ module_compression_algorithms[GZIP]='.ko.gz'
+ module_compression_algorithms[XZ]='.ko.xz'
+
+ 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}
}