Hi Tao,
On Tue, 9 Aug 2022 15:00:39 +0800
Tao Liu <ltao(a)redhat.com> wrote:
Previously kexec-tools will pass "--compress zstd" to
dracut. It
will make dracut to decide whether: a) call mksquashfs to make a
zstd format squash-root.img, b) call cmd zstd to make a initramfs.
Currently dracut has decoupled the compressor for dracut and
dracut-squash, So in this patch, we will pass the compressor seperately.
Which dracut version do you mean with "currently"? Is it <= 050, the
minimal dracut version required by the spec file?
Other than that the patch looks good to me.
Site note: Does it make sense to extend is_squash_available to also
check if the mksquashfs command is availabel? The way I see it you can
have a kernel that is able to read the squashfs without having the
squashfs-tools installed required to create it.
Thanks
Philipp
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib.sh | 2 +-
mkdumprd | 7 +++----
mkfadumprd | 4 +++-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index f32b802..c59a25f 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -462,7 +462,7 @@ is_wdt_active()
have_compression_in_dracut_args()
{
[[ "$(kdump_get_conf_val dracut_args)" =~ \
- (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress)([[:space:]]|$)
]]
+ (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress|squash-compressor)([[:space:]]|$)
]]
}
# If "dracut_args" contains "--mount" information, use it
diff --git a/mkdumprd b/mkdumprd
index 3e250e0..01eabcb 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -432,10 +432,9 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
if ! have_compression_in_dracut_args; then
- # Here zstd is set as the default compression method. If squash module
- # is available for dracut, libzstd will be used by mksquashfs. If
- # squash module is unavailable, command zstd will be used instead.
- if is_squash_available || is_zstd_command_available; then
+ if is_squash_available; then
+ add_dracut_arg "--squash-compressor" "zstd"
+ elif is_zstd_command_available; then
add_dracut_arg "--compress" "zstd"
fi
fi
diff --git a/mkfadumprd b/mkfadumprd
index 86dfcee..cd76fc8 100644
--- a/mkfadumprd
+++ b/mkfadumprd
@@ -64,7 +64,9 @@ fi
# Same as setting zstd in mkdumprd
if ! have_compression_in_dracut_args; then
- if is_squash_available || is_zstd_command_available; then
+ if is_squash_available; then
+ _dracut_isolate_args+=(--squash-compressor zstd)
+ elif is_zstd_command_available; then
_dracut_isolate_args+=(--compress zstd)
fi
fi