On Wed, 01 Apr 2020 09:05:22 +0200 Norbert Lange <nolang...@gmail.com> wrote:
> Package: initramfs-tools-core
> Version: 0.136
> Severity: wishlist
> Tags: patch
> 
> Hello,
> 
> there are Kernelpatches for zstandard initramfs support
> available for several years, and will hopefully accepted
> upstream soon.

If the kernel doesn't yet support it, I'm not sure what the point of
supporting it in initramfs-tools is.

> Please enable support for this compression.
> 
> The patch should be simple enough, I chosen to try zstd
> as first decompressor because it supports a whole
> range of formats on debian.

> diff -burN initramfs-tools.org/conf/initramfs.conf 
> initramfs-tools/conf/initramfs.conf
> --- initramfs-tools.org/conf/initramfs.conf   2019-02-06 00:55:47.000000000 
> +0100
> +++ initramfs-tools/conf/initramfs.conf       2020-03-31 18:38:48.558687968 
> +0200
> @@ -38,7 +38,7 @@
>  KEYMAP=n
> 
>  #
> -# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz ]
> +# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | zstd | xz ]

Aside from gzip (the default), this list is sorted alphabetically.  So
zstd belongs at the end.

>  #
> 
>  COMPRESS=gzip
> diff -burN initramfs-tools.org/mkinitramfs initramfs-tools/mkinitramfs
> --- initramfs-tools.org/mkinitramfs   2020-01-18 19:36:00.000000000 +0100
> +++ initramfs-tools/mkinitramfs       2020-03-31 18:31:31.046107765 +0200
> @@ -185,6 +185,7 @@
>       fi
>       ;;
>  lz4) compress="lz4 -9 -l" ;;
> +zstd)        compress="zstd -19" ;;
>  xz)  compress="xz --check=crc32"
>       # If we're not doing a reproducible build, enable multithreading
>       test -z "${SOURCE_DATE_EPOCH}" && compress="$compress --threads=0"
> diff -burN initramfs-tools.org/unmkinitramfs initramfs-tools/unmkinitramfs
> --- initramfs-tools.org/unmkinitramfs 2019-07-31 16:25:58.000000000 +0200
> +++ initramfs-tools/unmkinitramfs     2020-03-31 18:36:36.821308275 +0200
> @@ -29,7 +29,9 @@
>       dir="$2"
>       shift 2
> 
> -     if gzip -t "$archive" >/dev/null 2>&1 ; then
> +     if zstd -q -c -t "$archive" >/dev/null 2>&1 ; then
> +             zstd -q -c -d "$archive"
> +     elif gzip -t "$archive" >/dev/null 2>&1 ; then
>               gzip -c -d "$archive"
>       elif xzcat -t "$archive" >/dev/null 2>&1 ; then
>               xzcat "$archive"

gzip should be checked first as it's most likely to be the actual
compression used.  Aside from that, I don't think the order matters
here.

Ben.

-- 
Ben Hutchings
Larkinson's Law: All laws are basically false.


Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to