Mainline On Metal
VirtualBox Modules 5.1.30 vs. Linux Kernel 4.14.0

Problem: The current release of the Linux kernel as of this writing, 4.14.0, is incompatible with VirtualBox kernel modules 5.1.30 as per this error:

/var/tmp/portage/app-emulation/virtualbox-modules-5.1.30/work/vboxdrv/r0drv/linux/timer-r0drv-linux.c: In function 'VBoxHost_RTTimerCreateEx':
/var/tmp/portage/app-emulation/virtualbox-modules-5.1.30/work/vboxdrv/r0drv/linux/timer-r0drv-linux.c:1588:13: error: implicit declaration of function 'init_timer_pinned'; did you mean 'init_timer_key'? [-Werror=implicit-function-declaration]

Cause: The issue is created by this commit which removes init_timer_pinned and replaces it with a new mechanism.

Resolution: This is a newer bug and was a little bit tougher as I couldn't find any distro patches to base my patch off of. I had to spin up KDevelop and go it alone.

Hacking the VirtualBox source directly out of the failed build in /var/tmp/portage

KDevelop makes this surprisingly easy. You just import the Makefile. Add a few include paths and you've got some good guideposts to go by.

Adding the VirtualBox modules and Linux kernel include paths

It took some digging to restructure this thing, but in the end the patch turned out pretty simple as per the gist below. Use this at your own risk. I don't have a solid understanding of how these timers work. I've confirmed VirtualBox does launch with this build, but I haven't put it though any heavy stress testing.

Last updated: November 23, 2017