[projects/geninitrd] add support for lz4 compressor

atler atler at pld-linux.org
Wed Dec 30 19:44:31 CET 2020


commit f05c6bdb9dbb965abce51bc7275787621320f19a
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed Dec 30 19:42:52 2020 +0100

    add support for lz4 compressor

 geninitrd | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index b5d6cbe..444addb 100755
--- a/geninitrd
+++ b/geninitrd
@@ -47,7 +47,7 @@ proc_partitions=no
 usage() {
 	echo "Usage: $PROGRAM [--version] [-v] [-f] [--ifneeded] [--preload <module>]"
 	echo "       [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]"
-	echo "       [--compress=yes|zstd|xz|lzma|bzip2|gzip|lzo]"
+	echo "       [--compress=yes|zstd|xz|lzma|bzip2|gzip|lzo|lz4]"
 	echo "       [--nostrip ] [--strip PATH/strip] [--strip=PATH/strip]"
 	echo "       [--initrdfs=rom|initramfs|ext2|cram] [--modules-conf=<modules.conf>]"
 	echo "       [--with-bootsplash] [--without-bootsplash]"
@@ -1102,7 +1102,7 @@ sym_exists() {
 # find best compressor (or forced one) for initrd
 find_compressor() {
 	local mode="$1"
-	local compressors='zstd xz lzma bzip2 gzip lzo'
+	local compressors='zstd xz lzma bzip2 gzip lzo lz4'
 
 	# a specified one, take it
 	if ! is_yes "$mode"; then
@@ -1138,6 +1138,10 @@ find_compressor() {
 			sym=unzstd
 			prog=/usr/bin/zstd
 			;;
+		lz4)
+			sym=unlz4
+			prog=/usr/bin/lz4
+			;;
 		none|no)
 			# any existing sym will work
 			sym=initrd_load
@@ -1183,6 +1187,9 @@ compress_image() {
 	zstd)
 		zstd -9 < "$IMAGE" > "$tmp" || return $?
 		;;
+	lz4)
+		lz4 -9 -l < "$IMAGE" > "$tmp" || return $?
+		;;
 	none|no)
 		cat < "$IMAGE" > "$tmp" || return $?
 		;;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/geninitrd.git/commitdiff/f05c6bdb9dbb965abce51bc7275787621320f19a



More information about the pld-cvs-commit mailing list