If /proc/config.gz is unavailable, how do I know what decompression algorithms the running kernel is capable of using on a compressed cpio initramfs?

Is the gzip algorithm always available, even when CONFIG_DECOMPRESS_GZIP is not y when building the kernel?


Compression algorithms are declared in lib/decompress.c. Gzip is defined in lib/decompress_inflate.c and doesn't get any special status; it'll only be there if CONFIG_DECOMPRESS_GZIP is y when the kernel is compiled.

The list of available compression algorithms is the compressed_formats structure. Since it's defined as static, it isn't available in other source files. The only function that uses it is thus the decompress_method function in lib/decompress.c itself. So the only way to get a kernel to use the table of supported algorithms is to attempt to decompress something that starts with the appropriate two-byte magic sequence, and see if that function returns the algorithm name.

You can tell which decompression functions are supported by searching the list of kernel symbols (/proc/kallsyms). The functions aren't identified as such, so you'll need to bake in the list of symbol names.

</proc/kallsyms cut -d " " -f 3 |
grep -xF -e gunzip -e bzip2 -e unlzma -e unxz -e unlzo -e unlz4
| improve this answer | |

You can get to know your compression type by going into the directory sys/power/tuxonice/compression there u will a file named algorithm go into it it will have the decompression type in it for me it was written lzo.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.