From e27ccf500565720f45d997a6453a0b1d8996c887 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Wed, 10 Apr 2013 04:35:24 -0700 Subject: [PATCH] backports: add support for module compression Some Linux distributions like to compress their modules. Add support to detect this in a modutils / modprobe agnostic way. Signed-off-by: Luis R. Rodriguez [refactor to just a single script] Signed-off-by: Johannes Berg --- backport/Makefile.real | 2 +- backport/scripts/compress_modules.sh | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 backport/scripts/compress_modules.sh diff --git a/backport/Makefile.real b/backport/Makefile.real index 032a8d755539..d79aafc13f32 100644 --- a/backport/Makefile.real +++ b/backport/Makefile.real @@ -88,13 +88,13 @@ install: modules INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG) \ modules_install @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) + @./scripts/compress_modules.sh $(KLIB)/$(KMODDIR) @/sbin/depmod -ae @echo @echo Your backported driver modules should be installed now. @echo Try loading them with modprobe. @echo # FIXME: -# compress modules # check depmod # install/load/unload/... scripts? # compat firmware class udev stuff diff --git a/backport/scripts/compress_modules.sh b/backport/scripts/compress_modules.sh new file mode 100755 index 000000000000..31cd1d46dad1 --- /dev/null +++ b/backport/scripts/compress_modules.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +function mod_filename() +{ + which modinfo > /dev/null 2>&1 + if [[ $? -eq 0 ]]; then + MOD_QUERY="modinfo -F filename" + else + MOD_QUERY="modprobe -l" + fi + mod_path="$($MOD_QUERY $1 | tail -1)" + echo $(basename "$mod_path") +} + +test "$(mod_filename mac80211)" = "mac80211.ko.gz" && + for driver in $(find "$1" -type f -name *.ko); do + gzip -9 $driver + done -- 2.30.2