summarylogtreecommitdiffstats
path: root/0001-mkinitcpio-Add-support-for-the-zstd-compressor.patch
blob: 19de08856f66f473fde6871f32153bb11abaf301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
From 852917d99cda518917343bb9546a1867775379c6 Mon Sep 17 00:00:00 2001
From: Luca Stefani <luca.stefani.ge1@gmail.com>
Date: Sun, 26 Jul 2020 12:33:33 +0200
Subject: [PATCH] mkinitcpio: Add support for the zstd compressor

---
 PKGBUILD                  | 1 +
 lsinitcpio                | 4 ++++
 man/mkinitcpio.conf.5.txt | 6 ++++--
 mkinitcpio                | 3 +++
 mkinitcpio.conf           | 1 +
 5 files changed, 13 insertions(+), 2 deletions(-)

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..fe4d077 100644
--- a/man/mkinitcpio.conf.5.txt
+++ b/man/mkinitcpio.conf.5.txt
@@ -54,8 +54,10 @@ 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
+	*lz4*, *lzop*, *lzma*, and *xz* compressors. As of linux 5.9 the kernel also
+	understands the compression formats yielded by the *zstd* compressor.
+	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
diff --git a/mkinitcpio b/mkinitcpio
index ba27433..a9706d0 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -211,6 +211,9 @@ build_image() {
         lz4)
             COMPRESSION_OPTIONS+=('-l')
             ;;
+        zstd)
+            COMPRESSION_OPTIONS+=('-19')
+            ;;
     esac
 
     pushd "$BUILDROOT" >/dev/null
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