JFFS2 improvement project

University of Szeged

Home - Mount time - Compression - JFFS3

What does improved JFFS2 compression mean?

It means patches for JFFS2. It contains a rewritten compression framework.

New features:

  • It uses kernel's CryptoAPI, so it will allow not only compressors but also crypto algorithms.
  • Advanced compressor configuration which allows to compress/encode a block with more algorithm sequencially.
  • Backward compatibility for old JFFS2 images.

About advanced compressor configuration

Compressor configuration is a regular expression like string to specify the mode for JFFS2 how to compress blocks:

  • "c": means to use algorithm c
  • "[c1,c2,c3,...]": means to try algotithm c1, c2, c3,... and use the first one which was successful.
  • "{c1,c2,c3,...}": means to try all the algorithm c1, c2, c3, ... and use the one which has the best compression ratio for that block.
  • "x,y,..": means to apply algorithm x, and after apply algorithm y on the result of x, and so on. Here x and y can be not only an algorithm but also a subexpression.

How does it work?

At JFFS2 there is a compr field in the struct jffs2_raw_inode to identify the compression method used in that node. In most cases it is JFFS2_COMPR_ZLIB which means ZLIB.

Using this new method the compression/encoding method is stored not in that compr field (that will be JFFS2_COMPR_ENGINE) but in the begining of the compressed/encoded data. It allows to use not only one algorithm for one block. At decompressing/deconding there will be a loop which will terminated if the begining of the result is 0 and not a valid algorithm name.



Missing but planned features in the very near future:
  • support for crypto algorithm (now it can use only compression algorithms)

How can I use it?

You should use the latest JFFS2 snaphot from MTD CVS. Apply the advanced compression patch on it.

There will be two versions of mkfs.jffs2: an old one and a new one. The old one works as before.

If you whould like to use new mkfs.jffs2 which uses the kernel's CryptoAPI, you should patch your kernel with CryptoDev extension patch, which will provide user space access for the kernel's crypto (and compression) argorithm using the following device file:

    crw-rw-rw- 1 root root 10, 63 Nov 9 15:28 /dev/crypto

Old stuffs

See BBC.