Thanks to the great report from Saurabh Charde, we noticed that the removal command used in the minimal initrd creation for deleting the GPU/DRM drivers wasn't working. Fix that so now GPU drivers aren't included for real (both for space and boot "issue-prone" criteria). Closes: https://gitlab.freedesktop.org/gpiccoli/kdumpst/-/issues/19 Reported-by: Saurabh Charde (@schardev) Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
78 lines
2.3 KiB
Bash
78 lines
2.3 KiB
Bash
# Only include kdump if it is explicitly asked in the argument list
|
|
check() {
|
|
return 255
|
|
}
|
|
|
|
installkernel() {
|
|
load_kdumpst_config
|
|
|
|
# First clear all unnecessary firmwares/drivers added by drm in order
|
|
# to reduce the size of the minimal initramfs being created - kdump
|
|
# is an non-graphical environment. This should have been already done
|
|
# via dracut cmdline arguments, but play safe and delete here as well.
|
|
# Our list includes the most common GFX FW blobs (AMD, i915, Nvidia)
|
|
# and all GPU/DRM drivers.
|
|
rm -rf "$initdir"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon}/
|
|
rm -rf "$initdir"/usr/lib/modules/*/kernel/drivers/gpu/drm/*
|
|
|
|
FSMOD="$(findmnt -n -o FSTYPE --target "${MOUNT_FOLDER}")"
|
|
if [ -z "${FSMOD}" ]; then
|
|
logger "kdumpst: error on filesystem discovery"
|
|
exit 1
|
|
fi
|
|
|
|
instmods "${FSMOD}"
|
|
|
|
# We try here to be comprehensive and include the most common
|
|
# block modules to allow mounting the target device - notice
|
|
# that since we use hostonly, only the ones that make sense would
|
|
# get added, hence this list won't bloat the minimal image!
|
|
instmods aacraid
|
|
instmods ahci
|
|
instmods hpsa
|
|
instmods megaraid_sas
|
|
instmods mpt3sas
|
|
instmods nvme
|
|
instmods virtio_blk
|
|
instmods virtio-scsi
|
|
}
|
|
|
|
install() {
|
|
# A valid makedumpfile is essential for the kdump initrd creation.
|
|
if ! command -v makedumpfile 1>/dev/null; then
|
|
logger "kdumpst: failed to create dracut initrd, makedumpfile is missing"
|
|
exit 1
|
|
fi
|
|
|
|
load_kdumpst_config
|
|
|
|
# Install necessary binaries
|
|
inst date
|
|
inst sync
|
|
inst makedumpfile
|
|
|
|
# Copying kdumpst config/lib files is essential for a functional kdump.
|
|
cp -LR --preserve=all /usr/share/kdumpst.d/ "$initdir"/usr/share/
|
|
cp -LR --preserve=all /usr/lib/kdumpst/ "$initdir"/usr/lib/
|
|
|
|
# Finally, we need to derive the proper place to save the dump from the
|
|
# config files, in a way that makes possible to mount it in early boot.
|
|
DEVNODE="$(findmnt -n -o SOURCE --target "${MOUNT_FOLDER}")"
|
|
if [ -z "${DEVNODE}" ]; then
|
|
logger "kdumpst: error on devnode discovery"
|
|
exit 1
|
|
fi
|
|
echo "${DEVNODE}" > "$initdir"/usr/lib/kdumpst/kdump.mnt
|
|
|
|
TGT="$(findmnt -n -o TARGET --target "${MOUNT_FOLDER}")"
|
|
if [ -z "${TGT}" ]; then
|
|
logger "kdumpst: error on base folder discovery"
|
|
exit 1
|
|
fi
|
|
|
|
BASE_FLD="${MOUNT_FOLDER#*$TGT}"
|
|
echo "${BASE_FLD}" > "$initdir"/usr/lib/kdumpst/kdump.dir
|
|
|
|
inst_hook pre-mount 01 "$moddir/kdump-collect.sh"
|
|
}
|