From 4767b8095f9f0563f8bd10c4c215a73e33a292be Mon Sep 17 00:00:00 2001 From: "Guilherme G. Piccoli" Date: Mon, 6 May 2024 15:12:37 -0300 Subject: [PATCH] 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 --- initramfs/dracut/module-setup.sh.in | 7 ++++--- initramfs/initcpio/kdump.install.in | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/initramfs/dracut/module-setup.sh.in b/initramfs/dracut/module-setup.sh.in index 74261e0..e99bf1a 100644 --- a/initramfs/dracut/module-setup.sh.in +++ b/initramfs/dracut/module-setup.sh.in @@ -10,9 +10,10 @@ installkernel() { # 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 FWs/drivers (amd, i915, nvidia). - rm -rf "$initdir"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon} - rm -rf "$initdir"/usr/lib/modules/*/kernel/drivers/gpu/drm/{amd,i915,nouveau,radeon} + # 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 diff --git a/initramfs/initcpio/kdump.install.in b/initramfs/initcpio/kdump.install.in index 950125e..5141e21 100644 --- a/initramfs/initcpio/kdump.install.in +++ b/initramfs/initcpio/kdump.install.in @@ -35,9 +35,10 @@ build() { # 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 FWs/drivers (amd, i915, nvidia). - rm -rf "${BUILDROOT}"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon} - rm -rf "${BUILDROOT}"/usr/lib/modules/*/kernel/drivers/gpu/drm/{amd,i915,nouveau,radeon} + # 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 }