compiling the nVidia and VirtualBox modules for all available Fedora kernels

I like to keep some old kernel versions around, just in case.

The problem is that their manually compiled modules are often not kept up to date by Fedora (notably VirtualBox modules and nVidia’s blob). So here are the two commands I use to do just that manually.

nVidia’s blob (as packaged by RPMusion) uses the akmod system, so this is pretty straightforward:

root# for D in /lib/modules/* ; do akmods --kernels $(basename $D) ; done

And now, for VirtualBox, somewhat less nice (I had to dig through the code to find it):

root# for D in /lib/modules/* ; do KERN_DIR=$D/build MODULE_DIR=$D/misc /etc/init.d/vboxdrv setup ; done

Don’t pay attention to the Virtualbox script yelling about the impossibility of modprobing the newly compiled modules, this is totally normal: you can only modprobe modules compiled for your running kernel, which is not the case here.