Re: [PATCH] Compress kernel modules on installation.

From: Jan Engelhardt
Date: Mon Jan 19 2009 - 15:21:51 EST



On Sunday 2009-01-18 22:04, Sam Ravnborg wrote:
>
>Can I ask you to redo this patch.
>I want a way to swith off compression, but it should default be enable.
>So if KBUILD_MODULE_NOCOMPRESS is undefined we will compress the modules
>when we install them.
>
>And add documentation to Documentation/kbuild/kbuild.txt too...

changes to previous:
- added choice for compress (none, -1, -2, ..., -9)
- documentation

parent ad2507ab58aa5a3e50b0482889882ff3adf6ef33 (v2.6.29-rc2-24-gad2507a)
commit 3fc20a79496c3c5c8d4b906ea7e2496de448002d
Author: Jan Engelhardt <jengelh@xxxxxxxxxx>
Date: Mon Jan 19 21:18:39 2009 +0100

kbuild: install modules gzipped

This saves lots of disk space. Yes we had discussions about gzip -6
having a better compression-per-time ratio, but the point is that
people doing the compression in the first place often do not care
about the amount of compression time as long as the final filesize
will be smaller (that's what LZMA does over bzip2, and what bzip2
does over gzip). The KBUILD_MODULES_COMPRESS make variable can be set
over the command line to tune the compression level to your need,
including disabling it entirely.

Signed-off-by: Jan Engelhardt <jengelh@xxxxxxxxxx>
---
Documentation/kbuild/kbuild.txt | 11 +++++++++++
scripts/Makefile.modinst | 6 +++++-
2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 923f9dd..453ba6c 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -125,6 +125,17 @@ KBUILD_EXTRA_SYMBOLS
For modules use symbols from another modules.
See more details in modules.txt.

+KBUILD_MODULES_COMPRESS
+--------------------------------------------------
+By default, kbuild will compress modules with gzip -9 compression to
+reduce disk space. The KBUILD_MODULES_COMPRESS make parameter can be
+used to set an alternate compression level or disable compression
+entirely.
+Example for using the standard gzip compression level:
+ make KBUILD_MODULES_COMPRESS="-6"
+Disabling compression:
+ make KBUILD_MODULES_COMPRESS=""
+
ALLSOURCE_ARCHS
--------------------------------------------------
For tags/TAGS/cscope targets, you can specify more than one archs
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 18b4bf8..e0708b1 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -16,9 +16,13 @@ PHONY += $(modules)
__modinst: $(modules)
@:

+KBUILD_MODULES_COMPRESS ?= -9
quiet_cmd_modules_install = INSTALL $@
cmd_modules_install = mkdir -p $(2); \
- $(mod_strip_cmd) $@ $(2)/$(notdir $@) || cp $@ $(2)
+ $(mod_strip_cmd) $@ $(2)/$(notdir $@) || cp $@ $(2); \
+ $(if ${KBUILD_MODULES_COMPRESS}, \
+ gzip -f ${KBUILD_MODULES_COMPRESS} \
+ $(2)/$(notdir $@), )

# Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
--
# Created with git-export-patch
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/