VirtualBox

Opened 11 years ago

Closed 11 years ago

#11984 closed defect (fixed)

VirtualBox Guest Additions' vboxvideo_drm.c does not compile under SUSE Linux Enterprise Server (SLES) 11 SP3 -> fixed in releases later than 4.2

Reported by: Fate Owned by:
Component: guest additions Version: VirtualBox 4.2.16
Keywords: sles sles11 sles11sp3 vboxvideo drm Cc:
Guest type: Linux Host type: other

Description

As was the case with RHEL in #11586, SUSE seems to have backported DRM code in SUSE Linux Enterprise Server (SLES) 11 SP3. Thus, without the attached patch vboxvideo_drm.c won't compile:

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

As can be seen in the attached patch, just defining DRM_RHEL63 does not suffice. And because SUSE seems to have abandoned the SLE_VERSION and SLE_VERSION_CODE macros in SLES11 which they used to have just as Red Hat, I took appropriate definitions from Linux's igb network driver.

Attachments (1)

vboxvideo_drm.c-sles11sp3.diff (2.7 KB ) - added by Fate 11 years ago.
Patch to make vboxvideo_drm.c compile under SLES11 SP3

Download all attachments as: .zip

Change History (4)

by Fate, 11 years ago

Patch to make vboxvideo_drm.c compile under SLES11 SP3

comment:1 by Michael Thayer, 11 years ago

I have made local changes based on the logic in your patch. Could you please test these changes (against the version in our Subversion repository)?

Index: src/VBox/Additions/linux/drm/vboxvideo_drm.c
===================================================================
--- src/VBox/Additions/linux/drm/vboxvideo_drm.c	(revision 87875)
+++ src/VBox/Additions/linux/drm/vboxvideo_drm.c	(working copy)
@@ -68,10 +68,10 @@
 #    define DRM_RHEL61
 #   endif
 #   if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 3)
-#    define DRM_RHEL63
+#    define DRM_FOPS_AS_POINTER
 #   endif
 #   if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)
-#    define DRM_RHEL64
+#    define DRM_NO_RECLAIM_BUFFERS
 #   endif
 #  endif
 # endif
@@ -82,11 +82,21 @@
 # ifndef RHEL_RELEASE_CODE
 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 39) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
 #   if defined(DRM_MODE_OBJECT_PLANE) && defined(DRM_IOCTL_MODE_ADDFB2)
-#    define DRM_DEBIAN_34ON32
+#    define DRM_FOPS_AS_POINTER
 #   endif
 #  endif
 # endif
 
+#ifdef CONFIG_SUSE_KERNEL
+/* This is to cover the SLES 11 SP3 kernel back-ports. */
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,61)
+#  if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
+#    define DRM_FOPS_AS_POINTER
+#    define DRM_NO_RECLAIM_BUFFERS
+#  endif
+# endif
+#endif
+
 static struct pci_device_id pciidlist[] = {
         vboxvideo_PCI_IDS
 };
@@ -101,7 +111,7 @@
     return 0;
 #endif
 }
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_RHEL63) || defined(DRM_DEBIAN_34ON32)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER)
 /* since linux-3.3.0-rc1 drm_driver::fops is pointer */
 static struct file_operations driver_fops =
 {
@@ -119,7 +129,7 @@
 {
     /* .driver_features = DRIVER_USE_MTRR, */
     .load = vboxvideo_driver_load,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) && !defined(DRM_RHEL64)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) && !defined(DRM_NO_RECLAIM_BUFFERS)
     .reclaim_buffers = drm_core_reclaim_buffers,
 #endif
     /* As of Linux 2.6.37, always the internal functions are used. */
@@ -127,7 +137,7 @@
     .get_map_ofs = drm_core_get_map_ofs,
     .get_reg_ofs = drm_core_get_reg_ofs,
 #endif
-# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && !defined(DRM_RHEL63) && !defined(DRM_DEBIAN_34ON32)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && !defined(DRM_FOPS_AS_POINTER)
     .fops =
     {
         .owner = THIS_MODULE,
@@ -144,7 +154,7 @@
         .poll = drm_poll,
         .fasync = drm_fasync,
     },
-#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_RHEL63) || defined(DRM_DEBIAN_34ON32) */
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER) */
     .fops = &driver_fops,
 #endif
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(DRM_RHEL61)

comment:2 by Michael Thayer, 11 years ago

Summary: VirtualBox Guest Additions' vboxvideo_drm.c does not compile under SUSE Linux Enterprise Server (SLES) 11 SP3VirtualBox Guest Additions' vboxvideo_drm.c does not compile under SUSE Linux Enterprise Server (SLES) 11 SP3 -> fixed in releases later than 4.2

No response, so I committed the patch I posted above and we will see.

comment:3 by Frank Mehnert, 11 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette