diff --git a/fs/erofs/Config.in b/fs/erofs/Config.in index 91f51b76d7..00f27faeeb 100644 --- a/fs/erofs/Config.in +++ b/fs/erofs/Config.in @@ -22,6 +22,10 @@ choice slower both in compression and decompression, and higher compression levels can have noticeable memory requirements. + Custom compression allows for advanced configuration of the + compression algorithms, and adds the possibility of + finegrained per-file compression using compression hints. + config BR2_TARGET_ROOTFS_EROFS_NONE bool "no compression" @@ -31,6 +35,9 @@ config BR2_TARGET_ROOTFS_EROFS_LZ4HC config BR2_TARGET_ROOTFS_EROFS_LZMA bool "lzma" +config BR2_TARGET_ROOTFS_EROFS_CUSTOM_COMPRESSION + bool "custom" + endchoice if BR2_TARGET_ROOTFS_EROFS_LZ4HC @@ -58,6 +65,35 @@ config BR2_TARGET_ROOTFS_EROFS_LZMA_LEVEL endif # BR2_TARGET_ROOTFS_EROFS_LZMA +if BR2_TARGET_ROOTFS_EROFS_CUSTOM_COMPRESSION + +config BR2_TARGET_ROOTFS_EROFS_COMPRESSION_ALGORITHMS + string "compression algorithms" + default "lz4hc,12" + help + Specify arbitrary compression option, useful in combination + with compression hints. Individual algorithms are separated + by colon with optional level, e.g. "lz4hc,12:lzma". + See erofs-utils documentaion for detailed information. + +config BR2_TARGET_ROOTFS_EROFS_COMPRESSION_HINTS + string "path to compression hints file" + default "" + help + Path to file containing compression hints. Each line in the + file is defined by tokens separated by spaces in the + following form. Optionally, instead of the given primary + algorithm, algorithms can be specified with zero-based + algorithm-index explicitly: + + [algorithm-index] + + match-patterns are extended regular expressions, matched + against absolute paths within the output filesystem, with no + leading /. + +endif # BR2_TARGET_ROOTFS_EROFS_LZMA + config BR2_TARGET_ROOTFS_EROFS_DEDUPE bool "enable data deduplication" depends on !BR2_TARGET_ROOTFS_EROFS_NONE diff --git a/fs/erofs/erofs.mk b/fs/erofs/erofs.mk index 3b64cb1c6e..6543a364f1 100644 --- a/fs/erofs/erofs.mk +++ b/fs/erofs/erofs.mk @@ -10,6 +10,11 @@ ifeq ($(BR2_TARGET_ROOTFS_EROFS_LZ4HC),y) 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) +else ifeq ($(BR2_TARGET_ROOTFS_EROFS_CUSTOM_COMPRESSION),y) +ROOTFS_EROFS_ARGS += -z$(strip $(BR2_TARGET_ROOTFS_EROFS_COMPRESSION_ALGORITHMS)) +ifneq ($(strip $(BR2_TARGET_ROOTFS_EROFS_COMPRESSION_HINTS)),) +ROOTFS_EROFS_ARGS += --compress-hints $(strip $(BR2_TARGET_ROOTFS_EROFS_COMPRESSION_HINTS)) +endif endif ifeq ($(BR2_REPRODUCIBLE),y)