Debian, Virtualbox, and Linux kernel >= 3.7 (3.10)
Since I am always compiling my own kernel, I am often suffering from uncompilable VirtualBox kernel modules. The code that comes with Debian/unstable is unfortunately targetting old releases of the Linux kernel. Compiling it on a recent (>= 3.10 I guess) kernel one gets first the following error:
/var/lib/dkms/virtualbox/4.2.16/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c:1465:38: error: ‘VM_RESERVED’ undeclared (first use in this function) vma->vm_flags |= VM_RESERVED; ^
The reason is that `VM_RESERVED` was removed around 3.7, and should be replaced by `VM_DONTEXPAND | VM_DONTDUMP`. Using the patch in the original post compilation continues a bit, but stops with
/var/lib/dkms/virtualbox/4.2.16/build/vboxdrv/r0drv/linux/thread2-r0drv-linux.c:62:36: error: ‘MAX_RT_PRIO’ undeclared (first use in this function) Param.sched_priority = MAX_RT_PRIO + 5; ^
This is something that has been introduced with Linux kernel 3.9. Using the patch given in this post I could compile the modules for my running kernel.
So what I am using is the following patch: virtualbox-3.11.patch