From: Douglas Mayne on
On Fri, 30 Apr 2010 14:27:39 +0000, Douglas Mayne wrote:

> I see that recent kernels have the ability to handle various compression
> methods. For example, I assume that these kernel options allow the
> kernel to decompress modules using various compression methods:
>
> CONFIG_DECOMPRESS_GZIP=y
> CONFIG_DECOMPRESS_BZIP2=y
> CONFIG_DECOMPRESS_LZMA=y
>
> I have used gz to compress kernel modules to save some space, especially
> in initrd situations. I would like to switch to use lzma because there
> is some savings over gzipped modules (say 25M vs. 32M). The problem I am
> having is with depmod. What should the extension be for kernel modules
> compressed with xz (using lzma compression) to be able to be recognized
> by depmod.
>
> Here is a sample line from a working modules.dep file:
> /lib/modules/2.6.30.10-smp-dm1/kernel/fs/xfs/xfs.ko.gz:
> /lib/modules/2.6.30.10-smp-dm1/kernel/fs/exportfs/exportfs.ko.gz
>
> It seems pretty obvious to tack on another extension indicating the type
> of compression, but so far - no joy. Just curious -- if anyone knows.
>
> TIA
>
Just to followup on what I've found so far. It appears that the modules
themselves may only be compressed with gzip (gz extension). To double
check, I updated the tools to as included in this package,
kmodule-init-tools-3.11.1-i486-1.txz,
from Slackware -current. That did not make any difference. I see hints of
possible future support for what I want in the kernel mailing list -more
info below.

First, I want to clarify one thing. The /* entire */ initrd may be
compressed with various compression methods; typically, gz, bz2, lzma.
One trick to get this working under slackware using lzma compression if
created using the xz utility is to specify lzma format directly. That is,
when
creating/compressing the initrd try something like this:

INITRD=/boot/initrd-tree
(cd $INITRD && find . | cpio -o -H newc | xz -F lzma) >initrd.lz

You must use the "F" switch to specify the lzma format, because xz's
default compression method is not the method that the kernel is looking
for.

Using xz produces an initrd which is compressed using the optimized
algorithm. This does something close to what I want. However, I would
still prefer that the individual modules could to be compressed using
alternate compression methods, especially xz. But, as I noted in my
original post the potential savings are small and benefits mostly a class
of hardware that is rapidly becoming obsolete. This optimization doesn't
offer much benefit to systems with multigigs of RAM.

--
Douglas Mayne