How portable are (nondeterministic) kmod builds?

We occasionally see akmods fail after updating a kernel. The system may shut down with a kernel panic, and after rebooting there is no video: /var/log/Xorg.0.log contains a “(EE) no screens found(EE)” message. Our product is a graphical kiosk so this bricks customer systems. This is Fedora 23 with the 358.16 driver so I am not expecting specific help on something that old.

As a workaround, precompiling the kmod-nvidia package and installing it along with the kernel packages seems to be reliable. However, the .ko files in kmod-nvidia*.rpm are always different, even if created back to back on the same system. I see some differing content like “/tmp/akmodsbuild/UGE3R5Dj/BUILD/…” that is obviously random, but there are also other binary differences and the .ko files also fluctuate in size. My primary question is whether we can build a single kmod-nvidia RPM that works across several combinations of workstation models and Nvidia Quadro cards (all with the same kernel version, obviously), or whether we need different kmod-nvidia packages for the different hardware configurations. A secondary question, just out of curiosity, is why the kmod-nvidia contents vary. Thanks for any info!

The solution is to distribute a binary rpm for the required kernel

for running kernel

rpmbuild --rebuild --define='kernels $(uname -r)' nvidia-kmod-{whatever_version}.src.rpm

or to build for a specific kernel (corresponding kernel-devel needs to be installed).

rpmbuild --rebuild --define='kernels 4.12.6-300.fc26.x86_64' nvidia-kmod-{whatever_version}.src.rpm

That seems stable. Thanks!