[SOLVED] Need some help to use LZ4 algoritm to compress and decompress a kernel
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Need some help to use LZ4 algoritm to compress and decompress a kernel
Hello All,
Now I am using the LZO algorithm to compress and decompress a Vmlinux kernel. Now I have a plan to use LZ4.
I have done the all following changes available in internet to add lz4 feature, Because Im using 3.8 kernel version and this LZ4 feature available from 3.12 only,
After compiling the rpm I have checked the .config which is present in inside /root/build/kernel.x.x/linux.x.x folder,
All the changes are reflected in .config file except CONFIG_LZ4_COMPRESS and CONFIG_LZ4_DECOMPRESS. Still it shows CONFIG_LZO_COMPRESS=y and CONFIG_LZO_DECOMPRESS=y. I just want to understand even though I am giving compression and decompression parameter with LZ4 bt still .config using LZO.
After installing the kernel on the target, I have checked /proc/kallsyms and the output looks for decompressing a VMlinux using LZO only.
Any comments or suggestions are highly appreciated.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
if the version of your kernel doesnt support a feature, it doesn't matter what you put in the config it will just get ignored/overitten/kicked out etc, setting an option in the config file wont suddenly make the code understand new features.
We can enable the LZ4 algorithm to compress and decompress a vmlinux by applying a few patches and some config changes. And Finally I able to use LZ4 for compress and decompress a vmlinux.
After added the lz4 seems the boot time is improved. I found one command to get the decompress details from the system.
cat /proc/kallsyms |grep lz4
c114bc34 t _lzo1x_1_do_compress
c114bf73 T lzo1x_1_compress
c114c030 T lzo1x_decompress_safe
c114c538 T lz4_decompress_unknownoutputsize
c114c6fb T lz4_decompress
c1209f98 t regcache_lzo_sync
c120a03c t regcache_lzo_exit
c120a09c t regcache_lzo_decompress_cache_block.clone.4
c120a0f9 t regcache_lzo_read
c120a19b t regcache_lzo_compress_cache_block.clone.5
c120a201 t regcache_lzo_write
c120a313 t regcache_lzo_init
c14fb2d9 T unlz4
Now I'm seeing both LZO and LZ4 from output. How to debug which algorithm will be used for decompress a static kernel.
Open the .config file. Set ALL compression algorithms to "is not set", for example:
Code:
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
Save changes. Now execute:
Code:
make oldconfig
The configuration script will now start with asking you what compression method you want to use (as the default one).
.
This is the .config file content related compression algorithm by default,
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
CONFIG_KERNEL_LZ4=y
So I already modified and compiling a kernel with this changes.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
If you are going to patch the kernel anyway why not just use an upto date one that has the options you want? Seems a bit like re-inventing the wheel to me, or is there some specific reason to use the older kernel.
Also, I would candidly suggest that a change to the (de-)compression algorithm would change boot-time, "at best, only slightly." The things that slow down system initialization usually occur well after the resident-kernel itself has been decompressed and loaded into memory.
We can enable the LZ4 algorithm to compress and decompress a vmlinux by applying a few patches and some config changes. And Finally I able to use LZ4 for compress and decompress a vmlinux.
After added the lz4 seems the boot time is improved. I found one command to get the decompress details from the system.
cat /proc/kallsyms |grep lz4
c114bc34 t _lzo1x_1_do_compress
c114bf73 T lzo1x_1_compress
c114c030 T lzo1x_decompress_safe
c114c538 T lz4_decompress_unknownoutputsize
c114c6fb T lz4_decompress
c1209f98 t regcache_lzo_sync
c120a03c t regcache_lzo_exit
c120a09c t regcache_lzo_decompress_cache_block.clone.4
c120a0f9 t regcache_lzo_read
c120a19b t regcache_lzo_compress_cache_block.clone.5
c120a201 t regcache_lzo_write
c120a313 t regcache_lzo_init
c14fb2d9 T unlz4
Now I'm seeing both LZO and LZ4 from output. How to debug which algorithm will be used for decompress a static kernel.
Thanks in Advance,
Jegathesan
Hi jegadezz,
Please provide the kernel configuration and patches to enable lz4 in linux kernel.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.