소스 검색

fs/erofs: add LZMA compression, allow configurable compression level

Instead of having a bool option for enabling the LZ4HC compression, change the
Kconfig definition to a choice, which also adds more flexibility in the future
(e.g. for enabling ZSTD compression). The name of the old option was preserved
so defconfigs using it won't be affected.

Also both for LZMA and LZ4HC, it's now possible to define compression level.
Previously it defaulted to 9, which generates images larger than squashfs with
comparable settings (which uses level 12 by default). For LZ4HC the default if
unset would be still 9.

Use a separate config option for LZMA and LZ4HC compression level,
because their ranges and meaning are different.

Signed-off-by: Jan Čermák <sairon@sairon.cz>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
Jan Čermák 5 달 전
부모
커밋
01b45ef87d
2개의 변경된 파일52개의 추가작업 그리고 3개의 파일을 삭제
  1. 49 2
      fs/erofs/Config.in
  2. 3 1
      fs/erofs/erofs.mk

+ 49 - 2
fs/erofs/Config.in

@@ -6,10 +6,57 @@ config BR2_TARGET_ROOTFS_EROFS
 
 if BR2_TARGET_ROOTFS_EROFS
 
+choice
+	prompt "Compression algorithm"
+	default BR2_TARGET_ROOTFS_EROFS_LZ4HC
+	help
+	  Select the EROFS compression algorithm to use.
+
+	  LZ4HC (LZ4 High Compression) is the default algorithm and
+	  provides a good balance between compression ratio and speed,
+	  with increasing levels the compression ratio increases at the
+	  penalty of higher compression times, without significant
+	  decompression penalty.
+
+	  LZMA provides the best compression ratio but is significantly
+	  slower both in compression and decompression, and higher
+	  compression levels can have noticeable memory requirements.
+
+config BR2_TARGET_ROOTFS_EROFS_NONE
+	bool "no compression"
+
 config BR2_TARGET_ROOTFS_EROFS_LZ4HC
-	bool "lz4hc compression"
+	bool "lz4hc"
+
+config BR2_TARGET_ROOTFS_EROFS_LZMA
+	bool "lzma"
+
+endchoice
+
+if BR2_TARGET_ROOTFS_EROFS_LZ4HC
+
+config BR2_TARGET_ROOTFS_EROFS_LZ4HC_LEVEL
+	int "lz4hc compression level"
+	default 9
+	range 1 12
 	help
-	  Use lz4 high-compression to compress data in the filesystem.
+	  Specify the compression level for LZ4HC compression.
+
+endif # BR2_TARGET_ROOTFS_EROFS_LZ4HC
+
+if BR2_TARGET_ROOTFS_EROFS_LZMA
+
+config BR2_TARGET_ROOTFS_EROFS_LZMA_LEVEL
+	int "lzma compression level"
+	default 6
+	range 0 109
+	help
+	  Specify the compression level for LZMA compression.
+
+	  Values from 0 to 9 are used for the standard compression,
+	  values from 100 to 109 are used for the extreme compression.
+
+endif # BR2_TARGET_ROOTFS_EROFS_LZMA
 
 config BR2_TARGET_ROOTFS_EROFS_PCLUSTERSIZE
 	int "pcluster size"

+ 3 - 1
fs/erofs/erofs.mk

@@ -7,7 +7,9 @@
 ROOTFS_EROFS_DEPENDENCIES = host-erofs-utils
 
 ifeq ($(BR2_TARGET_ROOTFS_EROFS_LZ4HC),y)
-ROOTFS_EROFS_ARGS += -zlz4hc
+ROOTFS_EROFS_ARGS += -zlz4hc,$(BR2_TARGET_ROOTFS_EROFS_LZ4HC_LEVEL)
+else ifeq ($(BR2_TARGET_ROOTFS_EROFS_LZMA),y)
+ROOTFS_EROFS_ARGS += -zlzma,$(BR2_TARGET_ROOTFS_EROFS_LZMA_LEVEL)
 endif
 
 ifeq ($(BR2_REPRODUCIBLE),y)