From 646f6d71d8d15806ed484c74abb5e57630646f977adcf417015121753a6560c8 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Thu, 21 Sep 2017 13:54:20 +0000 Subject: [PATCH 1/3] - Update "fixes_for_4.14.patch" to handle missing SKB_GSO_UDP in kernel 4.14 OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=364 --- fixes_for_4.14.patch | 43 ++++++++++++++++++++++++++++++++++++++----- virtualbox.changes | 5 +++++ 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/fixes_for_4.14.patch b/fixes_for_4.14.patch index 34db20e..5d30867 100644 --- a/fixes_for_4.14.patch +++ b/fixes_for_4.14.patch @@ -2,15 +2,48 @@ Index: VirtualBox-5.1.28/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c =================================================================== --- VirtualBox-5.1.28.orig/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c +++ VirtualBox-5.1.28/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c -@@ -357,7 +357,11 @@ static int vboxPciFileWrite(struct file* +@@ -353,12 +353,17 @@ static void vboxPciFileClose(struct fil + static int vboxPciFileWrite(struct file* file, unsigned long long offset, unsigned char* data, unsigned int size) + { + int ret; ++# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ++ ret = kernel_write(file, data, size, &offset); ++#else + mm_segment_t fs_save; fs_save = get_fs(); set_fs(get_ds()); -+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) -+ ret = kernel_write(file, data, size, &offset); -+#else ret = vfs_write(file, data, size, &offset); -+#endif set_fs(fs_save); ++#endif if (ret < 0) printk(KERN_DEBUG "vboxPciFileWrite: error %d\n", ret); + +Index: VirtualBox-5.1.28/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c +=================================================================== +--- VirtualBox-5.1.28.orig/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c ++++ VirtualBox-5.1.28/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c +@@ -124,6 +124,10 @@ typedef struct VBOXNETFLTNOTIFIER *PVBOX + # define bstats stats + # define qstats stats + # endif ++#endif ++ ++# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++#define SKB_GSO_UDP 0 + #endif + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0) +@@ -722,9 +726,11 @@ static struct sk_buff *vboxNetFltLinuxSk + case PDMNETWORKGSOTYPE_IPV4_TCP: + fGsoType = SKB_GSO_TCPV4; + break; ++# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + case PDMNETWORKGSOTYPE_IPV4_UDP: + fGsoType = SKB_GSO_UDP; + break; ++#endif + case PDMNETWORKGSOTYPE_IPV6_TCP: + fGsoType = SKB_GSO_TCPV6; + break; diff --git a/virtualbox.changes b/virtualbox.changes index d0cf0aa..8650ee5 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Sep 21 13:49:01 UTC 2017 - Larry.Finger@lwfinger.net + +- Update "fixes_for_4.14.patch" to handle missing SKB_GSO_UDP in kernel 4.14 + ------------------------------------------------------------------- Wed Sep 20 00:44:12 UTC 2017 - Larry.Finger@lwfinger.net From 76f0fe63c022516733730329f168141ad85b8222e28e27cd43460d3c93741588 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sun, 24 Sep 2017 14:57:55 +0000 Subject: [PATCH 2/3] - Update "fixes_for_4.14.patch" to handle additional API changes in kernel 4.14. These include the following: removal of gamma_set and gamma_get from struct drm_fb_helper_funcs removal of set_busid from struct drm_driver replacement of drm_pci_init() with pci_register_driver() replacement of drm_pci_exit() with pci_unregister_driver() removal of load_lut from struct drm_crtc_helper_func OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=365 --- fixes_for_4.14.patch | 101 +++++++++++++++++++++++++++++++++++++++++++ virtualbox.changes | 11 +++++ 2 files changed, 112 insertions(+) diff --git a/fixes_for_4.14.patch b/fixes_for_4.14.patch index 5d30867..7d098e4 100644 --- a/fixes_for_4.14.patch +++ b/fixes_for_4.14.patch @@ -1,3 +1,18 @@ +Patch VirtualBox source for changes in the kernel API for 4.14.x + +The following issues are addressed: + vfs_write() is replaced by kernel_write() + symbol SKB_GSO_UDP is removed + removal of gamma_set and gamma_get from struct drm_fb_helper_funcs + removal of set_busid from struct drm_driver + replacement of drm_pci_init() with pci_register_driver() + replacement of drm_pci_exit() with pci_unregister_driver() + removal of load_lut from struct drm_crtc_helper_func + +This patch is licensed under the MIT license. + +Signed-off-by: Larry Finger + Index: VirtualBox-5.1.28/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c =================================================================== --- VirtualBox-5.1.28.orig/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c @@ -47,3 +62,89 @@ Index: VirtualBox-5.1.28/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux. case PDMNETWORKGSOTYPE_IPV6_TCP: fGsoType = SKB_GSO_TCPV6; break; +Index: VirtualBox-5.1.28/src/VBox/Additions/linux/drm/vbox_fb.c +=================================================================== +--- VirtualBox-5.1.28.orig/src/VBox/Additions/linux/drm/vbox_fb.c ++++ VirtualBox-5.1.28/src/VBox/Additions/linux/drm/vbox_fb.c +@@ -381,6 +381,7 @@ out: + return ret; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + static void vbox_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, + u16 blue, int regno) + { +@@ -394,10 +395,13 @@ static void vbox_fb_gamma_get(struct drm + *green = regno; + *blue = regno; + } ++#endif + + static struct drm_fb_helper_funcs vbox_fb_helper_funcs = { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + .gamma_set = vbox_fb_gamma_set, + .gamma_get = vbox_fb_gamma_get, ++#endif + .fb_probe = vboxfb_create, + }; + +Index: VirtualBox-5.1.28/src/VBox/Additions/linux/drm/vbox_drv.c +=================================================================== +--- VirtualBox-5.1.28.orig/src/VBox/Additions/linux/drm/vbox_drv.c ++++ VirtualBox-5.1.28/src/VBox/Additions/linux/drm/vbox_drv.c +@@ -281,7 +281,7 @@ static struct drm_driver driver = + .lastclose = vbox_driver_lastclose, + .master_set = vbox_master_set, + .master_drop = vbox_master_drop, +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_73) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_73)) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + .set_busid = drm_pci_set_busid, + #endif + +@@ -326,11 +326,19 @@ static int __init vbox_init(void) + if (vbox_modeset == 0) + return -EINVAL; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + return drm_pci_init(&driver, &vbox_pci_driver); ++#else ++ return pci_register_driver(&vbox_pci_driver); ++#endif + } + static void __exit vbox_exit(void) + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + drm_pci_exit(&driver, &vbox_pci_driver); ++#else ++ pci_unregister_driver(&vbox_pci_driver); ++#endif + } + + module_init(vbox_init); +Index: VirtualBox-5.1.28/src/VBox/Additions/linux/drm/vbox_mode.c +=================================================================== +--- VirtualBox-5.1.28.orig/src/VBox/Additions/linux/drm/vbox_mode.c ++++ VirtualBox-5.1.28/src/VBox/Additions/linux/drm/vbox_mode.c +@@ -152,10 +152,12 @@ static int vbox_set_view(struct drm_crtc + return 0; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + static void vbox_crtc_load_lut(struct drm_crtc *crtc) + { + + } ++#endif + + static void vbox_crtc_dpms(struct drm_crtc *crtc, int mode) + { +@@ -301,7 +303,9 @@ static const struct drm_crtc_helper_func + .mode_set = vbox_crtc_mode_set, + /* .mode_set_base = vbox_crtc_mode_set_base, */ + .disable = vbox_crtc_disable, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + .load_lut = vbox_crtc_load_lut, ++#endif + .prepare = vbox_crtc_prepare, + .commit = vbox_crtc_commit, + diff --git a/virtualbox.changes b/virtualbox.changes index 8650ee5..93cedde 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Sun Sep 24 14:45:02 UTC 2017 - Larry.Finger@lwfinger.net + +- Update "fixes_for_4.14.patch" to handle additional API changes in kernel 4.14. + These include the following: + removal of gamma_set and gamma_get from struct drm_fb_helper_funcs + removal of set_busid from struct drm_driver + replacement of drm_pci_init() with pci_register_driver() + replacement of drm_pci_exit() with pci_unregister_driver() + removal of load_lut from struct drm_crtc_helper_func + ------------------------------------------------------------------- Thu Sep 21 13:49:01 UTC 2017 - Larry.Finger@lwfinger.net From 4ad73fc1341edb4e3214103bcf8fcec261f5966f3ca656ef2062707f23efb299 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Mon, 25 Sep 2017 20:31:11 +0000 Subject: [PATCH 3/3] - Make changes suggested in bsc#1060072 The specific changes are: (1) Remove the test in vboxdrv.sh as the script tests for the wrong file. This is safe because if the package is not installed, the script will not be there. (2) Move VBoxDbg.so to package virtualbox-qt. With this change, packages libQt5Core, libQt5Gui and libQt5Widgets are no longer needed with package virtualbox. As a result, a text-only server no longer needs to load QT to support headless virtual machines. OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=367 --- vboxdrv.sh | 14 -------------- virtualbox.changes | 11 +++++++++++ virtualbox.spec | 3 ++- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/vboxdrv.sh b/vboxdrv.sh index ae89fdd..928b181 100644 --- a/vboxdrv.sh +++ b/vboxdrv.sh @@ -52,20 +52,6 @@ export BUILD_TYPE export USERNAME export USER=$USERNAME -if test -n "${INSTALL_DIR}" && test -x "${INSTALL_DIR}/VirtualBox"; then - MODULE_SRC="${INSTALL_DIR}/src/vboxhost" -elif test -x /usr/lib/virtualbox/VirtualBox; then - INSTALL_DIR=/usr/lib/virtualbox - MODULE_SRC="/usr/share/virtualbox/src/vboxhost" -elif test -x "${SCRIPT_DIR}/VirtualBox"; then - # Executing from the build directory - INSTALL_DIR="${SCRIPT_DIR}" - MODULE_SRC="${INSTALL_DIR}/src" -else - # Silently exit if the package was uninstalled but not purged. - # Applies to Debian packages only (but shouldn't hurt elsewhere) - exit 0 -fi VIRTUALBOX="${INSTALL_DIR}/VirtualBox" VBOXMANAGE="${INSTALL_DIR}/VBoxManage" BUILDINTMP="${MODULE_SRC}/build_in_tmp" diff --git a/virtualbox.changes b/virtualbox.changes index 93cedde..28125be 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Sep 25 20:15:56 UTC 2017 - Larry.Finger@lwfinger.net + +- Make changes suggested in bsc#1060072 + The specific changes are: + (1) Remove the test in vboxdrv.sh as the script tests for the wrong file. This is safe because + if the package is not installed, the script will not be there. + (2) Move VBoxDbg.so to package virtualbox-qt. With this change, packages libQt5Core, libQt5Gui + and libQt5Widgets are no longer needed with package virtualbox. As a result, a text-only + server no longer needs to load QT to support headless virtual machines. + ------------------------------------------------------------------- Sun Sep 24 14:45:02 UTC 2017 - Larry.Finger@lwfinger.net diff --git a/virtualbox.spec b/virtualbox.spec index 40f0288..4f13b61 100644 --- a/virtualbox.spec +++ b/virtualbox.spec @@ -593,6 +593,7 @@ install -m 755 vboxshell.py %{buildroot}%{_vbox_instdir} install -m 755 VBoxBalloonCtrl %{buildroot}%{_vbox_instdir} install -m 755 webtest %{buildroot}%{_vbox_instdir} install -m 755 VBoxDTrace %{buildroot}%{_vbox_instdir} +install -m 755 VBoxDbg.so %{buildroot}%{_vbox_instdir} # create links to vbox tools in PATH - they could be usefull for controlling vbox from command line ln -s %{_vbox_instdir}/VBoxManage %{buildroot}%{_bindir}/VBoxManage ln -s %{_vbox_instdir}/VBoxHeadless %{buildroot}%{_bindir}/VBoxHeadless @@ -864,7 +865,6 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_vbox_instdir}/DbgPlugInDiggers.so %{_vbox_instdir}/VBoxAuth.so %{_vbox_instdir}/VBoxAuthSimple.so -%{_vbox_instdir}/VBoxDbg.so %{_vbox_instdir}/VBoxDragAndDropSvc.so %{_vbox_instdir}/VBoxVMMPreload.so #todo:double check - if this file should be assigned to the host side @@ -910,6 +910,7 @@ export DISABLE_RESTART_ON_UPDATE=yes #qm's translations %{_datadir}/virtualbox/nls %{_vbox_instdir}/VirtualBox.so +%{_vbox_instdir}/VBoxDbg.so %{_datadir}/pixmaps/virtualbox.png %{_datadir}/applications/%{name}.desktop %{_udevrulesdir}/60-vboxdrv.rules