[source] kernel: remove ubifs xz decompression support

LEDE Commits lede-commits at lists.infradead.org
Mon Jan 9 05:07:17 PST 2017


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/018d80007e6d9469077d938872e605f826010767

commit 018d80007e6d9469077d938872e605f826010767
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Jan 9 14:00:24 2017 +0100

    kernel: remove ubifs xz decompression support
    
    It has been unused, and less useful than squashfs for cases where flash
    space usage matters.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 target/linux/apm821xx/config-4.4                   |   2 -
 target/linux/at91/config-4.4                       |   1 -
 target/linux/bcm53xx/config-4.4                    |   2 -
 target/linux/generic/config-3.18                   |   1 -
 target/linux/generic/config-4.1                    |   1 -
 target/linux/generic/config-4.4                    |   1 -
 .../540-crypto-xz-decompression-support.patch      | 146 --------
 .../541-ubifs-xz-decompression-support.patch       |  92 -----
 .../540-crypto-xz-decompression-support.patch      | 146 --------
 .../541-ubifs-xz-decompression-support.patch       |  92 -----
 .../540-crypto-xz-decompression-support.patch      | 146 --------
 .../541-ubifs-xz-decompression-support.patch       |  94 -----
 target/linux/imx6/config-4.4                       |   2 -
 target/linux/ipq806x/config-4.4                    |   2 -
 target/linux/kirkwood/config-4.4                   |   1 -
 target/linux/lantiq/xrx200/config-default          |   1 -
 target/linux/lantiq/xway/config-default            |   1 -
 target/linux/layerscape/32b/config-default         |   1 -
 target/linux/mediatek/config-4.4                   |   2 -
 target/linux/mvebu/config-4.4                      |   2 -
 target/linux/omap/config-4.4                       |   2 -
 target/linux/oxnas/config-4.4                      |   2 -
 target/linux/ramips/mt7621/config-4.4              |   1 -
 target/linux/rb532/config-4.4                      |   2 -
 target/linux/xburst/config-3.18                    |   2 -
 tools/Makefile                                     |   2 +-
 .../patches/136-mkfs.ubifs-xz-support.patch        | 378 ---------------------
 .../patches/310-add-static-linking-option.patch    |   8 +-
 28 files changed, 5 insertions(+), 1128 deletions(-)

diff --git a/target/linux/apm821xx/config-4.4 b/target/linux/apm821xx/config-4.4
index 797cdae..68e22ec 100644
--- a/target/linux/apm821xx/config-4.4
+++ b/target/linux/apm821xx/config-4.4
@@ -59,7 +59,6 @@ CONFIG_CRYPTO_MD5_PPC=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_SHA1_PPC=y
 CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DECOMPRESS_GZIP=y
 # CONFIG_DEFAULT_UIMAGE is not set
 CONFIG_DTC=y
@@ -315,7 +314,6 @@ CONFIG_TICK_CPU_ACCOUNTING=y
 # CONFIG_UBIFS_FS is not set
 # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
 # CONFIG_UBIFS_FS_LZO is not set
-# CONFIG_UBIFS_FS_XZ is not set
 # CONFIG_UBIFS_FS_ZLIB is not set
 CONFIG_USB_SUPPORT=y
 CONFIG_VDSO32=y
diff --git a/target/linux/at91/config-4.4 b/target/linux/at91/config-4.4
index 37b98c1..86d3a05 100644
--- a/target/linux/at91/config-4.4
+++ b/target/linux/at91/config-4.4
@@ -257,7 +257,6 @@ CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_LZO=y
-# CONFIG_UBIFS_FS_XZ is not set
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
 CONFIG_USB_SUPPORT=y
diff --git a/target/linux/bcm53xx/config-4.4 b/target/linux/bcm53xx/config-4.4
index e6e6e50..c178271 100644
--- a/target/linux/bcm53xx/config-4.4
+++ b/target/linux/bcm53xx/config-4.4
@@ -104,7 +104,6 @@ CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BCM_5301X=y
 CONFIG_DEBUG_INFO=y
@@ -309,7 +308,6 @@ CONFIG_TREE_RCU=y
 CONFIG_UBIFS_FS=y
 # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
 CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_XZ=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
 CONFIG_USB_SUPPORT=y
diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18
index c61a4b3..3734416 100644
--- a/target/linux/generic/config-3.18
+++ b/target/linux/generic/config-3.18
@@ -790,7 +790,6 @@ CONFIG_CRYPTO_PCRYPT=y
 # CONFIG_CRYPTO_WP512 is not set
 # CONFIG_CRYPTO_XCBC is not set
 # CONFIG_CRYPTO_XTS is not set
-# CONFIG_CRYPTO_XZ is not set
 # CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYSTALHD is not set
 # CONFIG_CS5535_MFGPT is not set
diff --git a/target/linux/generic/config-4.1 b/target/linux/generic/config-4.1
index 4fae342..222ba26 100644
--- a/target/linux/generic/config-4.1
+++ b/target/linux/generic/config-4.1
@@ -822,7 +822,6 @@ CONFIG_CRYPTO_PCRYPT=y
 # CONFIG_CRYPTO_WP512 is not set
 # CONFIG_CRYPTO_XCBC is not set
 # CONFIG_CRYPTO_XTS is not set
-# CONFIG_CRYPTO_XZ is not set
 # CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CRYSTALHD is not set
 # CONFIG_CS5535_MFGPT is not set
diff --git a/target/linux/generic/config-4.4 b/target/linux/generic/config-4.4
index 8ce316b..a654878 100644
--- a/target/linux/generic/config-4.4
+++ b/target/linux/generic/config-4.4
@@ -823,7 +823,6 @@ CONFIG_CRYPTO_PCRYPT=y
 # CONFIG_CRYPTO_WP512 is not set
 # CONFIG_CRYPTO_XCBC is not set
 # CONFIG_CRYPTO_XTS is not set
-# CONFIG_CRYPTO_XZ is not set
 # CONFIG_CRYPTO_ZLIB is not set
 # CONFIG_CS5535_MFGPT is not set
 # CONFIG_CS89x0 is not set
diff --git a/target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch b/target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch
deleted file mode 100644
index 00b0b7c..0000000
--- a/target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch
+++ /dev/null
@@ -1,146 +0,0 @@
---- a/crypto/Kconfig
-+++ b/crypto/Kconfig
-@@ -1437,6 +1437,13 @@ config CRYPTO_LZ4HC
- 	help
- 	  This is the LZ4 high compression mode algorithm.
- 
-+config CRYPTO_XZ
-+	tristate "XZ compression algorithm"
-+	select CRYPTO_ALGAPI
-+	select XZ_DEC
-+	help
-+	  This is the XZ algorithm. Only decompression is supported for now.
-+
- comment "Random Number Generation"
- 
- config CRYPTO_ANSI_CPRNG
---- a/crypto/Makefile
-+++ b/crypto/Makefile
-@@ -89,6 +89,7 @@ obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.
- obj-$(CONFIG_CRYPTO_LZO) += lzo.o
- obj-$(CONFIG_CRYPTO_LZ4) += lz4.o
- obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o
-+obj-$(CONFIG_CRYPTO_XZ) += xz.o
- obj-$(CONFIG_CRYPTO_842) += 842.o
- obj-$(CONFIG_CRYPTO_RNG2) += rng.o
- obj-$(CONFIG_CRYPTO_RNG2) += krng.o
---- /dev/null
-+++ b/crypto/xz.c
-@@ -0,0 +1,117 @@
-+/*
-+ * Cryptographic API.
-+ *
-+ * XZ decompression support.
-+ *
-+ * Copyright (c) 2012 Gabor Juhos <juhosg at openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published by
-+ * the Free Software Foundation.
-+ *
-+ */
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/crypto.h>
-+#include <linux/xz.h>
-+#include <linux/interrupt.h>
-+#include <linux/mm.h>
-+#include <linux/net.h>
-+
-+struct xz_comp_ctx {
-+	struct xz_dec	*decomp_state;
-+	struct xz_buf	decomp_buf;
-+};
-+
-+static int crypto_xz_decomp_init(struct xz_comp_ctx *ctx)
-+{
-+	ctx->decomp_state = xz_dec_init(XZ_SINGLE, 0);
-+	if (!ctx->decomp_state)
-+		return -ENOMEM;
-+
-+	return 0;
-+}
-+
-+static void crypto_xz_decomp_exit(struct xz_comp_ctx *ctx)
-+{
-+	xz_dec_end(ctx->decomp_state);
-+}
-+
-+static int crypto_xz_init(struct crypto_tfm *tfm)
-+{
-+	struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm);
-+
-+	return crypto_xz_decomp_init(ctx);
-+}
-+
-+static void crypto_xz_exit(struct crypto_tfm *tfm)
-+{
-+	struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm);
-+
-+	crypto_xz_decomp_exit(ctx);
-+}
-+
-+static int crypto_xz_compress(struct crypto_tfm *tfm, const u8 *src,
-+			      unsigned int slen, u8 *dst, unsigned int *dlen)
-+{
-+	return -EOPNOTSUPP;
-+}
-+
-+static int crypto_xz_decompress(struct crypto_tfm *tfm, const u8 *src,
-+				unsigned int slen, u8 *dst, unsigned int *dlen)
-+{
-+	struct xz_comp_ctx *dctx = crypto_tfm_ctx(tfm);
-+	struct xz_buf *xz_buf = &dctx->decomp_buf;
-+	int ret;
-+
-+	memset(xz_buf, '\0', sizeof(struct xz_buf));
-+
-+	xz_buf->in = (u8 *) src;
-+	xz_buf->in_pos = 0;
-+	xz_buf->in_size = slen;
-+	xz_buf->out = (u8 *) dst;
-+	xz_buf->out_pos = 0;
-+	xz_buf->out_size = *dlen;
-+
-+	ret = xz_dec_run(dctx->decomp_state, xz_buf);
-+	if (ret != XZ_STREAM_END) {
-+		ret = -EINVAL;
-+		goto out;
-+	}
-+
-+	*dlen = xz_buf->out_pos;
-+	ret = 0;
-+
-+out:
-+	return ret;
-+}
-+
-+static struct crypto_alg crypto_xz_alg = {
-+	.cra_name		= "xz",
-+	.cra_flags		= CRYPTO_ALG_TYPE_COMPRESS,
-+	.cra_ctxsize		= sizeof(struct xz_comp_ctx),
-+	.cra_module		= THIS_MODULE,
-+	.cra_list		= LIST_HEAD_INIT(crypto_xz_alg.cra_list),
-+	.cra_init		= crypto_xz_init,
-+	.cra_exit		= crypto_xz_exit,
-+	.cra_u			= { .compress = {
-+	.coa_compress 		= crypto_xz_compress,
-+	.coa_decompress  	= crypto_xz_decompress } }
-+};
-+
-+static int __init crypto_xz_mod_init(void)
-+{
-+	return crypto_register_alg(&crypto_xz_alg);
-+}
-+
-+static void __exit crypto_xz_mod_exit(void)
-+{
-+	crypto_unregister_alg(&crypto_xz_alg);
-+}
-+
-+module_init(crypto_xz_mod_init);
-+module_exit(crypto_xz_mod_exit);
-+
-+MODULE_LICENSE("GPL v2");
-+MODULE_DESCRIPTION("Crypto XZ decompression support");
-+MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>");
diff --git a/target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch b/target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch
deleted file mode 100644
index f85689c..0000000
--- a/target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch
+++ /dev/null
@@ -1,92 +0,0 @@
---- a/fs/ubifs/Kconfig
-+++ b/fs/ubifs/Kconfig
-@@ -5,8 +5,10 @@ config UBIFS_FS
- 	select CRYPTO if UBIFS_FS_ADVANCED_COMPR
- 	select CRYPTO if UBIFS_FS_LZO
- 	select CRYPTO if UBIFS_FS_ZLIB
-+	select CRYPTO if UBIFS_FS_XZ
- 	select CRYPTO_LZO if UBIFS_FS_LZO
- 	select CRYPTO_DEFLATE if UBIFS_FS_ZLIB
-+	select CRYPTO_XZ if UBIFS_FS_XZ
- 	depends on MTD_UBI
- 	help
- 	  UBIFS is a file system for flash devices which works on top of UBI.
-@@ -35,3 +37,12 @@ config UBIFS_FS_ZLIB
- 	default y
- 	help
- 	  Zlib compresses better than LZO but it is slower. Say 'Y' if unsure.
-+
-+config UBIFS_FS_XZ
-+	bool "XZ decompression support" if UBIFS_FS_ADVANCED_COMPR
-+	depends on UBIFS_FS
-+	default y
-+	help
-+	  XZ compresses better the ZLIB but it is slower..
-+	  Say 'Y' if unsure.
-+
---- a/fs/ubifs/compress.c
-+++ b/fs/ubifs/compress.c
-@@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_comp
- };
- #endif
- 
-+#ifdef CONFIG_UBIFS_FS_XZ
-+static DEFINE_MUTEX(xz_enc_mutex);
-+static DEFINE_MUTEX(xz_dec_mutex);
-+
-+static struct ubifs_compressor xz_compr = {
-+	.compr_type = UBIFS_COMPR_XZ,
-+	.comp_mutex = &xz_enc_mutex,
-+	.decomp_mutex = &xz_dec_mutex,
-+	.name = "xz",
-+	.capi_name = "xz",
-+};
-+#else
-+static struct ubifs_compressor xz_compr = {
-+	.compr_type = UBIFS_COMPR_XZ,
-+	.name = "xz",
-+};
-+#endif
-+
- /* All UBIFS compressors */
- struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
- 
-@@ -232,9 +250,15 @@ int __init ubifs_compressors_init(void)
- 	if (err)
- 		goto out_lzo;
- 
-+	err = compr_init(&xz_compr);
-+	if (err)
-+		goto out_zlib;
-+
- 	ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr;
- 	return 0;
- 
-+out_zlib:
-+	compr_exit(&zlib_compr);
- out_lzo:
- 	compr_exit(&lzo_compr);
- 	return err;
-@@ -247,4 +271,5 @@ void ubifs_compressors_exit(void)
- {
- 	compr_exit(&lzo_compr);
- 	compr_exit(&zlib_compr);
-+	compr_exit(&xz_compr);
- }
---- a/fs/ubifs/ubifs-media.h
-+++ b/fs/ubifs/ubifs-media.h
-@@ -332,12 +332,14 @@ enum {
-  * UBIFS_COMPR_NONE: no compression
-  * UBIFS_COMPR_LZO: LZO compression
-  * UBIFS_COMPR_ZLIB: ZLIB compression
-+ * UBIFS_COMPR_XZ: XZ compression
-  * UBIFS_COMPR_TYPES_CNT: count of supported compression types
-  */
- enum {
- 	UBIFS_COMPR_NONE,
- 	UBIFS_COMPR_LZO,
- 	UBIFS_COMPR_ZLIB,
-+	UBIFS_COMPR_XZ,
- 	UBIFS_COMPR_TYPES_CNT,
- };
- 
diff --git a/target/linux/generic/patches-4.1/540-crypto-xz-decompression-support.patch b/target/linux/generic/patches-4.1/540-crypto-xz-decompression-support.patch
deleted file mode 100644
index c250e9f..0000000
--- a/target/linux/generic/patches-4.1/540-crypto-xz-decompression-support.patch
+++ /dev/null
@@ -1,146 +0,0 @@
---- a/crypto/Kconfig
-+++ b/crypto/Kconfig
-@@ -1435,6 +1435,13 @@ config CRYPTO_LZ4HC
- 	help
- 	  This is the LZ4 high compression mode algorithm.
- 
-+config CRYPTO_XZ
-+	tristate "XZ compression algorithm"
-+	select CRYPTO_ALGAPI
-+	select XZ_DEC
-+	help
-+	  This is the XZ algorithm. Only decompression is supported for now.
-+
- comment "Random Number Generation"
- 
- config CRYPTO_ANSI_CPRNG
---- a/crypto/Makefile
-+++ b/crypto/Makefile
-@@ -89,6 +89,7 @@ obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.
- obj-$(CONFIG_CRYPTO_LZO) += lzo.o
- obj-$(CONFIG_CRYPTO_LZ4) += lz4.o
- obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o
-+obj-$(CONFIG_CRYPTO_XZ) += xz.o
- obj-$(CONFIG_CRYPTO_842) += 842.o
- obj-$(CONFIG_CRYPTO_RNG2) += rng.o
- obj-$(CONFIG_CRYPTO_RNG2) += krng.o
---- /dev/null
-+++ b/crypto/xz.c
-@@ -0,0 +1,117 @@
-+/*
-+ * Cryptographic API.
-+ *
-+ * XZ decompression support.
-+ *
-+ * Copyright (c) 2012 Gabor Juhos <juhosg at openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published by
-+ * the Free Software Foundation.
-+ *
-+ */
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/crypto.h>
-+#include <linux/xz.h>
-+#include <linux/interrupt.h>
-+#include <linux/mm.h>
-+#include <linux/net.h>
-+
-+struct xz_comp_ctx {
-+	struct xz_dec	*decomp_state;
-+	struct xz_buf	decomp_buf;
-+};
-+
-+static int crypto_xz_decomp_init(struct xz_comp_ctx *ctx)
-+{
-+	ctx->decomp_state = xz_dec_init(XZ_SINGLE, 0);
-+	if (!ctx->decomp_state)
-+		return -ENOMEM;
-+
-+	return 0;
-+}
-+
-+static void crypto_xz_decomp_exit(struct xz_comp_ctx *ctx)
-+{
-+	xz_dec_end(ctx->decomp_state);
-+}
-+
-+static int crypto_xz_init(struct crypto_tfm *tfm)
-+{
-+	struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm);
-+
-+	return crypto_xz_decomp_init(ctx);
-+}
-+
-+static void crypto_xz_exit(struct crypto_tfm *tfm)
-+{
-+	struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm);
-+
-+	crypto_xz_decomp_exit(ctx);
-+}
-+
-+static int crypto_xz_compress(struct crypto_tfm *tfm, const u8 *src,
-+			      unsigned int slen, u8 *dst, unsigned int *dlen)
-+{
-+	return -EOPNOTSUPP;
-+}
-+
-+static int crypto_xz_decompress(struct crypto_tfm *tfm, const u8 *src,
-+				unsigned int slen, u8 *dst, unsigned int *dlen)
-+{
-+	struct xz_comp_ctx *dctx = crypto_tfm_ctx(tfm);
-+	struct xz_buf *xz_buf = &dctx->decomp_buf;
-+	int ret;
-+
-+	memset(xz_buf, '\0', sizeof(struct xz_buf));
-+
-+	xz_buf->in = (u8 *) src;
-+	xz_buf->in_pos = 0;
-+	xz_buf->in_size = slen;
-+	xz_buf->out = (u8 *) dst;
-+	xz_buf->out_pos = 0;
-+	xz_buf->out_size = *dlen;
-+
-+	ret = xz_dec_run(dctx->decomp_state, xz_buf);
-+	if (ret != XZ_STREAM_END) {
-+		ret = -EINVAL;
-+		goto out;
-+	}
-+
-+	*dlen = xz_buf->out_pos;
-+	ret = 0;
-+
-+out:
-+	return ret;
-+}
-+
-+static struct crypto_alg crypto_xz_alg = {
-+	.cra_name		= "xz",
-+	.cra_flags		= CRYPTO_ALG_TYPE_COMPRESS,
-+	.cra_ctxsize		= sizeof(struct xz_comp_ctx),
-+	.cra_module		= THIS_MODULE,
-+	.cra_list		= LIST_HEAD_INIT(crypto_xz_alg.cra_list),
-+	.cra_init		= crypto_xz_init,
-+	.cra_exit		= crypto_xz_exit,
-+	.cra_u			= { .compress = {
-+	.coa_compress 		= crypto_xz_compress,
-+	.coa_decompress  	= crypto_xz_decompress } }
-+};
-+
-+static int __init crypto_xz_mod_init(void)
-+{
-+	return crypto_register_alg(&crypto_xz_alg);
-+}
-+
-+static void __exit crypto_xz_mod_exit(void)
-+{
-+	crypto_unregister_alg(&crypto_xz_alg);
-+}
-+
-+module_init(crypto_xz_mod_init);
-+module_exit(crypto_xz_mod_exit);
-+
-+MODULE_LICENSE("GPL v2");
-+MODULE_DESCRIPTION("Crypto XZ decompression support");
-+MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>");
diff --git a/target/linux/generic/patches-4.1/541-ubifs-xz-decompression-support.patch b/target/linux/generic/patches-4.1/541-ubifs-xz-decompression-support.patch
deleted file mode 100644
index f85689c..0000000
--- a/target/linux/generic/patches-4.1/541-ubifs-xz-decompression-support.patch
+++ /dev/null
@@ -1,92 +0,0 @@
---- a/fs/ubifs/Kconfig
-+++ b/fs/ubifs/Kconfig
-@@ -5,8 +5,10 @@ config UBIFS_FS
- 	select CRYPTO if UBIFS_FS_ADVANCED_COMPR
- 	select CRYPTO if UBIFS_FS_LZO
- 	select CRYPTO if UBIFS_FS_ZLIB
-+	select CRYPTO if UBIFS_FS_XZ
- 	select CRYPTO_LZO if UBIFS_FS_LZO
- 	select CRYPTO_DEFLATE if UBIFS_FS_ZLIB
-+	select CRYPTO_XZ if UBIFS_FS_XZ
- 	depends on MTD_UBI
- 	help
- 	  UBIFS is a file system for flash devices which works on top of UBI.
-@@ -35,3 +37,12 @@ config UBIFS_FS_ZLIB
- 	default y
- 	help
- 	  Zlib compresses better than LZO but it is slower. Say 'Y' if unsure.
-+
-+config UBIFS_FS_XZ
-+	bool "XZ decompression support" if UBIFS_FS_ADVANCED_COMPR
-+	depends on UBIFS_FS
-+	default y
-+	help
-+	  XZ compresses better the ZLIB but it is slower..
-+	  Say 'Y' if unsure.
-+
---- a/fs/ubifs/compress.c
-+++ b/fs/ubifs/compress.c
-@@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_comp
- };
- #endif
- 
-+#ifdef CONFIG_UBIFS_FS_XZ
-+static DEFINE_MUTEX(xz_enc_mutex);
-+static DEFINE_MUTEX(xz_dec_mutex);
-+
-+static struct ubifs_compressor xz_compr = {
-+	.compr_type = UBIFS_COMPR_XZ,
-+	.comp_mutex = &xz_enc_mutex,
-+	.decomp_mutex = &xz_dec_mutex,
-+	.name = "xz",
-+	.capi_name = "xz",
-+};
-+#else
-+static struct ubifs_compressor xz_compr = {
-+	.compr_type = UBIFS_COMPR_XZ,
-+	.name = "xz",
-+};
-+#endif
-+
- /* All UBIFS compressors */
- struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
- 
-@@ -232,9 +250,15 @@ int __init ubifs_compressors_init(void)
- 	if (err)
- 		goto out_lzo;
- 
-+	err = compr_init(&xz_compr);
-+	if (err)
-+		goto out_zlib;
-+
- 	ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr;
- 	return 0;
- 
-+out_zlib:
-+	compr_exit(&zlib_compr);
- out_lzo:
- 	compr_exit(&lzo_compr);
- 	return err;
-@@ -247,4 +271,5 @@ void ubifs_compressors_exit(void)
- {
- 	compr_exit(&lzo_compr);
- 	compr_exit(&zlib_compr);
-+	compr_exit(&xz_compr);
- }
---- a/fs/ubifs/ubifs-media.h
-+++ b/fs/ubifs/ubifs-media.h
-@@ -332,12 +332,14 @@ enum {
-  * UBIFS_COMPR_NONE: no compression
-  * UBIFS_COMPR_LZO: LZO compression
-  * UBIFS_COMPR_ZLIB: ZLIB compression
-+ * UBIFS_COMPR_XZ: XZ compression
-  * UBIFS_COMPR_TYPES_CNT: count of supported compression types
-  */
- enum {
- 	UBIFS_COMPR_NONE,
- 	UBIFS_COMPR_LZO,
- 	UBIFS_COMPR_ZLIB,
-+	UBIFS_COMPR_XZ,
- 	UBIFS_COMPR_TYPES_CNT,
- };
- 
diff --git a/target/linux/generic/patches-4.4/540-crypto-xz-decompression-support.patch b/target/linux/generic/patches-4.4/540-crypto-xz-decompression-support.patch
deleted file mode 100644
index 8a3377d..0000000
--- a/target/linux/generic/patches-4.4/540-crypto-xz-decompression-support.patch
+++ /dev/null
@@ -1,146 +0,0 @@
---- a/crypto/Kconfig
-+++ b/crypto/Kconfig
-@@ -1544,6 +1544,13 @@ config CRYPTO_LZ4HC
- 	help
- 	  This is the LZ4 high compression mode algorithm.
- 
-+config CRYPTO_XZ
-+	tristate "XZ compression algorithm"
-+	select CRYPTO_ALGAPI
-+	select XZ_DEC
-+	help
-+	  This is the XZ algorithm. Only decompression is supported for now.
-+
- comment "Random Number Generation"
- 
- config CRYPTO_ANSI_CPRNG
---- a/crypto/Makefile
-+++ b/crypto/Makefile
-@@ -108,6 +108,7 @@ obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.
- obj-$(CONFIG_CRYPTO_LZO) += lzo.o
- obj-$(CONFIG_CRYPTO_LZ4) += lz4.o
- obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o
-+obj-$(CONFIG_CRYPTO_XZ) += xz.o
- obj-$(CONFIG_CRYPTO_842) += 842.o
- obj-$(CONFIG_CRYPTO_RNG2) += rng.o
- obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_cprng.o
---- /dev/null
-+++ b/crypto/xz.c
-@@ -0,0 +1,117 @@
-+/*
-+ * Cryptographic API.
-+ *
-+ * XZ decompression support.
-+ *
-+ * Copyright (c) 2012 Gabor Juhos <juhosg at openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published by
-+ * the Free Software Foundation.
-+ *
-+ */
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/crypto.h>
-+#include <linux/xz.h>
-+#include <linux/interrupt.h>
-+#include <linux/mm.h>
-+#include <linux/net.h>
-+
-+struct xz_comp_ctx {
-+	struct xz_dec	*decomp_state;
-+	struct xz_buf	decomp_buf;
-+};
-+
-+static int crypto_xz_decomp_init(struct xz_comp_ctx *ctx)
-+{
-+	ctx->decomp_state = xz_dec_init(XZ_SINGLE, 0);
-+	if (!ctx->decomp_state)
-+		return -ENOMEM;
-+
-+	return 0;
-+}
-+
-+static void crypto_xz_decomp_exit(struct xz_comp_ctx *ctx)
-+{
-+	xz_dec_end(ctx->decomp_state);
-+}
-+
-+static int crypto_xz_init(struct crypto_tfm *tfm)
-+{
-+	struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm);
-+
-+	return crypto_xz_decomp_init(ctx);
-+}
-+
-+static void crypto_xz_exit(struct crypto_tfm *tfm)
-+{
-+	struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm);
-+
-+	crypto_xz_decomp_exit(ctx);
-+}
-+
-+static int crypto_xz_compress(struct crypto_tfm *tfm, const u8 *src,
-+			      unsigned int slen, u8 *dst, unsigned int *dlen)
-+{
-+	return -EOPNOTSUPP;
-+}
-+
-+static int crypto_xz_decompress(struct crypto_tfm *tfm, const u8 *src,
-+				unsigned int slen, u8 *dst, unsigned int *dlen)
-+{
-+	struct xz_comp_ctx *dctx = crypto_tfm_ctx(tfm);
-+	struct xz_buf *xz_buf = &dctx->decomp_buf;
-+	int ret;
-+
-+	memset(xz_buf, '\0', sizeof(struct xz_buf));
-+
-+	xz_buf->in = (u8 *) src;
-+	xz_buf->in_pos = 0;
-+	xz_buf->in_size = slen;
-+	xz_buf->out = (u8 *) dst;
-+	xz_buf->out_pos = 0;
-+	xz_buf->out_size = *dlen;
-+
-+	ret = xz_dec_run(dctx->decomp_state, xz_buf);
-+	if (ret != XZ_STREAM_END) {
-+		ret = -EINVAL;
-+		goto out;
-+	}
-+
-+	*dlen = xz_buf->out_pos;
-+	ret = 0;
-+
-+out:
-+	return ret;
-+}
-+
-+static struct crypto_alg crypto_xz_alg = {
-+	.cra_name		= "xz",
-+	.cra_flags		= CRYPTO_ALG_TYPE_COMPRESS,
-+	.cra_ctxsize		= sizeof(struct xz_comp_ctx),
-+	.cra_module		= THIS_MODULE,
-+	.cra_list		= LIST_HEAD_INIT(crypto_xz_alg.cra_list),
-+	.cra_init		= crypto_xz_init,
-+	.cra_exit		= crypto_xz_exit,
-+	.cra_u			= { .compress = {
-+	.coa_compress 		= crypto_xz_compress,
-+	.coa_decompress  	= crypto_xz_decompress } }
-+};
-+
-+static int __init crypto_xz_mod_init(void)
-+{
-+	return crypto_register_alg(&crypto_xz_alg);
-+}
-+
-+static void __exit crypto_xz_mod_exit(void)
-+{
-+	crypto_unregister_alg(&crypto_xz_alg);
-+}
-+
-+module_init(crypto_xz_mod_init);
-+module_exit(crypto_xz_mod_exit);
-+
-+MODULE_LICENSE("GPL v2");
-+MODULE_DESCRIPTION("Crypto XZ decompression support");
-+MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>");
diff --git a/target/linux/generic/patches-4.4/541-ubifs-xz-decompression-support.patch b/target/linux/generic/patches-4.4/541-ubifs-xz-decompression-support.patch
deleted file mode 100644
index 277d915..0000000
--- a/target/linux/generic/patches-4.4/541-ubifs-xz-decompression-support.patch
+++ /dev/null
@@ -1,94 +0,0 @@
---- a/fs/ubifs/Kconfig
-+++ b/fs/ubifs/Kconfig
-@@ -5,8 +5,10 @@ config UBIFS_FS
- 	select CRYPTO if UBIFS_FS_ADVANCED_COMPR
- 	select CRYPTO if UBIFS_FS_LZO
- 	select CRYPTO if UBIFS_FS_ZLIB
-+	select CRYPTO if UBIFS_FS_XZ
- 	select CRYPTO_LZO if UBIFS_FS_LZO
- 	select CRYPTO_DEFLATE if UBIFS_FS_ZLIB
-+	select CRYPTO_XZ if UBIFS_FS_XZ
- 	depends on MTD_UBI
- 	help
- 	  UBIFS is a file system for flash devices which works on top of UBI.
-@@ -36,6 +38,14 @@ config UBIFS_FS_ZLIB
- 	help
- 	  Zlib compresses better than LZO but it is slower. Say 'Y' if unsure.
- 
-+config UBIFS_FS_XZ
-+	bool "XZ decompression support" if UBIFS_FS_ADVANCED_COMPR
-+	depends on UBIFS_FS
-+	default y
-+	help
-+	  XZ compresses better the ZLIB but it is slower..
-+	  Say 'Y' if unsure.
-+
- config UBIFS_ATIME_SUPPORT
- 	bool "Access time support" if UBIFS_FS
- 	depends on UBIFS_FS
---- a/fs/ubifs/compress.c
-+++ b/fs/ubifs/compress.c
-@@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_comp
- };
- #endif
- 
-+#ifdef CONFIG_UBIFS_FS_XZ
-+static DEFINE_MUTEX(xz_enc_mutex);
-+static DEFINE_MUTEX(xz_dec_mutex);
-+
-+static struct ubifs_compressor xz_compr = {
-+	.compr_type = UBIFS_COMPR_XZ,
-+	.comp_mutex = &xz_enc_mutex,
-+	.decomp_mutex = &xz_dec_mutex,
-+	.name = "xz",
-+	.capi_name = "xz",
-+};
-+#else
-+static struct ubifs_compressor xz_compr = {
-+	.compr_type = UBIFS_COMPR_XZ,
-+	.name = "xz",
-+};
-+#endif
-+
- /* All UBIFS compressors */
- struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
- 
-@@ -232,9 +250,15 @@ int __init ubifs_compressors_init(void)
- 	if (err)
- 		goto out_lzo;
- 
-+	err = compr_init(&xz_compr);
-+	if (err)
-+		goto out_zlib;
-+
- 	ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr;
- 	return 0;
- 
-+out_zlib:
-+	compr_exit(&zlib_compr);
- out_lzo:
- 	compr_exit(&lzo_compr);
- 	return err;
-@@ -247,4 +271,5 @@ void ubifs_compressors_exit(void)
- {
- 	compr_exit(&lzo_compr);
- 	compr_exit(&zlib_compr);
-+	compr_exit(&xz_compr);
- }
---- a/fs/ubifs/ubifs-media.h
-+++ b/fs/ubifs/ubifs-media.h
-@@ -332,12 +332,14 @@ enum {
-  * UBIFS_COMPR_NONE: no compression
-  * UBIFS_COMPR_LZO: LZO compression
-  * UBIFS_COMPR_ZLIB: ZLIB compression
-+ * UBIFS_COMPR_XZ: XZ compression
-  * UBIFS_COMPR_TYPES_CNT: count of supported compression types
-  */
- enum {
- 	UBIFS_COMPR_NONE,
- 	UBIFS_COMPR_LZO,
- 	UBIFS_COMPR_ZLIB,
-+	UBIFS_COMPR_XZ,
- 	UBIFS_COMPR_TYPES_CNT,
- };
- 
diff --git a/target/linux/imx6/config-4.4 b/target/linux/imx6/config-4.4
index 890ed18..ac8987a 100644
--- a/target/linux/imx6/config-4.4
+++ b/target/linux/imx6/config-4.4
@@ -110,7 +110,6 @@ CONFIG_CRYPTO_SHA256_ARM=y
 # CONFIG_CRYPTO_SHA2_ARM_CE is not set
 CONFIG_CRYPTO_SHA512_ARM=y
 CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_IMX_UART_PORT=1
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
@@ -400,7 +399,6 @@ CONFIG_TREE_RCU=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_XZ=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
 # CONFIG_USB_MXS_PHY is not set
diff --git a/target/linux/ipq806x/config-4.4 b/target/linux/ipq806x/config-4.4
index cdb20eb..69c2198 100644
--- a/target/linux/ipq806x/config-4.4
+++ b/target/linux/ipq806x/config-4.4
@@ -108,7 +108,6 @@ CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_GPIO=y
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
@@ -406,7 +405,6 @@ CONFIG_TREE_RCU=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_LZO=y
-# CONFIG_UBIFS_FS_XZ is not set
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UEVENT_HELPER_PATH=""
 CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
diff --git a/target/linux/kirkwood/config-4.4 b/target/linux/kirkwood/config-4.4
index 3c40844..f5d3164 100644
--- a/target/linux/kirkwood/config-4.4
+++ b/target/linux/kirkwood/config-4.4
@@ -298,7 +298,6 @@ CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_LZO=y
-# CONFIG_UBIFS_FS_XZ is not set
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
 CONFIG_USB=y
diff --git a/target/linux/lantiq/xrx200/config-default b/target/linux/lantiq/xrx200/config-default
index f1351c8..30dff32 100644
--- a/target/linux/lantiq/xrx200/config-default
+++ b/target/linux/lantiq/xrx200/config-default
@@ -41,7 +41,6 @@ CONFIG_SWCONFIG_LEDS=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_LZO=y
-# CONFIG_UBIFS_FS_XZ is not set
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_USB=y
 CONFIG_USB_COMMON=y
diff --git a/target/linux/lantiq/xway/config-default b/target/linux/lantiq/xway/config-default
index ae13f80..bddf027 100644
--- a/target/linux/lantiq/xway/config-default
+++ b/target/linux/lantiq/xway/config-default
@@ -60,7 +60,6 @@ CONFIG_SYS_SUPPORTS_MIPS16=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_LZO=y
-# CONFIG_UBIFS_FS_XZ is not set
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_USB=y
 CONFIG_USB_COMMON=y
diff --git a/target/linux/layerscape/32b/config-default b/target/linux/layerscape/32b/config-default
index f08529a..7aa0dd5 100644
--- a/target/linux/layerscape/32b/config-default
+++ b/target/linux/layerscape/32b/config-default
@@ -63,7 +63,6 @@ CONFIG_CPU_TLB_V7=y
 CONFIG_CPU_V7=y
 CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_LZO=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DEBUG_IMX_UART_PORT=1
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
 # CONFIG_DEBUG_UART_8250 is not set
diff --git a/target/linux/mediatek/config-4.4 b/target/linux/mediatek/config-4.4
index 45fd2dc..2d6140a 100644
--- a/target/linux/mediatek/config-4.4
+++ b/target/linux/mediatek/config-4.4
@@ -102,7 +102,6 @@ CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_GPIO=y
@@ -388,7 +387,6 @@ CONFIG_TIMER_STATS=y
 CONFIG_UBIFS_FS=y
 # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
 CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_XZ=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UEVENT_HELPER_PATH=""
 CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
diff --git a/target/linux/mvebu/config-4.4 b/target/linux/mvebu/config-4.4
index cd6c60c..d819970 100644
--- a/target/linux/mvebu/config-4.4
+++ b/target/linux/mvebu/config-4.4
@@ -126,7 +126,6 @@ CONFIG_CRYPTO_SHA256_ARM=y
 # CONFIG_CRYPTO_SHA2_ARM_CE is not set
 CONFIG_CRYPTO_SHA512_ARM=y
 CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL=y
@@ -406,7 +405,6 @@ CONFIG_TREE_RCU=y
 CONFIG_UBIFS_FS=y
 # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
 CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_XZ=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
 CONFIG_USB=y
diff --git a/target/linux/omap/config-4.4 b/target/linux/omap/config-4.4
index a08e511..f16fa68 100644
--- a/target/linux/omap/config-4.4
+++ b/target/linux/omap/config-4.4
@@ -141,7 +141,6 @@ CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DDR=y
 CONFIG_DEBUG_GPIO=y
@@ -649,7 +648,6 @@ CONFIG_TWL6040_CORE=y
 CONFIG_UBIFS_FS=y
 # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
 CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_XZ=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
 CONFIG_UNINLINE_SPIN_UNLOCK=y
diff --git a/target/linux/oxnas/config-4.4 b/target/linux/oxnas/config-4.4
index 3c3ac00..f1d08a4 100644
--- a/target/linux/oxnas/config-4.4
+++ b/target/linux/oxnas/config-4.4
@@ -89,7 +89,6 @@ CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_ICEDCC=y
 CONFIG_DEBUG_LL=y
@@ -345,7 +344,6 @@ CONFIG_TREE_RCU=y
 CONFIG_UBIFS_FS=y
 # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
 CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_XZ=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h"
 CONFIG_USB=y
diff --git a/target/linux/ramips/mt7621/config-4.4 b/target/linux/ramips/mt7621/config-4.4
index 47b208b..73c3b39 100644
--- a/target/linux/ramips/mt7621/config-4.4
+++ b/target/linux/ramips/mt7621/config-4.4
@@ -256,7 +256,6 @@ CONFIG_TREE_RCU=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_LZO=y
-# CONFIG_UBIFS_FS_XZ is not set
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_USB_SUPPORT=y
 CONFIG_USE_OF=y
diff --git a/target/linux/rb532/config-4.4 b/target/linux/rb532/config-4.4
index 3c6806f..765f01b 100644
--- a/target/linux/rb532/config-4.4
+++ b/target/linux/rb532/config-4.4
@@ -39,7 +39,6 @@ CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_CSRC_R4K=y
 CONFIG_DMA_NONCOHERENT=y
 # CONFIG_ENABLE_WARN_DEPRECATED is not set
@@ -178,7 +177,6 @@ CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_UBIFS_FS=y
 # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
 CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_XZ=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_VIA_RHINE=y
 CONFIG_VIA_RHINE_MMIO=y
diff --git a/target/linux/xburst/config-3.18 b/target/linux/xburst/config-3.18
index fbc2891..71411bf 100644
--- a/target/linux/xburst/config-3.18
+++ b/target/linux/xburst/config-3.18
@@ -40,7 +40,6 @@ CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_HASH=y
 CONFIG_CRYPTO_HASH2=y
 CONFIG_CRYPTO_LZO=y
-CONFIG_CRYPTO_XZ=y
 CONFIG_DMADEVICES=y
 CONFIG_DMA_ENGINE=y
 CONFIG_DMA_JZ4740=y
@@ -316,7 +315,6 @@ CONFIG_TREE_PREEMPT_RCU=y
 CONFIG_UBIFS_FS=y
 CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_XZ=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UNINLINE_SPIN_UNLOCK=y
 CONFIG_USB=y
diff --git a/tools/Makefile b/tools/Makefile
index 82f220d..4300d0e 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -52,7 +52,7 @@ $(curdir)/automake/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(
 $(curdir)/gmp/compile := $(curdir)/libtool/install
 $(curdir)/mpc/compile := $(curdir)/mpfr/install $(curdir)/gmp/install
 $(curdir)/mpfr/compile := $(curdir)/gmp/install
-$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/install $(curdir)/xz/install
+$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/install
 $(curdir)/mkimage/compile := $(curdir)/sed/install
 $(curdir)/mklibs/compile := $(curdir)/libtool/install
 $(curdir)/qemu/compile := $(curdir)/e2fsprogs/install
diff --git a/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch b/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch
deleted file mode 100644
index e8b491b..0000000
--- a/tools/mtd-utils/patches/136-mkfs.ubifs-xz-support.patch
+++ /dev/null
@@ -1,378 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -4,7 +4,7 @@
- VERSION = 1.5.2
- 
- CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS)
--CPPFLAGS += -I./include/linux/lzma
-+CPPFLAGS += $(XZCPPFLAGS) -I./include/linux/lzma
- 
- ifeq ($(WITHOUT_XATTR), 1)
-   CPPFLAGS += -DWITHOUT_XATTR
-@@ -113,8 +113,13 @@ ifeq ($(WITHOUT_LZO), 1)
- else
-   LZOLDLIBS = -llzo2
- endif
-+ifeq ($(WITHOUT_XZ), 1)
-+  CPPFLAGS += -DWITHOUT_XZ
-+else
-+  XZLDLIBS = -llzma
-+endif
- 
--LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid
-+LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) $(XZLDLIBS) -lm -luuid
- $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
- 
- #
---- a/mkfs.ubifs/compr.c
-+++ b/mkfs.ubifs/compr.c
-@@ -126,6 +126,114 @@ static inline int lzo_init(void) { retur
- static inline void lzo_fini(void) { }
- #endif
- 
-+#ifndef WITHOUT_XZ
-+
-+#include <lzma.h>
-+
-+struct xz_ctx {
-+	lzma_filter	filters[3];
-+	lzma_options_lzma opts;
-+};
-+
-+static struct xz_ctx *xz_ctx;
-+
-+#define LZMA_COMPRESSION_LEVEL	9
-+
-+static struct xz_ctx *xz_ctx_init(void)
-+{
-+	struct xz_ctx *ctx;
-+	lzma_options_lzma *opts_lzma;
-+	uint32_t preset;
-+	int ret;
-+
-+	ctx = malloc(sizeof(struct xz_ctx));
-+	if (ctx == NULL)
-+		goto err;
-+
-+	memset(ctx, 0, sizeof(struct xz_ctx));
-+
-+	opts_lzma = &ctx->opts;
-+
-+	preset = LZMA_COMPRESSION_LEVEL | LZMA_PRESET_EXTREME;
-+	ret = lzma_lzma_preset(opts_lzma, preset);
-+	if (ret)
-+		goto err_free_ctx;
-+
-+	/* TODO: allow to specify LZMA options via command line */
-+#if 0
-+	opts_lzma->lc = 3;
-+	opts_lzma->lp = 0;
-+	opts_lzma->pb = 2;
-+	opts_lzma->nice_len = 64;
-+#else
-+	opts_lzma->lc = 0;
-+	opts_lzma->lp = 2;
-+	opts_lzma->pb = 2;
-+	opts_lzma->nice_len = 64;
-+#endif
-+
-+	ctx->filters[0].id = LZMA_FILTER_LZMA2;
-+	ctx->filters[0].options = opts_lzma;
-+	ctx->filters[1].id = LZMA_VLI_UNKNOWN;
-+
-+	return ctx;
-+
-+err_free_ctx:
-+	free(ctx);
-+err:
-+	return NULL;
-+}
-+
-+static void xz_ctx_free(struct xz_ctx *ctx)
-+{
-+	free(ctx);
-+}
-+
-+static int xz_init(void)
-+{
-+	xz_ctx = xz_ctx_init();
-+	if (xz_ctx == NULL)
-+		return -1;
-+
-+	return 0;
-+}
-+
-+static void xz_fini(void)
-+{
-+	xz_ctx_free(xz_ctx);
-+}
-+
-+static int xz_compress(void *in_buf, size_t in_len, void *out_buf,
-+		       size_t *out_len)
-+{
-+	size_t ret_len;
-+	lzma_ret ret_xz;
-+	int ret;
-+
-+	ret = -1;
-+
-+	ret_len = 0;
-+	ret_xz = lzma_stream_buffer_encode(xz_ctx->filters, LZMA_CHECK_CRC32,
-+					   NULL, in_buf, in_len, out_buf,
-+					   &ret_len, *out_len);
-+	if (ret_xz != LZMA_OK) {
-+		fprintf(stderr, "XZ error: %d\n", (int) ret_xz);
-+		goto out;
-+	}
-+
-+	*out_len = ret_len;
-+
-+	ret = 0;
-+out:
-+	return ret;
-+}
-+#else
-+static inline int xz_init(void) { return 0; }
-+static inline void xz_fini(void) { }
-+static inline int xz_compress(void *in_buf, size_t in_len, void *out_buf,
-+			      size_t *out_len) { return -1; }
-+#endif
-+
- static int no_compress(void *in_buf, size_t in_len, void *out_buf,
- 		       size_t *out_len)
- {
-@@ -198,6 +306,9 @@ int compress_data(void *in_buf, size_t i
- 		case MKFS_UBIFS_COMPR_LZO:
- 			ret = lzo_compress(in_buf, in_len, out_buf, out_len);
- 			break;
-+		case MKFS_UBIFS_COMPR_XZ:
-+			ret = xz_compress(in_buf, in_len, out_buf, out_len);
-+			break;
- 		case MKFS_UBIFS_COMPR_ZLIB:
- 			ret = zlib_deflate(in_buf, in_len, out_buf, out_len);
- 			break;
-@@ -225,12 +336,18 @@ int init_compression(void)
- 	if (ret)
- 		goto err;
- 
-+	ret = xz_init();
-+	if (ret)
-+		goto err_lzo;
-+
- 	zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR);
- 	if (!zlib_buf)
--		goto err_lzo;
-+		goto err_xz;
- 
- 	return 0;
- 
-+err_xz:
-+	xz_fini();
- err_lzo:
- 	lzo_fini();
- err:
-@@ -240,6 +357,7 @@ err:
- void destroy_compression(void)
- {
- 	free(zlib_buf);
-+	xz_fini();
- 	lzo_fini();
- 	if (errcnt)
- 		fprintf(stderr, "%llu compression errors occurred\n", errcnt);
---- a/mkfs.ubifs/compr.h
-+++ b/mkfs.ubifs/compr.h
-@@ -36,6 +36,7 @@ enum compression_type
- 	MKFS_UBIFS_COMPR_NONE,
- 	MKFS_UBIFS_COMPR_LZO,
- 	MKFS_UBIFS_COMPR_ZLIB,
-+	MKFS_UBIFS_COMPR_XZ,
- };
- 
- int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len,
---- a/mkfs.ubifs/mkfs.ubifs.c
-+++ b/mkfs.ubifs/mkfs.ubifs.c
-@@ -99,6 +99,9 @@ struct ubifs_info info_;
- static struct ubifs_info *c = &info_;
- static libubi_t ubi;
- 
-+static int force_compr_set;
-+static int force_compr;
-+
- /* Debug levels are: 0 (none), 1 (statistics), 2 (files) ,3 (more details) */
- int debug_level;
- int verbose;
-@@ -133,7 +136,7 @@ static struct inum_mapping **hash_table;
- /* Inode creation sequence number */
- static unsigned long long creat_sqnum;
- 
--static const char *optstring = "d:r:m:o:D:yh?vVe:c:g:f:Fp:k:x:X:j:R:l:j:UQq";
-+static const char *optstring = "d:r:m:o:D:yh?vVe:c:g:f:Fp:k:x:X:z:j:R:l:j:UQq";
- 
- static const struct option longopts[] = {
- 	{"root",               1, NULL, 'r'},
-@@ -151,6 +154,7 @@ static const struct option longopts[] =
- 	{"reserved",           1, NULL, 'R'},
- 	{"compr",              1, NULL, 'x'},
- 	{"favor-percent",      1, NULL, 'X'},
-+	{"force-compr",        1, NULL, 'z'},
- 	{"fanout",             1, NULL, 'f'},
- 	{"space-fixup",        0, NULL, 'F'},
- 	{"keyhash",            1, NULL, 'k'},
-@@ -178,11 +182,13 @@ static const char *helptext =
- "-o, --output=FILE        output to FILE\n"
- "-j, --jrn-size=SIZE      journal size\n"
- "-R, --reserved=SIZE      how much space should be reserved for the super-user\n"
--"-x, --compr=TYPE         compression type - \"lzo\", \"favor_lzo\", \"zlib\" or\n"
--"                         \"none\" (default: \"lzo\")\n"
-+"-x, --compr=TYPE         default compression type - \"lzo\", \"favor_lzo\",\n"
-+"                         \"zlib\" or \"none\" (default: \"lzo\")\n"
- "-X, --favor-percent      may only be used with favor LZO compression and defines\n"
- "                         how many percent better zlib should compress to make\n"
- "                         mkfs.ubifs use zlib instead of LZO (default 20%)\n"
-+"-z, --force-compr=TYPE   force to build the fs with different compression -\n"
-+"                         \"lzo\", \"zlib\" or \"none\"\n"
- "-f, --fanout=NUM         fanout NUM (default: 8)\n"
- "-F, --space-fixup        file-system free space has to be fixed up on first mount\n"
- "                         (requires kernel version 3.0 or greater)\n"
-@@ -472,6 +478,43 @@ static int open_ubi(const char *node)
- 	return 0;
- }
- 
-+static const char *get_compr_str(int compr)
-+{
-+	switch (compr) {
-+	case UBIFS_COMPR_LZO:
-+		return "lzo";
-+	case UBIFS_COMPR_ZLIB:
-+		return "zlib";
-+	case UBIFS_COMPR_XZ:
-+		return "xz";
-+	case UBIFS_COMPR_NONE:
-+		return "none";
-+	}
-+
-+	return "unknown";
-+}
-+
-+static int get_compr_option(char *opt, int *compr_type, int *favor_lzo)
-+{
-+	*compr_type = UBIFS_COMPR_LZO;
-+
-+	if (favor_lzo)
-+		*favor_lzo = 0;
-+
-+	if (favor_lzo && strcmp(optarg, "favor_lzo") == 0)
-+		*favor_lzo = 1;
-+	else if (strcmp(optarg, "zlib") == 0)
-+		*compr_type = UBIFS_COMPR_ZLIB;
-+	else if (strcmp(optarg, "xz") == 0)
-+		*compr_type = UBIFS_COMPR_XZ;
-+	else if (strcmp(optarg, "none") == 0)
-+		*compr_type = UBIFS_COMPR_NONE;
-+	else if (strcmp(optarg, "lzo") != 0)
-+		return -1;
-+
-+	return 0;
-+}
-+
- static int get_options(int argc, char**argv)
- {
- 	int opt, i;
-@@ -594,14 +637,13 @@ static int get_options(int argc, char**a
- 				return err_msg("bad key hash");
- 			break;
- 		case 'x':
--			if (strcmp(optarg, "favor_lzo") == 0)
--				c->favor_lzo = 1;
--			else if (strcmp(optarg, "zlib") == 0)
--				c->default_compr = UBIFS_COMPR_ZLIB;
--			else if (strcmp(optarg, "none") == 0)
--				c->default_compr = UBIFS_COMPR_NONE;
--			else if (strcmp(optarg, "lzo") != 0)
--				return err_msg("bad compressor name");
-+			if (get_compr_option(optarg, &c->default_compr,
-+					     &c->favor_lzo))
-+				return err_msg("bad compressor name '%s'",
-+						optarg);
-+			if (c->default_compr == UBIFS_COMPR_XZ)
-+				return err_msg("'%s' can't be used as default compressor",
-+						optarg);
- 			break;
- 		case 'X':
- 			c->favor_percent = strtol(optarg, &endp, 0);
-@@ -610,6 +652,12 @@ static int get_options(int argc, char**a
- 				return err_msg("bad favor LZO percent '%s'",
- 					       optarg);
- 			break;
-+		case 'z':
-+			if (get_compr_option(optarg, &force_compr, NULL))
-+				return err_msg("bad forced compressor name '%s'",
-+						optarg);
-+			force_compr_set = 1;
-+			break;
- 		case 'j':
- 			c->max_bud_bytes = get_bytes(optarg);
- 			if (c->max_bud_bytes <= 0)
-@@ -684,6 +732,9 @@ static int get_options(int argc, char**a
- 		c->min_io_size = 8;
- 	c->rp_size = add_space_overhead(c->rp_size);
- 
-+	if (force_compr_set == 0)
-+		force_compr = c->default_compr;
-+
- 	if (verbose) {
- 		printf("mkfs.ubifs\n");
- 		printf("\troot:         %s\n", root);
-@@ -693,17 +744,10 @@ static int get_options(int argc, char**a
- 		printf("\toutput:       %s\n", output);
- 		printf("\tjrn_size:     %llu\n", c->max_bud_bytes);
- 		printf("\treserved:     %llu\n", c->rp_size);
--		switch (c->default_compr) {
--		case UBIFS_COMPR_LZO:
--			printf("\tcompr:        lzo\n");
--			break;
--		case UBIFS_COMPR_ZLIB:
--			printf("\tcompr:        zlib\n");
--			break;
--		case UBIFS_COMPR_NONE:
--			printf("\tcompr:        none\n");
--			break;
--		}
-+		printf("\tcompr:        %s\n", get_compr_str(c->default_compr));
-+		if (force_compr_set)
-+			printf("\tforced compr: %s\n",
-+			       get_compr_str(force_compr));
- 		printf("\tkeyhash:      %s\n", (c->key_hash == key_r5_hash) ?
- 						"r5" : "test");
- 		printf("\tfanout:       %d\n", c->fanout);
-@@ -1284,7 +1328,7 @@ static int add_file(const char *path_nam
- 			use_compr = UBIFS_COMPR_LZO;
- 		else
- #endif
--			use_compr = c->default_compr;
-+			use_compr = force_compr;
- 		compr_type = compress_data(buf, bytes_read, &dn->data,
- 					   &out_len, use_compr);
- 		dn->compr_type = cpu_to_le16(compr_type);
---- a/mkfs.ubifs/mkfs.ubifs.h
-+++ b/mkfs.ubifs/mkfs.ubifs.h
-@@ -83,6 +83,9 @@
- #if MKFS_UBIFS_COMPR_ZLIB != UBIFS_COMPR_ZLIB
- #error MKFS_UBIFS_COMPR_ZLIB != UBIFS_COMPR_ZLIB
- #endif
-+#if MKFS_UBIFS_COMPR_XZ != UBIFS_COMPR_XZ
-+#error MKFS_UBIFS_COMPR_XZ != UBIFS_COMPR_XZ
-+#endif
- 
- extern int verbose;
- extern int debug_level;
---- a/include/mtd/ubifs-media.h
-+++ b/include/mtd/ubifs-media.h
-@@ -313,6 +313,7 @@ enum {
- 	UBIFS_COMPR_NONE,
- 	UBIFS_COMPR_LZO,
- 	UBIFS_COMPR_ZLIB,
-+	UBIFS_COMPR_XZ,
- 	UBIFS_COMPR_TYPES_CNT,
- };
- 
diff --git a/tools/mtd-utils/patches/310-add-static-linking-option.patch b/tools/mtd-utils/patches/310-add-static-linking-option.patch
index 810aea9..828d775 100644
--- a/tools/mtd-utils/patches/310-add-static-linking-option.patch
+++ b/tools/mtd-utils/patches/310-add-static-linking-option.patch
@@ -32,12 +32,12 @@
  
  $(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v))))
  
-@@ -119,7 +119,7 @@ else
-   XZLDLIBS = -llzma
+@@ -114,7 +114,7 @@ else
+   LZOLDLIBS = -llzo2
  endif
  
--LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) $(XZLDLIBS) -lm -luuid
-+LDLIBS_mkfs.ubifs = $(call static_link,-lz $(LZOLDLIBS) $(XZLDLIBS)) -lm $(call static_link,-luuid)
+-LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid
++LDLIBS_mkfs.ubifs = $(call static_link,-lz $(LZOLDLIBS)) -lm $(call static_link,-luuid)
  $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
  
  #



More information about the lede-commits mailing list