Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robbat2/27b7db92d13139cb493c877f70fa0f71 to your computer and use it in GitHub Desktop.
Save robbat2/27b7db92d13139cb493c877f70fa0f71 to your computer and use it in GitHub Desktop.
From 9f8846066dd18b19dc08d7d605be899fd7e79782 Mon Sep 17 00:00:00 2001
From: "Robin H. Johnson" <robbat2@gentoo.org>
Date: Mon, 5 Jul 2021 14:34:14 -0700
Subject: [PATCH] gen_moddeps: better module detection
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
gen_moddeps.sh | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/gen_moddeps.sh b/gen_moddeps.sh
index 193338d..929eb8f 100755
--- a/gen_moddeps.sh
+++ b/gen_moddeps.sh
@@ -57,10 +57,28 @@ modules_dep_list() {
modules_kext() {
local KEXT='.ko'
- if grep -sq '^CONFIG_MODULE_COMPRESS=y' "${KERNEL_OUTPUTDIR}"/.config
+ # v5.12-rc3-29-gd4bbe942098b / d4bbe942098b0c9b487d424a3c545c9ed56462d7
+ # changed the way that module compression is selected.
+ # Before:
+ # CONFIG_MODULE_COMPRESS=y && CONFIG_MODULE_COMPRESS_GZ=y => .ko.gz
+ # CONFIG_MODULE_COMPRESS=y && CONFIG_MODULE_COMPRESS_XZ=y => .ko.xz
+ # CONFIG_MODULE_COMPRESS unset => .ko
+ # absent => => .ko
+ #
+ # After (zstd was also added):
+ # CONFIG_MODULE_COMPRESS_GZ=y => .ko.gz
+ # CONFIG_MODULE_COMPRESS_NONE=y => .ko
+ # CONFIG_MODULE_COMPRESS_XZ=y => .ko.xz
+ # CONFIG_MODULE_COMPRESS_ZSTD=y => .ko.zst
+ # (absent) => .ko
+
+ if egrep -sq '^CONFIG_MODULE_COMPRESS.*=' "${KERNEL_OUTPUTDIR}"/.config
then
- grep -sq '^CONFIG_MODULE_COMPRESS_XZ=y' "${KERNEL_OUTPUTDIR}"/.config && KEXT='.ko.xz'
+ # These are supposed to be mutually exclusive, but if that
+ # changes in future, we might have breakage.
grep -sq '^CONFIG_MODULE_COMPRESS_GZIP=y' "${KERNEL_OUTPUTDIR}"/.config && KEXT='.ko.gz'
+ grep -sq '^CONFIG_MODULE_COMPRESS_XZ=y' "${KERNEL_OUTPUTDIR}"/.config && KEXT='.ko.xz'
+ grep -sq '^CONFIG_MODULE_COMPRESS_ZSTD=y' "${KERNEL_OUTPUTDIR}"/.config && KEXT='.ko.zst'
fi
echo ${KEXT}
--
2.32.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment