Skip to content

Commit

Permalink
mkdumprd: add support for 95squash-erofs
Browse files Browse the repository at this point in the history
With dracut 104 support for erofs in 99squash was added. For that the
squashfs specific code was split from 99squash module into
95squash-squashfs and a new 95squash-erofs was added. The modules are
structured the way, that you can either add 99squash, which then picks
the 'best' back end, or one of the 95squash-{squashfs,erofs} if you want
to make sure which back end is used.

Unfortunately erofs doesn't support the same compression algorithms
squashfs supports.  So explicitly set which image type we want so we can
set the correct --squash-compressor option.

Keep support for the old 99squash for the time being so newer versions
of kdump-utils can work with dracut <= 103.

Signed-off-by: Philipp Rudo <[email protected]>
  • Loading branch information
prudo1 committed Aug 27, 2024
1 parent e862017 commit 377eb26
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
29 changes: 28 additions & 1 deletion mkdumprd
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ trap '
# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT

# check whether the given dracut module is installed. If multiple modules are
# provided return true if any of them is installed.
has_dracut_module()
{
local -a _args
local _e

[[ $# -ge 1 ]] || return 1

for _e in "$@"; do
_args+=(-e "$_e")
done

grep -x -q "${_args[@]}" <<< "$(dracut --list-modules)"
}

# caller should ensure $1 is valid and mounted in 1st kernel
to_mount()
{
Expand Down Expand Up @@ -379,7 +395,18 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target

if ! have_compression_in_dracut_args; then
if has_command mksquashfs; then
# With dracut 104 the 99squash module got split up into 99squash and
# 95squash-squashfs as well as the new 95squash-erofs. Explicitly set
# which image type is required otherwise the requested compression
# algorithm might not be supported.
if has_dracut_module squash-squashfs && has_command mksquashfs; then
dracut_args+=(--add squash-squashfs)
dracut_args+=(--squash-compressor zstd)
elif has_dracut_module squash-erofs && has_command mkfs.erofs; then
dracut_args+=(--add squash-erofs)
dracut_args+=(--squash-compressor lz4hc)
elif has_command mksquashfs; then
# only true for dracut <= 103
dracut_args+=(--add squash)
dracut_args+=(--squash-compressor zstd)
fi
Expand Down
2 changes: 1 addition & 1 deletion mkfadumprd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ddebug "rebuild fadump initrd: $FADUMP_INITRD"
# compression ratio and increases the size of the initramfs image.
# Don't compress the capture image as uncompressed image is needed immediately.
# Also, early microcode would not be needed here.
if ! $MKDUMPRD "$FADUMP_INITRD" -i "$MKFADUMPRD_TMPDIR/fadump.initramfs" /etc/fadump.initramfs --omit squash --no-compress --no-early-microcode; then
if ! $MKDUMPRD "$FADUMP_INITRD" -i "$MKFADUMPRD_TMPDIR/fadump.initramfs" /etc/fadump.initramfs --omit squash --omit squash-squashfs --omit squash-erofs --no-compress --no-early-microcode; then
perror_exit "mkfadumprd: failed to build image with dump capture support"
fi

Expand Down

0 comments on commit 377eb26

Please sign in to comment.