commit 6b82dca3c40d538978ee7600df28c907ed339ee3
Author: Sérgio M. Basto <sergio(a)serjux.com>
Date: Thu Mar 19 01:36:37 2020 +0000
Fixes_for_kernel 5.6 from
https://build.opensuse.org/package/show/Virtualization/virtualbox
Temporary hack to try to fix upgrade path.
VirtualBox.spec | 16 +++++++-
fixes_for_5.6.patch | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 121 insertions(+), 1 deletion(-)
---
diff --git a/VirtualBox.spec b/VirtualBox.spec
index 0f21cdf..4ee4c2f 100644
--- a/VirtualBox.spec
+++ b/VirtualBox.spec
@@ -46,7 +46,7 @@
Name: VirtualBox
Version: 6.1.4
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: A general-purpose full virtualizer for PC hardware
License: GPLv2 or (GPLv2 and CDDL)
@@ -91,6 +91,7 @@ Patch61:
0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch
Patch70: vbox-python-detection.diff
Patch80: VirtualBox-6.1.4-hacks.patch
+Patch81: fixes_for_5.6.patch
BuildRequires: kBuild >= 0.1.9998.r3093
BuildRequires: SDL-devel
@@ -140,6 +141,8 @@ BuildRequires: device-mapper-devel
BuildRequires: libvpx-devel
BuildRequires: makeself
BuildRequires: opus-devel
+#For fixrom.pl
+BuildRequires: perl-interpreter
# for 32bit on 64
%ifarch x86_64
@@ -201,6 +204,10 @@ Obsoletes: python2-%{name}%{?isa} < %{version}-%{release}
%if ! %{with python3}
Obsoletes: python%{python3_pkgversion}-%{name}%{?isa} < %{version}-%{release}
%endif
+# temporary hack
+# if virtualbox-guest-additions 6.1.2 still in repos, we try remove it to allow
+# install VirtualBox-server 6.1.4
+Obsoletes: virtualbox-guest-additions < 6.1.4-1
%description server
%{name} without Qt GUI part.
@@ -333,6 +340,7 @@ rm -r src/libs/zlib-1.2.*/
%patch61 -p1 -b .automount
%patch70 -p1 -b .python-detection
%patch80 -p1 -b .hack
+%patch81 -p1 -b .kernel5.6
%build
./configure --disable-kmods \
@@ -873,6 +881,12 @@ getent passwd vboxadd >/dev/null || \
%{_datadir}/%{name}-kmod-%{version}
%changelog
+* Thu Mar 19 2020 Sérgio Basto <sergio(a)serjux.com> - 6.1.4-3
+- Fixes_for_kernel 5.6 from
+
https://build.opensuse.org/package/show/Virtualization/virtualbox
+ but breaks build on epel 7
+- Temporary hack to try to fix upgrade path.
+
* Fri Feb 21 2020 Sérgio Basto <sergio(a)serjux.com> - 6.1.4-2
- Add a hack to fix builds on Rawhide/F32
diff --git a/fixes_for_5.6.patch b/fixes_for_5.6.patch
new file mode 100644
index 0000000..545a36b
--- /dev/null
+++ b/fixes_for_5.6.patch
@@ -0,0 +1,106 @@
+Index: VirtualBox-6.1.2/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
+===================================================================
+--- VirtualBox-6.1.2.orig/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
++++ VirtualBox-6.1.2/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
+@@ -843,9 +843,13 @@ DECLHIDDEN(int) vboxPciOsDevMapRegion(PV
+ if (!rcLnx)
+ {
+ /* For now no caching, try to optimize later. */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++ RTR0PTR R0PtrMapping = ioremap(pci_resource_start(pPciDev, iRegion),
++ pci_resource_len(pPciDev, iRegion));
++#else
+ RTR0PTR R0PtrMapping = ioremap_nocache(pci_resource_start(pPciDev,
iRegion),
+ pci_resource_len(pPciDev, iRegion));
+-
++#endif
+ if (R0PtrMapping != NIL_RTR0PTR)
+ pIns->aRegionR0Mapping[iRegion] = R0PtrMapping;
+ else
+Index: VirtualBox-6.1.2/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+===================================================================
+--- VirtualBox-6.1.2.orig/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
++++ VirtualBox-6.1.2/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+@@ -1461,9 +1461,13 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKerne
+ * MMIO / physical memory.
+ */
+ Assert(pMemLnxToMap->Core.enmType == RTR0MEMOBJTYPE_PHYS &&
!pMemLnxToMap->Core.u.Phys.fAllocated);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++ pMemLnx->Core.pv = ioremap(pMemLnxToMap->Core.u.Phys.PhysBase + offSub,
cbSub);
++#else
+ pMemLnx->Core.pv = pMemLnxToMap->Core.u.Phys.uCachePolicy ==
RTMEM_CACHE_POLICY_MMIO
+ ? ioremap_nocache(pMemLnxToMap->Core.u.Phys.PhysBase +
offSub, cbSub)
+ : ioremap(pMemLnxToMap->Core.u.Phys.PhysBase + offSub,
cbSub);
++#endif
+ if (pMemLnx->Core.pv)
+ {
+ /** @todo fix protection. */
+Index: VirtualBox-6.1.2/include/iprt/time.h
+===================================================================
+--- VirtualBox-6.1.2.orig/include/iprt/time.h
++++ VirtualBox-6.1.2/include/iprt/time.h
+@@ -32,6 +32,24 @@
+ #include <iprt/cdefs.h>
+ #include <iprt/types.h>
+ #include <iprt/assertcompile.h>
++#ifdef __KERNEL__
++/* This header is used for both kernel- and user-space code. Beginning
++ * with v5.6.0-rc3 as part of the Y2038 conversion, several of the
++ * time handling macros were hidden. Thus, user- and kernel-space
++ * names are different.
++ */
++#include <linux/time_types.h>
++#include <linux/version.h>
++#include <linux/time64.h>
++#include <linux/ktime.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++#define timespec __kernel_old_timespec
++#define ktime_get_ts ktime_get_ts64
++#undef time_t
++#define time_t ktime_t
++#define timeval __kernel_old_timeval
++#endif /* kernel version >= 5.6.0 */
++#endif /* __KERNEL__ */
+
+ RT_C_DECLS_BEGIN
+
+@@ -433,12 +451,6 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTim
+ }
+
+
+-# ifdef _LINUX_TIME64_H
+-DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTimespec64(PRTTIMESPEC pTime, const struct
timespec64 *pTimeval)
+-{
+- return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec),
pTimeval->tv_nsec);
+-}
+-# endif
+ #endif /* various ways of detecting struct timespec */
+
+
+Index: VirtualBox-6.1.2/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
+===================================================================
+--- VirtualBox-6.1.2.orig/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
++++ VirtualBox-6.1.2/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
+@@ -35,6 +35,10 @@
+ #include <iprt/asm.h>
+
+
++DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTimespec64(PRTTIMESPEC pTime, const struct
timespec64 *pTimeval)
++{
++ return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec),
pTimeval->tv_nsec);
++}
+
+ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
+ {
+@@ -43,7 +47,11 @@ DECLINLINE(uint64_t) rtTimeGetSystemNano
+ * Use ktime_get_ts, this is also what clock_gettime(CLOCK_MONOTONIC,) is using.
+ */
+ uint64_t u64;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++ struct timespec64 Ts;
++#else
+ struct timespec Ts;
++#endif
+ ktime_get_ts(&Ts);
+ u64 = Ts.tv_sec * RT_NS_1SEC_64 + Ts.tv_nsec;
+ return u64;