[vbox-dev] Guest additions kernel module compilation error on CentOS 8 Stream guest

Mark Thebridge Mark.Thebridge at metaswitch.com
Tue Mar 10 09:05:27 GMT 2020


Hi,

The latest version of the Guest Additions (both 6.1.4 and master) fail to compile the kernel modules on a CentOS 8.1 guest using kernel 4.18.0-177.el8.x86_64 - the latest kernel available through the "Streams" release (which allows CentOS users to get early versions of packages that will be in the next minor release).

I've provided an initial patch that partly fixes this below (authored by me, released under the MIT license).  With this patch the video module compiles and works  - *but* I'm not sure exactly what the #include guards ought to be.  We can't actually test for RHEL_81 being defined, because then guest additions will stop compiling for anyone on the main RHEL/CentOS 8.1 release.  Unfortunately there's no real way I can see to tell if we are using at least  4.18.0-177.el8 (which needs these changes) or an earlier 8.1 kernel.  The kernel release number is available as the RHEL_RELEASE #define in the kernel tree, but that's a string, not an integer, and the C pre-processor can't do string comparisons.  I think we'd need some Makefile enhancements to pass in extra #defines, but not sure exactly where in the Makefiles those should live...

Even if this isn't fixed for CentOS 8 Streams guests, this patch will almost certainly be needed for RHEL/CentOS 8.2 when that comes out

Thanks,
Mark

diff -uNr -w a/vbox_fb.c b/vbox_fb.c
--- a/vbox_fb.c 2020-02-18 15:31:10.000000000 +0000
+++ b/vbox_fb.c 2020-03-03 16:33:07.197239177 +0000
@@ -335,14 +331,14 @@
     info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);
     info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) || defined(RHEL_81)
     drm_fb_helper_fill_info(info, &fbdev->helper, sizes);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || defined(RHEL_75)
     drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
#else
     drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) && !defined(RHEL_81)
     drm_fb_helper_fill_var(info, &fbdev->helper, sizes->fb_width,
                       sizes->fb_height);
#endif
diff -uNr -w a/vbox_ttm.c b/vbox_ttm.c
--- a/vbox_ttm.c 2020-02-14 11:35:05.000000000 +0000
+++ b/vbox_ttm.c 2020-03-03 16:33:07.199239341 +0000
@@ -312,7 +308,7 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
                                  dev->vma_offset_manager,
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) && !defined(RHEL_81)
                      DRM_FILE_PAGE_OFFSET,
#endif
                      true);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20200310/b1bdb530/attachment.html>


More information about the vbox-dev mailing list