Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: /
Date: Tue, 06 Jul 2021 00:25:20
Message-Id: 1625528451.234ce291bece29b012edcb0482a3b170c86be631.whissi@gentoo
1 commit: 234ce291bece29b012edcb0482a3b170c86be631
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 5 22:04:41 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 5 23:40:51 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=234ce291
7
8 gen_moddeps.sh: modules_kext() refactored
9
10 CONFIG_MODULE_COMPRESS is gone in >=5.13. Refactor to check
11 for compression algorithm instead which is backward compatible.
12
13 Link 1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d4bbe942098b0c9b487d424a3c545c9ed56462d7
14 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
15
16 gen_moddeps.sh | 28 +++++++++++++++++++++++-----
17 1 file changed, 23 insertions(+), 5 deletions(-)
18
19 diff --git a/gen_moddeps.sh b/gen_moddeps.sh
20 index 193338d..0842249 100755
21 --- a/gen_moddeps.sh
22 +++ b/gen_moddeps.sh
23 @@ -57,11 +57,29 @@ modules_dep_list() {
24 modules_kext() {
25 local KEXT='.ko'
26
27 - if grep -sq '^CONFIG_MODULE_COMPRESS=y' "${KERNEL_OUTPUTDIR}"/.config
28 - then
29 - grep -sq '^CONFIG_MODULE_COMPRESS_XZ=y' "${KERNEL_OUTPUTDIR}"/.config && KEXT='.ko.xz'
30 - grep -sq '^CONFIG_MODULE_COMPRESS_GZIP=y' "${KERNEL_OUTPUTDIR}"/.config && KEXT='.ko.gz'
31 - fi
32 + declare -A module_compression_algorithms=()
33 + module_compression_algorithms[NONE]='.ko'
34 + module_compression_algorithms[GZIP]='.ko.gz'
35 + module_compression_algorithms[XZ]='.ko.xz'
36 +
37 + local module_compression_algorithm
38 + for module_compression_algorithm in "${!module_compression_algorithms[@]}"
39 + do
40 + print_info 5 "Checking if module compression algorithm '${module_compression_algorithm}' is being used ..."
41 +
42 + local koption="CONFIG_MODULE_COMPRESS_${module_compression_algorithm}"
43 + local value_koption=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "${koption}")
44 + if [[ "${value_koption}" != "y" ]]
45 + then
46 + print_info 5 "Cannot use '${module_compression_algorithm}' algorithm for module compression, kernel option '${koption}' is not set!"
47 + continue
48 + fi
49 +
50 + print_info 5 "Will use '${module_compression_algorithm}' algorithm for kernel module compression!"
51 + KEXT="${module_compression_algorithms[${module_compression_algorithm}]}"
52 + break
53 + done
54 + unset module_compression_algorithms module_compression_algorithm koption value_koption
55
56 echo ${KEXT}
57 }