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>
53 lines
1.7 KiB
Bash
53 lines
1.7 KiB
Bash
build() {
|
|
load_kdumpst_config
|
|
|
|
# A valid makedumpfile is essential for the kdump initrd creation.
|
|
if ! command -v makedumpfile 1>/dev/null; then
|
|
logger "kdumpst: failed to create minimal initrd, makedumpfile is missing"
|
|
exit 1
|
|
fi
|
|
|
|
add_binary /usr/bin/date
|
|
add_binary /usr/bin/sync
|
|
add_binary "$(command -v makedumpfile)"
|
|
|
|
# Copying kdump config/lib files is essential for a functional kdump.
|
|
add_full_dir /usr/share/kdumpst.d/
|
|
add_full_dir /usr/lib/kdumpst/
|
|
|
|
# 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}" > "${BUILDROOT}"/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}" > "${BUILDROOT}"/usr/lib/kdumpst/kdump.dir
|
|
|
|
# Finally, we shouldn't have DRM/GPU drivers and firmwares here,
|
|
# but...just in case, let's remove all of that nevertheless.
|
|
# Our list includes the most common GFX FW blobs (AMD, i915, Nvidia)
|
|
# and all GPU/DRM drivers.
|
|
rm -rf "${BUILDROOT}"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon}/
|
|
rm -rf "${BUILDROOT}"/usr/lib/modules/*/kernel/drivers/gpu/drm/*
|
|
|
|
add_runscript
|
|
}
|
|
|
|
help() {
|
|
cat <<HELPEOF
|
|
Hook responsible for creating the kdumpst minimal kdump initramfs.
|
|
HELPEOF
|
|
}
|
|
|
|
# vim: set ft=sh ts=4 sw=4 et:
|