initramfs: Fix the removal of GPU drivers from the minimal initrd

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>
This commit is contained in:
Guilherme G. Piccoli
2024-05-06 15:12:37 -03:00
parent 6141e3c4cb
commit 4767b8095f
2 changed files with 8 additions and 6 deletions

View File

@ -10,9 +10,10 @@ installkernel() {
# to reduce the size of the minimal initramfs being created - kdump # to reduce the size of the minimal initramfs being created - kdump
# is an non-graphical environment. This should have been already done # is an non-graphical environment. This should have been already done
# via dracut cmdline arguments, but play safe and delete here as well. # via dracut cmdline arguments, but play safe and delete here as well.
# Our list includes the most common FWs/drivers (amd, i915, nvidia). # Our list includes the most common GFX FW blobs (AMD, i915, Nvidia)
rm -rf "$initdir"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon} # and all GPU/DRM drivers.
rm -rf "$initdir"/usr/lib/modules/*/kernel/drivers/gpu/drm/{amd,i915,nouveau,radeon} 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}")" FSMOD="$(findmnt -n -o FSTYPE --target "${MOUNT_FOLDER}")"
if [ -z "${FSMOD}" ]; then if [ -z "${FSMOD}" ]; then

View File

@ -35,9 +35,10 @@ build() {
# Finally, we shouldn't have DRM/GPU drivers and firmwares here, # Finally, we shouldn't have DRM/GPU drivers and firmwares here,
# but...just in case, let's remove all of that nevertheless. # but...just in case, let's remove all of that nevertheless.
# Our list includes the most common FWs/drivers (amd, i915, nvidia). # Our list includes the most common GFX FW blobs (AMD, i915, Nvidia)
rm -rf "${BUILDROOT}"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon} # and all GPU/DRM drivers.
rm -rf "${BUILDROOT}"/usr/lib/modules/*/kernel/drivers/gpu/drm/{amd,i915,nouveau,radeon} rm -rf "${BUILDROOT}"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon}/
rm -rf "${BUILDROOT}"/usr/lib/modules/*/kernel/drivers/gpu/drm/*
add_runscript add_runscript
} }