[PATCH 14/18] backports: add support for module compression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxxxxxxxxxx>

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 <mcgrof@xxxxxxxxxxxxxxxx>
---
 backport/Makefile.real               |    6 +++++-
 backport/scripts/are_mods_compressed |    8 ++++++++
 backport/scripts/mod_path            |    8 ++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100755 backport/scripts/are_mods_compressed
 create mode 100755 backport/scripts/mod_path

diff --git a/backport/Makefile.real b/backport/Makefile.real
index 032a8d7..250676d 100644
--- a/backport/Makefile.real
+++ b/backport/Makefile.real
@@ -88,13 +88,17 @@ install: modules
 		INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG)		\
 		modules_install
 	@./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR)
+	@./scripts/are_mods_compressed || (				\
+        for driver in $$(find $(KLIB)/$(KMODDIR) 			\
+			-type f -name *.ko); do        			\
+			gzip -9 $$driver				;\
+	done )
 	@/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/are_mods_compressed b/backport/scripts/are_mods_compressed
new file mode 100755
index 0000000..989da2f
--- /dev/null
+++ b/backport/scripts/are_mods_compressed
@@ -0,0 +1,8 @@
+#!/bin/bash
+MODULE=$(./scripts/mod_path mac80211)
+MODULE=${MODULE##*/}
+if [ "$MODULE" = "mac80211.ko.gz" ]; then
+	COMPRESSION_FOUND="y"
+	exit 1
+fi
+exit 0
diff --git a/backport/scripts/mod_path b/backport/scripts/mod_path
new file mode 100755
index 0000000..f37321f
--- /dev/null
+++ b/backport/scripts/mod_path
@@ -0,0 +1,8 @@
+#!/bin/bash
+which modinfo > /dev/null 2>&1
+if [[ $? -eq 0 ]]; then
+	MOD_QUERY="modinfo -F filename"
+else
+	MOD_QUERY="modprobe -l"
+fi
+$MOD_QUERY $1 | tail -1
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux