Skip to content

Instantly share code, notes, and snippets.

@informationsea
Created December 12, 2018 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save informationsea/44f664958f282a905ad335053527e484 to your computer and use it in GitHub Desktop.
Save informationsea/44f664958f282a905ad335053527e484 to your computer and use it in GitHub Desktop.
VritualBox Guest Addition 5.2.22 Patch for Cent OS 7.6

VritualBox Guest Addition 5.2.22 Patch for Cent OS 7.6

Original Patch

https://www.virtualbox.org/attachment/ticket/18093/vbox_video_build_rhel76_fix.patch

How to apply

  1. Download vboxvide.patch from below
  2. Ensure newline is CR LF
  3. Change directory to /opt/VBoxGuestAdditions-5.2.22/src/vboxguest-5.2.22/vboxvideo
  4. Apply patch with sudo patch -p1 < path/to/vboxvide.patch
  5. Rebuild Guest Addition with sudo /opt/VBoxGuestAdditions-5.2.22/init/vboxadd setup
diff -u vboxvideo-original/vbox_drv.h vboxvideo/vbox_drv.h
--- vboxvideo-original/vbox_drv.h 2018-12-12 12:37:53.919791853 +0900
+++ vboxvideo/vbox_drv.h 2018-12-12 12:43:50.521791853 +0900
@@ -45,6 +45,9 @@
#include <linux/string.h>
#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
+# if RHEL_MAJOR == 7 && RHEL_MINOR >= 6
+# define RHEL_76
+# endif
# if RHEL_MAJOR == 7 && RHEL_MINOR >= 5
# define RHEL_75
# endif
diff -u vboxvideo-original/vbox_mode.c vboxvideo/vbox_mode.c
--- vboxvideo-original/vbox_mode.c 2018-12-12 12:37:53.919791853 +0900
+++ vboxvideo/vbox_mode.c 2018-12-12 13:06:27.361791853 +0900
@@ -352,7 +352,7 @@
/* pick the encoder ids */
if (enc_id)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) || \
- (defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 15)
+ (defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 15) || defined(RHEL_76)
return drm_encoder_find(connector->dev, NULL, enc_id);
#else
return drm_encoder_find(connector->dev, enc_id);
diff -u vboxvideo-original/vbox_ttm.c vboxvideo/vbox_ttm.c
--- vboxvideo-original/vbox_ttm.c 2018-12-12 12:37:53.919791853 +0900
+++ vboxvideo/vbox_ttm.c 2018-12-12 13:07:45.712791853 +0900
@@ -204,7 +204,7 @@
.destroy = &vbox_ttm_backend_destroy,
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)) && !defined(RHEL_76)
static struct ttm_tt *vbox_ttm_tt_create(struct ttm_bo_device *bdev,
unsigned long size,
u32 page_flags,
@@ -221,7 +221,7 @@
return NULL;
tt->func = &vbox_tt_backend_func;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)) && !defined(RHEL_76)
if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
#else
if (ttm_tt_init(tt, bo, page_flags)) {
@@ -234,7 +234,7 @@
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
-# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
+# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76)
static int vbox_ttm_tt_populate(struct ttm_tt *ttm)
{
return ttm_pool_populate(ttm);
@@ -268,7 +268,7 @@
.io_mem_reserve = &vbox_ttm_io_mem_reserve,
.io_mem_free = &vbox_ttm_io_mem_free,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL_75)
-# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
+# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76)
.io_mem_pfn = ttm_bo_default_io_mem_pfn,
# endif
#endif
@@ -411,7 +411,7 @@
#else
align >> PAGE_SHIFT, false, acc_size,
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72)) && !defined(RHEL_76)
NULL,
#endif
NULL, vbox_bo_ttm_destroy);
@@ -430,7 +430,7 @@
int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)) || defined(RHEL_76)
struct ttm_operation_ctx ctx = { false, false };
#endif
int i, ret;
@@ -448,7 +448,7 @@
for (i = 0; i < bo->placement.num_placement; i++)
PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76)
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
#else
ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
@@ -466,7 +466,7 @@
int vbox_bo_unpin(struct vbox_bo *bo)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)) || defined(RHEL_76)
struct ttm_operation_ctx ctx = { false, false };
#endif
int i, ret;
@@ -482,7 +482,7 @@
for (i = 0; i < bo->placement.num_placement; i++)
PLACEMENT_FLAGS(bo->placements[i]) &= ~TTM_PL_FLAG_NO_EVICT;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76)
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
#else
ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
@@ -500,7 +500,7 @@
*/
int vbox_bo_push_sysram(struct vbox_bo *bo)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)) || defined(RHEL_76)
struct ttm_operation_ctx ctx = { false, false };
#endif
int i, ret;
@@ -521,7 +521,7 @@
for (i = 0; i < bo->placement.num_placement; i++)
PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76)
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
#else
ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment