Fixing VirtualBox Guest Additions’ vboxvideo_drm.c for SUSE Linux Enterprise Server (SLES) 11 SP3

Trying to install VirtualBox‘s Linux Guest Additions under SUSE Linux Enterprise Server (SLES) 11 SP3 currently fails even with the newest VirtualBox version (4.2.16):

sles11sp3:/tmp/vbox.0.orig # make
make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/3.0.76-0.11-default/build SUBDIRS=/tmp/vbox.0.orig SRCROOT=/tmp/vbox.0.orig modules
make[1]: Entering directory `/usr/src/linux-3.0.76-0.11-obj/x86_64/default'
make -C ../../../linux-3.0.76-0.11 O=/usr/src/linux-3.0.76-0.11-obj/x86_64/default/. modules
make -C /usr/src/linux-3.0.76-0.11-obj/x86_64/default \
	KBUILD_SRC=/usr/src/linux-3.0.76-0.11 \
	KBUILD_EXTMOD="/tmp/vbox.0.orig" -f /usr/src/linux-3.0.76-0.11/Makefile \
	modules
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (		\
	echo;								\
	echo "  ERROR: Kernel configuration is invalid.";		\
	echo "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
	echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";	\
	echo;								\
	/bin/false)
mkdir -p /tmp/vbox.0.orig/.tmp_versions ; rm -f /tmp/vbox.0.orig/.tmp_versions/*
make -f /usr/src/linux-3.0.76-0.11/scripts/Makefile.build obj=/tmp/vbox.0.orig
  gcc -Wp,-MD,/tmp/vbox.0.orig/.vboxvideo_drm.o.d  -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.3/include -I/usr/src/linux-3.0.76-0.11/arch/x86/include -Iarch/x86/include/generated -Iinclude  -I/usr/src/linux-3.0.76-0.11/include -include include/generated/autoconf.h   -I/tmp/vbox.0.orig -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_AVX=1 -pipe -Wno-sign-compare -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fomit-frame-pointer -fasynchronous-unwind-tables -g -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fshort-wchar -include /tmp/vbox.0.orig/include/VBox/VBoxGuestMangling.h   -I/lib/modules/3.0.76-0.11-default/build/include   -I/tmp/vbox.0.orig/   -I/tmp/vbox.0.orig/include   -I/tmp/vbox.0.orig/r0drv/linux   -I/tmp/vbox.0.orig/vboxvideo/   -I/tmp/vbox.0.orig/vboxvideo/include   -I/tmp/vbox.0.orig/vboxvideo/r0drv/linux -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DLOG_TO_BACKDOOR -DIN_MODULE -DIN_GUEST_R0 -DRT_NO_EXPORT_SYMBOL -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(vboxvideo_drm)"  -D"KBUILD_MODNAME=KBUILD_STR(vboxvideo)" -c -o /tmp/vbox.0.orig/.tmp_vboxvideo_drm.o /tmp/vbox.0.orig/vboxvideo_drm.c
/tmp/vbox.0.orig/vboxvideo_drm.c:121: error: unknown field ‘reclaim_buffers’ specified in initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:121: warning: initialization from incompatible pointer type
/tmp/vbox.0.orig/vboxvideo_drm.c:130: warning: braces around scalar initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:130: warning: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:131: error: field name not in record or union initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:131: error: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:131: warning: initialization from incompatible pointer type
/tmp/vbox.0.orig/vboxvideo_drm.c:132: error: field name not in record or union initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:132: error: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:132: warning: excess elements in scalar initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:132: warning: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:133: error: field name not in record or union initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:133: error: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:133: warning: excess elements in scalar initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:133: warning: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:137: error: field name not in record or union initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:137: error: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:137: warning: excess elements in scalar initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:137: warning: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:141: error: field name not in record or union initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:141: error: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:141: warning: excess elements in scalar initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:141: warning: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:142: error: field name not in record or union initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:142: error: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:142: warning: excess elements in scalar initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:142: warning: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:143: error: field name not in record or union initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:143: error: (near initialization for ‘driver.fops’)
/tmp/vbox.0.orig/vboxvideo_drm.c:143: warning: excess elements in scalar initializer
/tmp/vbox.0.orig/vboxvideo_drm.c:143: warning: (near initialization for ‘driver.fops’)
make[4]: *** [/tmp/vbox.0.orig/vboxvideo_drm.o] Error 1
make[3]: *** [_module_/tmp/vbox.0.orig] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-3.0.76-0.11-obj/x86_64/default'
make: *** [vboxvideo] Error 2

This error happens for the same reason that was reported in virtualbox.org bug #11586: Red Hat is obviously not the only company to back-port DRM code from newer Linux versions to their enterprise kernels, SUSE did so, too.

Thus, vboxvideo_drm.c needs additional logic as implemented in this patch:

Because SUSE, unlike Red Hat, for some reason no longer provides SLE_VERSION and SLE_VERSION_CODE macros in SLES11, we need to retrofit them ourselves. I stole the appropriate code from the “igb” network driver.

I filed a bug report as virtualbox.org bug #11984. Until the VirtualBox folks have come around to look at the issue and incorporate a fix (hopefully mine :), you may use a patched version of VBoxLinuxAdditions.run that I created using the makeself utility for your convenience:

Run this instead of the original and installation should work smoothly even under SLES11 SP3.

1 comment

  1. Downloaded patch to SLES 11 SP3 server, patched to date as of 19 Aug 2013.

    VirtualBox Additions compiled without errors and runs OK

    Thanks, this was a perfect solution to a niggly issue.

Leave a comment