[mkinitcpio,1/1] support zstd compression

Message ID 20200814124446.69014-1-list@eworm.de
State New
Headers show
Series [mkinitcpio,1/1] support zstd compression | expand

Commit Message

Christian Hesse Aug. 14, 2020, 12:44 p.m. UTC
From: Christian Hesse <mail@eworm.de>

Linux 5.9 supports zstd compressed initramfs, so add support here.

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 PKGBUILD                  | 1 +
 lsinitcpio                | 4 ++++
 man/mkinitcpio.conf.5.txt | 6 +++---
 mkinitcpio.conf           | 1 +
 4 files changed, 9 insertions(+), 3 deletions(-)

Comments

Emil Velikov via arch-projects Aug. 14, 2020, 12:51 p.m. UTC | #1
On Fri, Aug 14, 2020 at 02:44:46PM +0200, Christian Hesse wrote:
> From: Christian Hesse <mail@eworm.de>
> 
> Linux 5.9 supports zstd compressed initramfs, so add support here.

Just a headsup that there is a pull-request on github with changes to support
this.

https://github.com/archlinux/mkinitcpio/pull/35
Christian Hesse Aug. 14, 2020, 1:09 p.m. UTC | #2
Morten Linderud via arch-projects <arch-projects@archlinux.org> on Fri,
2020/08/14 14:51:
> On Fri, Aug 14, 2020 at 02:44:46PM +0200, Christian Hesse wrote:
> > From: Christian Hesse <mail@eworm.de>
> > 
> > Linux 5.9 supports zstd compressed initramfs, so add support here.  
> 
> Just a headsup that there is a pull-request on github with changes to
> support this.
> 
> https://github.com/archlinux/mkinitcpio/pull/35

Well, that looks pretty incomplete... In fact it just sets the compression
option and skips everything else.

But this explains why I could not find mkinitcpio in gitlab... Will send me
commit there.
Emil Velikov via arch-projects Aug. 14, 2020, 1:22 p.m. UTC | #3
Em agosto 14, 2020 10:09 Christian Hesse escreveu:
> 
> Well, that looks pretty incomplete... In fact it just sets the compression
> option and skips everything else.
>

Just replying here as well, to your comments on the PR. We usually use defaults
on mkinitcpio, so the user is left to choose levels. But, you want to propose a
sane default, I'm all ears (perhaps the same we use on pacman?).

> But this explains why I could not find mkinitcpio in gitlab... Will send me
> commit there.

I have not yet moved it to gitlab, also, it'll be on its own group there.

Regards,
Giancarlo Razzolini

Patch

diff --git a/PKGBUILD b/PKGBUILD
index 3536a48..c7e1ed5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -15,6 +15,7 @@  optdepends=('xz: Use lzma or xz compression for the initramfs image'
             'bzip2: Use bzip2 compression for the initramfs image'
             'lzop: Use lzo compression for the initramfs image'
             'lz4: Use lz4 compression for the initramfs image'
+            'zstd: Use zstd compression for the initramfs image'
             'mkinitcpio-nfs-utils: Support for root filesystem on NFS')
 backup=(etc/mkinitcpio.conf)
 
diff --git a/lsinitcpio b/lsinitcpio
index bcb4a19..4715783 100755
--- a/lsinitcpio
+++ b/lsinitcpio
@@ -113,6 +113,10 @@  detect_filetype() {
             echo 'lz4 -l'
             return
             ;;
+        fd2fb528)
+            echo 'zstd'
+            return
+            ;;
     esac
 
     read -rd '' bytes < <(hexdump -n 3 -e '"%c"' "$1")
diff --git a/man/mkinitcpio.conf.5.txt b/man/mkinitcpio.conf.5.txt
index 9c8d000..9c999d7 100644
--- a/man/mkinitcpio.conf.5.txt
+++ b/man/mkinitcpio.conf.5.txt
@@ -54,9 +54,9 @@  Variables
 
 	Defines a program to filter the generated image through. As of linux 2.6.38,
 	the kernel understands the compression formats yielded by the *gzip*, *bzip2*,
-	*lz4*, *lzop*, *lzma*, and *xz* compressors. If unspecified, this setting
-	defaults to *gzip* compression. In order to create an uncompressed image, define
-	this variable as *cat*.
+	*lz4*, *lzop*, *lzma*, and *xz* compressors. Compression via *zstd* was added
+	in linux 5.9. If unspecified, this setting defaults to *gzip* compression.
+	In order to create an uncompressed image, define this variable as *cat*.
 +
 It's not hard to realize that a filter such as a *tac* or *rev* will cause
 *mkinitcpio* to report success but generate a useless image. Similarly, using a
diff --git a/mkinitcpio.conf b/mkinitcpio.conf
index b926b90..ba1cce3 100644
--- a/mkinitcpio.conf
+++ b/mkinitcpio.conf
@@ -60,6 +60,7 @@  HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
 #COMPRESSION="xz"
 #COMPRESSION="lzop"
 #COMPRESSION="lz4"
+#COMPRESSION="zstd"
 
 # COMPRESSION_OPTIONS
 # Additional options for the compressor