Skip to contentSkip to conversation

fs/cpio: add zstd as compression option

PATCH Superseded José Luis Salvador Rufo 3 participants 4 messages Jan 10, 2021 – Jan 16, 2021 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/cpio: add zstd as compression option

U-Boot mkimage zstd is available since v2020.10:
https://gitlab.denx.de/u-boot/u-boot/-/commit/26073f9ed3ab0aaf3c2a2b433fecb30a95a067d6

---
 fs/cpio/Config.in | 5 +++++
 1 file changed, 5 insertions(+)
fs/cpio/Config.in +5 -0
index 83a7fa5824..c1151a2881 100644
@@ -51,6 +51,11 @@ config BR2_TARGET_ROOTFS_CPIO_XZ
 	help
 	  Do compress the cpio filesystem with xz.
 
+config BR2_TARGET_ROOTFS_CPIO_ZSTD
+	bool "zstd"
+	help
+	  Do compress the cpio filesystem with zstd.
+
 endchoice
 
 config BR2_TARGET_ROOTFS_CPIO_UIMAGE
Signature · 1 line
2.30.0
#1 lore raw

PATCH 1/1 fs/cpio: add zstd as compression option

Jos?, all,

On 2021-01-10 05:38 +0100, Jos? Luis Salvador Rufo spake thusly:

Quoted 13 lines

U-Boot mkimage zstd is available since v2020.10:
https://gitlab.denx.de/u-boot/u-boot/-/commit/26073f9ed3ab0aaf3c2a2b433fecb30a95a067d6

---
 fs/cpio/Config.in | 5 +++++
 1 file changed, 5 insertions(+)
fs/cpio/Config.in +0 -0
index 83a7fa5824..c1151a2881 100644

fs/cpio/Config.in config BR2_TARGET_ROOTFS_CPIO_XZ · line 57

Quoted 7 lines
fs/cpio/Config.in +4 -0
@@ -51,6 +51,11 @@ config BR2_TARGET_ROOTFS_CPIO_XZ
 	help
 	  Do compress the cpio filesystem with xz.
 
+config BR2_TARGET_ROOTFS_CPIO_ZSTD
+	bool "zstd"
+	help
+	  Do compress the cpio filesystem with zstd.

How is that expected to work? We do not have zstd support in the fs
infra: https://git.buildroot.org/buildroot/tree/fs/common.mk#n126

Regards,
Yann E. MORIN.

Quoted 10 lines
fs/cpio/Config.in +0 -0
 endchoice
 
 config BR2_TARGET_ROOTFS_CPIO_UIMAGE
Signature · 6 lines
2.30.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v2 1/1 fs/cpio: add zstd as compression option

U-Boot mkimage zstd is available since v2020.10:
https://gitlab.denx.de/u-boot/u-boot/-/commit/26073f9ed3ab0aaf3c2a2b433fecb30a95a067d6

---
 fs/common.mk      | 5 +++++
 fs/cpio/Config.in | 5 +++++
 2 files changed, 10 insertions(+)
fs/common.mk +5 -0
index 84e13d1b7e..da008ef9e8 100644
@@ -154,6 +154,11 @@ ifeq ($(BR2_REPRODUCIBLE),)
 ROOTFS_$(2)_COMPRESS_CMD += -T $(PARALLEL_JOBS)
 endif
 endif
+ifeq ($(BR2_TARGET_ROOTFS_$(2)_ZSTD),y)
+ROOTFS_$(2)_DEPENDENCIES += host-zstd
+ROOTFS_$(2)_COMPRESS_EXT = .zst
+ROOTFS_$(2)_COMPRESS_CMD = zstd --ultra -22 -z -f -T$(PARALLEL_JOBS)
+endif
 
 $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): ROOTFS=$(2)
 $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): FAKEROOT_SCRIPT=$$(ROOTFS_$(2)_DIR)/fakeroot
fs/cpio/Config.in +5 -0
index 83a7fa5824..c1151a2881 100644
@@ -51,6 +51,11 @@ config BR2_TARGET_ROOTFS_CPIO_XZ
 	help
 	  Do compress the cpio filesystem with xz.
 
+config BR2_TARGET_ROOTFS_CPIO_ZSTD
+	bool "zstd"
+	help
+	  Do compress the cpio filesystem with zstd.
+
 endchoice
 
 config BR2_TARGET_ROOTFS_CPIO_UIMAGE
Signature · 1 line
2.30.0
#3 lore raw

PATCH v2 1/1 fs/cpio: add zstd as compression option

Hello,

Quoted 4 lines · On Sun, 10 Jan 2021 20:05:59 +0100 Jos? Luis Salvador Rufo…

U-Boot mkimage zstd is available since v2020.10:
https://gitlab.denx.de/u-boot/u-boot/-/commit/26073f9ed3ab0aaf3c2a2b433fecb30a95a067d6

Thanks, I have applied, with one change, see below.

Quoted 10 lines
---
 fs/common.mk      | 5 +++++
 fs/cpio/Config.in | 5 +++++
 2 files changed, 10 insertions(+)
fs/common.mk +0 -0
index 84e13d1b7e..da008ef9e8 100644

fs/common.mk ifeq ($(BR2_REPRODUCIBLE),) · line 160

Quoted 7 lines
fs/common.mk +4 -0
@@ -154,6 +154,11 @@ ifeq ($(BR2_REPRODUCIBLE),)
 ROOTFS_$(2)_COMPRESS_CMD += -T $(PARALLEL_JOBS)
 endif
 endif
+ifeq ($(BR2_TARGET_ROOTFS_$(2)_ZSTD),y)
+ROOTFS_$(2)_DEPENDENCIES += host-zstd
+ROOTFS_$(2)_COMPRESS_EXT = .zst
+ROOTFS_$(2)_COMPRESS_CMD = zstd --ultra -22 -z -f -T$(PARALLEL_JOBS)

To me, it felt a bit extreme to use the --ultra -22 level, which is documented as requiring a lot of memory, both for compression and uncompression. So I changed to just -19 instead.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com