diff --git a/nvidia-open-kmod.spec b/nvidia-open-kmod.spec index 7b7abd2..3c5b200 100644 --- a/nvidia-open-kmod.spec +++ b/nvidia-open-kmod.spec @@ -22,7 +22,7 @@ Name: %{kmodname}-kmod Version: 610.43.02 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Kernel module (kmod) for NVIDIA GPU hardware License: GPL-2.0-only and MIT @@ -65,6 +65,28 @@ and newer models of GPU hardware. %files %license COPYING %doc README.md +%dir %{_sharedstatedir}/%{name} +%ghost %{_sharedstatedir}/%{name}/initramfs-rebuilt + + +%posttrans +# The open modules need the GSP firmware (shipped by nvidia-kmod-common) inside +# the initramfs, or early load fails with "gsp_*.bin failed with error -2". +# Some packages regenerate the initramfs before that firmware is on disk; this +# scriptlet runs after every payload has been unpacked, so a rebuild here is +# guaranteed to capture it. Equivalent to the manual "dracut -f". +# +# Only required on the initial install. The stamp below is a ghost file (absent +# from the payload), so it exists only once we create it here; it persists +# across upgrades (the new package owns it too) and is removed on erase. Net +# effect: the rebuild runs on a first install and again after a full +# removal+reinstall, but not on plain upgrades or reinstalls. +if [ ! -e %{_sharedstatedir}/%{name}/initramfs-rebuilt ]; then + if [ -x %{_bindir}/dracut ]; then + %{_bindir}/dracut --force --regenerate-all --quiet || : + touch %{_sharedstatedir}/%{name}/initramfs-rebuilt + fi +fi %prep @@ -107,8 +129,18 @@ for flavor in %{flavors_to_build}; do popd done +# Own the state directory and pre-create the stamp so the ghost entry is +# registered correctly. The stamp is a ghost file, so its contents are not +# shipped; it is (re)created by the posttrans scriptlet on the target system. +install -d %{buildroot}%{_sharedstatedir}/%{name} +touch %{buildroot}%{_sharedstatedir}/%{name}/initramfs-rebuilt + %changelog +* Sun Jul 19 2026 Jonathan Wright - 610.43.02-6 +- Rebuild the initramfs on initial install so the GSP firmware is included, + avoiding a manual dracut -f after install + * Mon Jul 13 2026 Eduard Abdullin - 610.43.02-5 - Rebuild for new kernel