linux内核压缩方式调研

linux内核压缩方式调研

2023年8月3日发(作者:)

linux内核压缩⽅式调研kernel镜像格式(1)vmlinuxvmlinuz是可引导的、可压缩的内核镜像,vm代表Virtual Memory。是由⽤户对内核源码编译得到,实质是elf格式的⽂件,内含符号表,可⽤于调试。(2)ImageImage是经过objcopy处理的只包含⼆进制数据的内核代码,未经过压缩。(3)zImagezImage是ARM linux常⽤的⼀种压缩镜像⽂件,它是由vmlinux加上解压代码经gzip压缩⽽成,命令格式是#make zImage.这种格式的Linux镜像⽂件多存放在NAND上.(4)bzImagebz表⽰big zImage,其格式与zImage类似,但采⽤了不同的压缩算法,都是使⽤了gzip压缩成,bzImage的压缩率更⾼,适⽤于⼤内核。(5)uImageuImage是uboot专⽤的镜像⽂件,它是在zImage之前加上⼀个长度为0x40的头信息(tag),在头信息内说明了该镜像⽂件的类型、加载 位置、⽣成时间、⼤⼩等信息.换句话说,若直接从uImage的0x40位置开始执⾏,则zImage和uImage没有任何区别.命令格式是#makeuImage.这种格式的Linux镜像⽂件多存放在NAND上。u-boot 的tools ⽬录下有mkimage ⼯具,可以⽤来制作uImage,参照。(6)xipImage这种格式的Linux镜像⽂件多存放在NorFlash上,且运⾏时不需要拷贝到内存SDRAM中,可以直接在NorFlash中运⾏.linux 压缩模式 配置选项在init/Kconfig中可以看到有如下关于压缩⽅式的选择,根据以下描述可以简略的知晓各种压缩算法的特点。对于这⼏种算法的详细测试可以参考。choice prompt "Kernel compression mode" default KERNEL_GZIP depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_XZ || HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4 help The linux kernel is a kind of self-extracting executable. Several compression algorithms are available, which differ in efficiency, compression and decompression speed. Compression speed is only relevant when building a kernel. Decompression speed is relevant at each boot. If you have any problems with bzip2 or lzma compressed kernels, mail me (Alain Knaff) . (An older version of this functionality (bzip2 only), for 2.4, was supplied by Christian Ludwig) High compression options are mostly useful for users, who are low on disk space (embedded systems), but for whom ram size matters less. If in doubt, select 'gzip'config KERNEL_GZIP bool "Gzip" depends on HAVE_KERNEL_GZIP help The old and tried gzip compression. It provides a good balance between compression ratio and decompression KERNEL_BZIP2 bool "Bzip2" depends on HAVE_KERNEL_BZIP2 help Its compression ratio and speed is intermediate. Decompression speed is slowest among the choices. The kernel size is about 10% smaller with bzip2, in comparison to gzip. Bzip2 uses a large amount of memory. For modern kernels you will need at least 8MB RAM or more for KERNEL_LZMA bool "LZMA" depends on HAVE_KERNEL_LZMA help This compression algorithm's ratio is best. Decompression speed is between gzip and bzip2. Compression is slowest. The kernel size is about 33% smaller with LZMA in comparison to KERNEL_XZ bool "XZ" depends on HAVE_KERNEL_XZ help XZ uses the LZMA2 algorithm and instruction set specific BCJ filters which can improve compression ratio of executable code. The size of the kernel is about 30% smaller with XZ in comparison to gzip. On architectures for which there is a BCJ filter (i386, x86_64, ARM, IA-64, PowerPC, and SPARC), XZ will create a few percent smaller kernel than plain LZMA. The speed is about the same as with LZMA: The decompression speed of XZ is better than that of bzip2 but worse than gzip and LZO. Compression is KERNEL_LZO bool "LZO" depends on HAVE_KERNEL_LZO help Its compression ratio is the poorest among the choices. The kernel size is about 10% bigger than gzip; however its speed (both compression and decompression) is the KERNEL_LZ4 bool "LZ4" depends on HAVE_KERNEL_LZ4 help LZ4 is an LZ77-type compressor with a fixed, byte-oriented encoding. A preliminary version of LZ4 de/compression tool is available at

. Its compression ratio is worse than LZO. The size of the kernel is about 8% bigger than LZO. But the decompression speed is faster than ice内核压缩和解压缩代码在⽬录kernel/arch/arm/boot/compressed。该⽂档中貌似没有具体压缩算法的实现。更多资料:

发布者:admin,转转请注明出处:http://www.yc00.com/news/1691035784a491900.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信