Chinaunix首页 | 论坛 | 博客
  • 博客访问: 385687
  • 博文数量: 115
  • 博客积分: 2501
  • 博客等级: 少校
  • 技术积分: 1009
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-23 17:05
文章分类

全部博文(115)

文章存档

2011年(2)

2010年(86)

2009年(27)

我的朋友

分类: 嵌入式

2010-11-09 22:48:27

    嵌入式系统中,对硬件成本敏感的设备,往往需要对生成的代码进行压缩存储,如xDSL、Router等,尽管生成内核映像时内核代码是经过压缩的,启动内核时会有一段自解压的代码对其解压后运行。另外,可以制作一些具有压缩功能根文件系统,如cramfs、jffs2、squashfs等,这种方式制作的根文件系统是未经压缩时的50%左右。

一种更低压缩代码的方法是使用squashfs+LZMA,这种方法会对压缩过的内核和根文件系统采用LZMA进行二次压缩,大大减小存储到FLASH中体积。一下是关于squashfs+LZMA的官方说明:

 

News

SquashFS version 4.0 is included in Linux Kernel 2.6.29. LZMA support is not there, but since squashfs made its way to the kernel, LZMA compression algorithm will follow it sooner or later. What does it mean for this project (squashfs-lzma.org)? There is no longer any interest in developing separate patches against squashfs 4.0. If you need it, you'll most likely find it in official Kernel 2.6.30 or so. So don't worry, be happy :)

Why Squashfs LZMA?

LZMA is one of the best compression algorithms and Squashfs is one of the best compressed filesystems available nowadays. This project combines both to make something even better. LZMA can compress much better then gzip, which is used in squashfs now. Compressing to LZMA format is very slow, but this is not a problem as the squashfs filesystem needs to be compressed only once. Then it's only read million times; so what we care about is the speed of decompression. LZMA decompression is slower than gzip, but it's even very fast, about 10-20 MB/s on a 2GHz CPU.

Compression benchmarks

method block size Slax data size percent
uncompressed - 668 MB 100%
mksquashfs+gzip 64KB 227 MB 34%
mksquashfs+gzip 1024KB 222 MB 33%
mksquashfs+lzma 64KB 191 MB 28%
mksquashfs+lzma 128KB 184 MB 27%
mksquashfs+lzma 512KB 172 MB 26%
mksquashfs+lzma 1024KB 167 MB 25%

Why the patches?

Squashfs' author can't support LZMA directly in squashfs source code. He would like to have the code included in official Linux Kernel, but Linux Kernel doesn't support LZMA yet, so adding LZMA to squashfs would decrease the chance for its (squashfs's) inclusion. This is the reason we have to maintain LZMA support as a separate patch.

Who are the authors?

  • Author of the initial code is
  • Author of newest updates and modifications is
  • Author of SquashFS is
  • Author of LZMA compression is
  • Author of Slax (the sponsor of this code) is Toms M, see
  • How to build squashfs with LZMA support?

    Download all the sources from this website, using the download links at the right side. Make sure to use a supported Linux Kernel, as only version 2.6.27.6 is officially supported. The info about the compilation is described in file in squashfs-lzma patches, or you can find 'build.sample' script there too. Finally, make sure you have CONFIG_SQUASHFS*=n in your kernel config, because squashfs will be compiled separately as module. You may use with Squashfs-LZMA as a module.
     
     
        由以上可以看出,squashfs+LZMA方式压缩率可低至25%,LZM就是7-Zip所采用的压缩算法。
     
    阅读(2676) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~