VirtualBox Linux: DKMS module build problems

After a while I didn't use VirtualBox, the virtualization system I use just to host my Windows virtual machines (all others machines are on KVM), I discovered that I cannot build the DKMS kernel module and so no way to start my Windows virtual machine. Not a big problem, I know :) But sometimes I need to test web application or build procedure on Windows environment.

After some tests I discovered in the build log file the real problem about the VirtualBox build procedure:

 fatal error: asm/amd_iommu.h: No such file or directory
compilation terminated.

so, it cannot find the kernel asm/amd module. And the problem is exactly that in the latests version of the kernel this module is removed (or renamed, not sure exactly), but VirtualBox want to use it.

So a quick-and-dirt solution I found is to copy this module from the previous version of kernel. For me it was:

 [root@mmornati]# cp /usr/src/kernels/ /usr/src/kernels/

After this I build the VirtualBox module without problem (/etc/init.d/vboxdrv setup) and started up my virtual machine.