# MODULE_COMPRESS_XZ=y [solved]

## josephg

if i set compression algorithm for modules to xz (MODULE_COMPRESS_XZ=y), boot is not successful as it seems that kernel won't load modules. i have tried this multiple times now. i only get a full clean successful boot, if modules compression algorithm is gzip (MODULE_COMPRESS_GZIP=y). what am i missing?

```
[*] Enable loadable module support  --->

    [*] Compress modules on installation

          Compression algorithm (XZ)  --->

            (X) XZ
```

```
*  sys-kernel/gentoo-sources

      Latest version available: 4.9.16

      Latest version installed: 4.9.16

      Size of files: 91,402 KiB

      Homepage:      https://dev.gentoo.org/~mpagano/genpatches

      Description:   Full sources including the Gentoo patchset for the 4.9 kernel tree

      License:       GPL-2 freedist
```

----------

## josephg

i don't know if this is related. i also have

```
CONFIG_HAVE_KERNEL_XZ=y

CONFIG_KERNEL_XZ=y
```

i build kernel like so

```
# make

# make modules_install

# make install
```

i expect my kernel to be compressed xz. but imagine my surprise when i find this

```
$ file /boot/vmlinuz-4.9.16-gentoo-josephg

/boot/vmlinuz-4.9.16-gentoo-josephg: Linux kernel x86 boot executable bzImage, version 4.9.16-gentoo-josephg (root@localhost) #71 SMP Sat Jun 3 09:57:10 BST 2017, RO-rootFS, swap_dev 0x2, Normal VGA
```

Last edited by josephg on Sun Jun 04, 2017 11:23 pm; edited 4 times in total

----------

## Jaglover

The name bzImage does not mean it is compressed with bzip2. 

Your module tools must support compression mode chosen, kmod for instance has lzma USE flag.

----------

## josephg

 *Jaglover wrote:*   

> The name bzImage does not mean it is compressed with bzip2.

 

oh  :Embarassed:  that's what i assumed. how would i identify what compression it is?

 *Jaglover wrote:*   

> Your module tools must support compression mode chosen, kmod for instance has lzma USE flag.

 

aha.. this must be it! lzma == xz?  :Shocked:  but i'd never have guessed

```
$ equery u kmod

[ Legend : U - final flag setting for installation]

[        : I - package is installed with flag     ]

[ Colors : set, unset                             ]

 * Found these USE flags for sys-apps/kmod-23:

 U I

 - - debug                    : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces

 - - doc                      : Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally

 - - lzma                     : Enable support for XZ compressed modules

 - - python                   : Add optional support/bindings for the Python language

 + + python_targets_python2_7 : Build with Python 2.7

 + + python_targets_python3_4 : Build with Python 3.4

 - - static-libs              : Build static versions of dynamic libraries as well

 + + tools                    : Install module loading/unloading tools.

 + + zlib                     : Enable support for gzipped modules
```

Last edited by josephg on Sun Jun 04, 2017 11:13 pm; edited 1 time in total

----------

## josephg

and houston we have liftoff  :Smile:  thank you Jaglover

```
sys-apps/kmod lzma
```

i now have a kernel with MODULE_COMPRESS_XZ=y booting successfullyLast edited by josephg on Sun Jun 04, 2017 11:18 pm; edited 1 time in total

----------

## Leio

You don't need to worry about the compression type of bzImage here, it'll know how to decompress itself.

bzImage stands for "big zImage", indeed not related to bzip2.

"xz is a lossless data compression program and file format which incorporates the LZMA/LZMA2 compression algorithms.", so lzma is suitable as a generic USE flag name here. The difference from what you are thinking under lzma (lzma-utils) are with the file format mostly.

If you REALLY want to know what compression format it is in, you could see what scripts/extract-vmlinux (in your kernel sources) does with trying to extra the decompressed vmlinux out of a bzImage given to it, perhaps even just modify it to have a 

```
echo "Trying $3" >&2
```

 before check_vmlinux call inside try_decompress() and it was in the format you last saw most likely, unless "Cannot find vmlinux" is also printed. Maybe there are some tools to extract just the compressed version out of bzImage too, whose output you could run "file" on.

----------

## josephg

that seems a tad complicated to find out what my kernel is compressed as.

i couldn't associate lzma with xz, as they are separately mentioned in the kernel config.

CONFIG_HAVE_KERNEL_XZ

CONFIG_HAVE_KERNEL_LZMA

CONFIG_RD_XZ

CONFIG_RD_LZMA

----------

