1
0
forked from pool/virtualbox

Accepting request 820027 from home:lwfinger:branches:Virtualization

- Switch to multibuild to so that we can maintain one spec file
  for both virtualbox and virtualbox-kmp and build them separately.
  (bsc#1114605)
  + Add file "_multibuild" to specify the additional "kmp" build
    flavor.
  + Merge "virtualbox-kmp.spec" into "virtualbox.spec"
  + Drop file "virtualbox-kmp.changes".

OBS-URL: https://build.opensuse.org/request/show/820027
OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=558
This commit is contained in:
Larry Finger 2020-07-10 18:39:52 +00:00 committed by Git OBS Bridge
parent 0995f0ac3e
commit 7f88b723de
9 changed files with 447 additions and 6864 deletions

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<flavor>kmp</flavor>
</multibuild>

View File

@ -205,8 +205,8 @@ Index: VirtualBox-6.1.10/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
size_t iPage;
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+ pVmArea = __get_vm_area_caller(cbAlloc, VM_ALLOC, MODULES_VADDR, MODULES_END,
+ __builtin_return_address(0));
+// pVmArea = __get_vm_area_caller(cbAlloc, VM_ALLOC, MODULES_VADDR, MODULES_END,
+// __builtin_return_address(0));
+#else
pVmArea = __get_vm_area(cbAlloc, VM_ALLOC, MODULES_VADDR, MODULES_END);
+#endif
@ -219,9 +219,9 @@ Index: VirtualBox-6.1.10/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
pVmArea->pages = papPages;
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+ unsigned long start = (unsigned long)pVmArea->addr;
+ unsigned long size = get_vm_area_size(pVmArea);
+// unsigned long size = get_vm_area_size(pVmArea);
+
+ if (!map_kernel_range(start, size, PAGE_KERNEL_EXEC, papPages))
+// if (!map_kernel_range(start, size, PAGE_KERNEL_EXEC, papPages))
+#else
if (!map_vm_area(pVmArea, PAGE_KERNEL_EXEC,
# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
@ -234,3 +234,16 @@ Index: VirtualBox-6.1.10/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
{
PRTMEMLNXHDREX pHdrEx = (PRTMEMLNXHDREX)pVmArea->addr;
pHdrEx->pVmArea = pVmArea;
Index: VirtualBox-6.1.10/src/VBox/Additions/linux/sharedfolders/vfsmod.c
===================================================================
--- VirtualBox-6.1.10.orig/src/VBox/Additions/linux/sharedfolders/vfsmod.c
+++ VirtualBox-6.1.10/src/VBox/Additions/linux/sharedfolders/vfsmod.c
@@ -53,7 +53,7 @@
#include <linux/seq_file.h>
#include <linux/vfs.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 62)
-# include <linux/vermagic.h>
+//# include <linux/vermagic.h>
#endif
#include <VBox/err.h>
#include <iprt/path.h>

View File

@ -6,7 +6,7 @@ Index: VirtualBox-6.1.0_RC1/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-lin
#define VBOXNETFLT_OS_SPECFIC 1
#include "../VBoxNetFltInternal.h"
+# if defined(CONFIG_SUSE_VERSION) & CONFIG_SUSE_VERSION == 15 && CONFIG_SUSE_PATCHLEVEL == 2
+# if defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 15 && CONFIG_SUSE_PATCHLEVEL == 2
+# define OPENSUSE_152
+# endif
+

View File

@ -791,5 +791,5 @@ Index: VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_drv.h
+#if defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 15 && CONFIG_SUSE_PATCHLEVEL == 1
+# define OPENSUSE_151
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) || defined(RHEL_71)
#if defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 12 && CONFIG_SUSE_PATCHLEVEL >= 4
# define SUSE_SLE12

185
fixes_for_sle12.patch Normal file
View File

@ -0,0 +1,185 @@
Index: VirtualBox-6.1.10/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h
===================================================================
--- VirtualBox-6.1.10.orig/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h
+++ VirtualBox-6.1.10/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h
@@ -49,7 +49,7 @@ typedef struct RTR0SEMLNXWAIT
{
/** The wait queue entry. */
#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 13, 0) \
- || defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 12 && CONFIG_SUSE_PATCHLEVEL == 4 \
+ || defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 12 && CONFIG_SUSE_PATCHLEVEL >= 4 \
|| defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 15
wait_queue_entry_t WaitQE;
#else
Index: VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_drv.c
===================================================================
--- VirtualBox-6.1.10.orig/src/VBox/Additions/linux/drm/vbox_drv.c
+++ VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_drv.c
@@ -327,7 +327,9 @@ static struct drm_driver driver = {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72)
# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) && !defined(RHEL_75) \
&& !defined(OPENSUSE_151)
+#if !(defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 12 && CONFIG_SUSE_PATCHLEVEL >= 4)
.set_busid = drm_pci_set_busid,
+#endif
# endif
#endif
Index: VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_main.c
===================================================================
--- VirtualBox-6.1.10.orig/src/VBox/Additions/linux/drm/vbox_main.c
+++ VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_main.c
@@ -606,11 +606,13 @@ int vbox_dumb_destroy(struct drm_file *f
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) && !defined(OPENSUSE_151) && !defined(RHEL_77) && !defined(RHEL_81)
+#if !(defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 12 && CONFIG_SUSE_PATCHLEVEL >= 4)
static void ttm_bo_put(struct ttm_buffer_object *bo)
{
ttm_bo_unref(&bo);
}
#endif
+#endif
void vbox_gem_free_object(struct drm_gem_object *obj)
{
Index: VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_ttm.c
===================================================================
--- VirtualBox-6.1.10.orig/src/VBox/Additions/linux/drm/vbox_ttm.c
+++ VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_ttm.c
@@ -211,7 +211,7 @@ static struct ttm_backend_func vbox_tt_b
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)) && !defined(RHEL_76) \
- && !defined(OPENSUSE_151)
+ && !defined(OPENSUSE_151) && !defined(SUSE_SLE12)
static struct ttm_tt *vbox_ttm_tt_create(struct ttm_bo_device *bdev,
unsigned long size,
u32 page_flags,
@@ -229,7 +229,7 @@ static struct ttm_tt *vbox_ttm_tt_create
tt->func = &vbox_tt_backend_func;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)) && !defined(RHEL_76) \
- && !defined(OPENSUSE_151)
+ && !defined(OPENSUSE_151) && !defined(SUSE_SLE12)
if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
#else
if (ttm_tt_init(tt, bo, page_flags)) {
@@ -243,7 +243,7 @@ static struct ttm_tt *vbox_ttm_tt_create
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76) \
- && !defined(OPENSUSE_151)
+ && !defined(OPENSUSE_151) && !defined(SUSE_SLE12)
static int vbox_ttm_tt_populate(struct ttm_tt *ttm)
{
return ttm_pool_populate(ttm);
@@ -278,7 +278,7 @@ static struct ttm_bo_driver vbox_bo_driv
.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)) && !defined(RHEL_76) \
- && !defined(OPENSUSE_151)
+ && !defined(OPENSUSE_151) && !defined(SUSE_SLE12)
.io_mem_pfn = ttm_bo_default_io_mem_pfn,
# endif
#endif
@@ -429,7 +429,7 @@ int vbox_bo_create(struct drm_device *de
ret = ttm_bo_init(&vbox->ttm.bdev, &vboxbo->bo, size,
ttm_bo_type_device, &vboxbo->placement,
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) && !defined(RHEL_76) \
- && !defined(OPENSUSE_151)
+ && !defined(OPENSUSE_151) && !defined(SUSE_SLE12)
align >> PAGE_SHIFT, false, NULL, acc_size,
#else
align >> PAGE_SHIFT, false, acc_size,
@@ -459,7 +459,7 @@ static inline u64 vbox_bo_gpu_offset(str
int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)) || defined(RHEL_76) \
- || defined(OPENSUSE_151)
+ || defined(OPENSUSE_151) || defined(SUSE_SLE12)
struct ttm_operation_ctx ctx = { false, false };
#endif
int i, ret;
@@ -478,7 +478,7 @@ int vbox_bo_pin(struct vbox_bo *bo, u32
PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76) \
- && !defined(OPENSUSE_151)
+ && !defined(OPENSUSE_151) && !defined(SUSE_SLE12)
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
#else
ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
@@ -497,7 +497,7 @@ int vbox_bo_pin(struct vbox_bo *bo, u32
int vbox_bo_unpin(struct vbox_bo *bo)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)) || defined(RHEL_76) \
- || defined(OPENSUSE_151)
+ || defined(OPENSUSE_151) || defined(SUSE_SLE12)
struct ttm_operation_ctx ctx = { false, false };
#endif
int i, ret;
@@ -514,7 +514,7 @@ int vbox_bo_unpin(struct vbox_bo *bo)
PLACEMENT_FLAGS(bo->placements[i]) &= ~TTM_PL_FLAG_NO_EVICT;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76) \
- && !defined(OPENSUSE_151)
+ && !defined(OPENSUSE_151) && !defined(SUSE_SLE12)
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
#else
ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
@@ -533,7 +533,7 @@ int vbox_bo_unpin(struct vbox_bo *bo)
int vbox_bo_push_sysram(struct vbox_bo *bo)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)) || defined(RHEL_76) \
- || defined(OPENSUSE_151)
+ || defined(OPENSUSE_151) || defined(SUSE_SLE12)
struct ttm_operation_ctx ctx = { false, false };
#endif
int i, ret;
@@ -555,7 +555,7 @@ int vbox_bo_push_sysram(struct vbox_bo *
PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)) && !defined(RHEL_76) \
- && !defined(OPENSUSE_151)
+ && !defined(OPENSUSE_151) && !defined(SUSE_SLE12)
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
#else
ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
Index: VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_drv.h
===================================================================
--- VirtualBox-6.1.10.orig/src/VBox/Additions/linux/drm/vbox_drv.h
+++ VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_drv.h
@@ -91,6 +91,9 @@
# define OPENSUSE_151
# endif
#endif
+#if defined(CONFIG_SUSE_VERSION) && CONFIG_SUSE_VERSION == 12 && CONFIG_SUSE_PATCHLEVEL >= 4
+# define SUSE_SLE12
+#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) || defined(RHEL_71)
#define U8_MAX ((u8)~0U)
Index: VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_mode.c
===================================================================
--- VirtualBox-6.1.10.orig/src/VBox/Additions/linux/drm/vbox_mode.c
+++ VirtualBox-6.1.10/src/VBox/Additions/linux/drm/vbox_mode.c
@@ -547,7 +547,8 @@ static void vbox_set_edid(struct drm_con
for (i = 0; i < EDID_SIZE - 1; ++i)
sum += edid[i];
edid[EDID_SIZE - 1] = (0x100 - (sum & 0xFF)) & 0xFF;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) || defined(RHEL_77) || defined(RHEL_81)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) || \
+ defined(SUSE_SLE12) || defined(RHEL_77) || defined(RHEL_81)
drm_connector_update_edid_property(connector, (struct edid *)edid);
#else
drm_mode_connector_update_edid_property(connector, (struct edid *)edid);
@@ -722,7 +723,7 @@ static int vbox_connector_init(struct dr
drm_connector_register(connector);
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) || defined(RHEL_77) || defined(RHEL_81)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || defined(OPENSUSE_151) || defined(SUSE_SLE12) || defined(RHEL_77) || defined(RHEL_81)
drm_connector_attach_encoder(connector, encoder);
#else
drm_mode_connector_attach_encoder(connector, encoder);

File diff suppressed because it is too large Load Diff

View File

@ -1,327 +0,0 @@
#
# spec file for package virtualbox-kmp
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: virtualbox-kmp
Version: 6.1.10
Release: 0
Summary: Kernel modules for VirtualBox
License: GPL-2.0-or-later
Group: System/Kernel
URL: http://www.virtualbox.org/
Source0: VirtualBox-%{version}-patched.tar.bz2
Source1: %{name}-files
Source2: %{name}-preamble
#rework init scripts to fit suse needs
Patch1: vbox-vboxdrv-init-script.diff
Patch2: vbox-vboxadd-init-script.diff
#fix build : "Error 4001 - String must be entirely alphanumeric"
#with renaming we probably break some macosx functionality however ths is just quick fix
#see thread : http://lists.freebsd.org/pipermail/freebsd-acpi/2010-October/006795.html
Patch6: vbox-smc-napa.diff
#fix build of Python and dev package on openSUSE 11.3
Patch8: vbox-python-detection.diff
#deprecated old-style C++ service proxies and objects,we have to use soapcpp2 -z1 flag
Patch9: vbox-deprec-gsoap-service-proxies.diff
#fix failed linking process during build - this patch is just quick workaround
Patch10: vbox-gsoapssl-deps.diff
#PATCH-FIX-OPENSUSE implement messagebox (VBoxPermissionMessage app), which is displayed, when user
#try to start VirtualBox and is not member of vboxusers group
Patch99: vbox-permissions_warning.diff
#PATCH-FIX-OPENSUSE Do not include build dates on binaries, makes build-compare happier
Patch100: vbox-no-build-dates.diff
Patch101: vbox-default-os-type.diff
# Disable the distributed versions of vboxdrv.sh and vboxadd.sh for security reasons.
Patch102: security_fixes.patch
#disable update in vbox gui
Patch103: vbox-disable-updates.diff
#use pie/fPIE for setuid binaries (bnc#743143)
Patch104: vbox-fpie.diff
#smap issues on Haswell or Broadwell (boo#931461)
Patch105: smap.diff
# Patch to build with Factory gcc5
Patch106: gcc5-real-support.patch
# Patch to build with gnu sed correctly
Patch107: virtualbox-sed-params.patch
# Patch to use snprintf correcty and not overflow dst buffer
Patch108: virtualbox-snpritnf-buffer-overflow.patch
# Patch to add code to explain USB Passthru
Patch109: vbox-usb-warning.diff
# Patch to ensure that VirtualBoxVM is SUID
Patch110: vbox-suid-warning.diff
# Fix symbol conflict between host and guest kmp
Patch111: fix_conflict_between_host_and_guest.patch
# Fix change in kernel API for ttm_bo_move_memcpy()
Patch112: modify_for_4_8_bo_move.patch
# Remove all mention of _smp_mflags
Patch113: vbox_remove_smp_mflags.patch
# Fix for missing include needed for server 1.19
Patch116: Fix_for_server_1.19.patch
# Fix invalid use of internal headers
Patch118: internal-headers.patch
# Fix rpmlint error for script /lib/usr/virtualbox/vboxshell.py
Patch120: fixes_for_python.patch
# Fix build for Qt 5.11
Patch122: fixes_for_Qt5.11.patch
# Switch to Python 3.4+
Patch123: switch_to_python3.4+.patch
# Use build parameters to control video driver problems
Patch125: remove_vbox_video_build.patch
# fix library search
Patch128: fix_lib_search.patch
# Fixes for modified kernel in Leap 42.3
Patch130: fixes_for_Leap42.3.patch
# Fixes for Qt5.13 on 32-bit systems
Patch132: fixes_for_qt5.13.patch
# Fixes for openSUSE Leap 15.2
Patch133: fixes_for_leap15.2.patch
# Fixes for kernel modules Makefile used at boot time
Patch134: fixes_for_makefile.patch
# Fix build for Qt 5.15
Patch135: fix-missing-includes-with-qt-5.15.patch
# Fix builds with GCC10
Patch136: fixes_for_gcc10.patch
# Fix for changes in GSOAP 2.8.103
Patch137: handle_gsoap_208103.patch
# Fixes for kernel 5.8
Patch138: fixes_for_5.8.patch
Patch999: virtualbox-fix-ui-background-color.patch
#
BuildRequires: %{kernel_module_package_buildreqs}
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: kbuild >= 0.1.9998svn3101
BuildRequires: libcap-devel
BuildRequires: libcurl-devel
BuildRequires: libopenssl-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt-tools
BuildRequires: module-init-tools
BuildRequires: pam-devel
BuildRequires: yasm
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%(sed -e '/^Provides: multiversion(kernel)/d' %{_libexecdir}/rpm/kernel-module-subpackage > %{_builddir}/virtualbox-kmp-template)
ExclusiveArch: x86_64
%kernel_module_package -t %{_builddir}/virtualbox-kmp-template -p %{SOURCE2} -n virtualbox -f %{SOURCE1} -x kdump um xen pae xenpae pv
Obsoletes: virtualbox-guest-kmp
Obsoletes: virtualbox-host-kmp
%description
This package contains the kernel-modules that VirtualBox uses to create or run virtual machines.
%prep
%setup -q -n VirtualBox-%{version}
%patch1 -p1
%patch2 -p1
%patch6 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch99 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch116 -p1
%patch118 -p1
%patch120 -p1
%patch122 -p1
%patch123 -p1
%patch125 -p1
%patch128 -p1
# Adjustments that are version dependent
%if 0%{?sle_version} == 120300 && 0%{?is_opensuse}
# Patch for Leap 42.3
%patch130 -p1
%endif
# Handle the 32-bit changes needed for Qt 5.13
%ifarch %ix86 && 0%{?qt5ver} >= 51300
%patch132 -p1
%endif
%patch133 -p1
%patch134 -p1
%patch135 -p1
%patch136 -p1
%patch137 -p1
%patch138 -p1
# make VB UI background colors look sane again
%patch999 -p1
#
##########################
####workaround kmk_sed --v
#instead of kmk_sed use /usr/bin/sed because of bug http://svn.netlabs.org/kbuild/ticket/112,
#but we have to create wrapper which will handle --append and --output options which are not provided by /usr/bin/sed
cat >> kmk_sed <<EOF
#!/bin/bash
while [ "\$#" != "0" ]; do
pass=\${pass}" \$1"
[ "\$1" == "-e" ] && shift && pass=\${pass}" '\$1'"
shift
done
eval "sed \$(echo "\$pass" | sed -e "s/--output=/>/g;s/--append=/>/g;s/--output/>/g;s/--append/>>/g");"
EOF
chmod +x ./kmk_sed
echo "SED = $RPM_BUILD_DIR/VirtualBox-%{version}/kmk_sed" >> LocalConfig.kmk
####workaround kmk_sed --^
##########################
#
# fix build of vboxvideo kernel module: replace relative drm include path with absolute include path
sed -i 's:include/drm:/usr/src/linux/include/drm:' src/VBox/Additions/linux/drm/Makefile.module.kms
%build
# Disable LTO - Link Time Optimization
%define _lto_cflags %{nil}
#ensure we don't ever use them
rm -rf src/libs/{libpng-*,libxml2-*,libxslt-*,zlib-*,boost-*}
# Craft LocalConfig.kmk
echo "
VBOX_GCC_OPT := %{optflags}
VBOX_GCC_WERR :=
VBOX_BUILD_PUBLISHER := _SUSE
VBOX_OSE := 1
VBOX_WITH_DOCS :=
VBOX_WITHOUT_LINUX_TEST_BUILDS := 1
VBOX_WITH_TESTCASES :=
SDK_VBOX_LIBXML2_DEFS := _REENTRANT
SDK_VBOX_LIBXML2_INCS := /usr/include/libxml2
SDK_VBOX_LIBXML2_LIBS := xml2
SDK_VBOX_OPENSSL_INCS :=
SDK_VBOX_OPENSSL_LIBS := ssl crypto
SDK_VBOX_BLD_OPENSSL_LIBS := ssl crypto
SDK_VBOX_LIBCURL_INCS :=
SDK_VBOX_LIBCURL_LIBS := curl
" > LocalConfig.kmk
COMMON_KMK_FLAGS="
KBUILD_VERBOSE=2 \
KBUILD_TARGET=linux \
BUILD_TARGET=linux \
"
# Architecture specific flags
%ifarch x86_64
COMMON_KMK_FLAGS+="
KBUILD_TARGET_ARCH=amd64 \
BUILD_TARGET_ARCH=amd64
"
%endif
# Build additions to export the source code of vbox{guest,sf,video} to
# out/linux.*/release/bin/additions/src/
%{_bindir}/kmk %_smp_mflags \
${COMMON_KMK_FLAGS} \
VBOX_WITH_X11_ADDITIONS= \
VBOX_ONLY_ADDITIONS=1
# The following kmk commands are used to extract the source of
# vbox{drv,netflt,netadp} without building the whole virtualbox
# program.
# 1. build src/bldprogs/ to get bin2c and VBoxTpG
%{_bindir}/kmk %_smp_mflags -C src/bldprogs/ \
${COMMON_KMK_FLAGS} \
VBOX_ONLY_EXTPACKS=1
# 2. build src/VBox/HostDrivers/ with VBOX_ONLY_EXTPACKS=1 to
# get SUPR3.a for src/VBox/Runtime/
%{_bindir}/kmk %_smp_mflags -C src/VBox/HostDrivers/ \
${COMMON_KMK_FLAGS} \
VBOX_ONLY_EXTPACKS=1
# 3. build src/VBox/Runtime/ with VBOX_ONLY_BUILD=1 to get
# VBoxRt.so for src/VBox/HostDrivers/Support/
%{_bindir}/kmk %_smp_mflags -C src/VBox/Runtime/ \
${COMMON_KMK_FLAGS} \
VBOX_ONLY_BUILD=1
# 4. build src/VBox/HostDrivers/ to export the source of
# host kernel modules to out/linux.*/release/bin/src/
%{_bindir}/kmk %_smp_mflags -C src/VBox/HostDrivers/ \
${COMMON_KMK_FLAGS}
#
# build kernel modules for guest and host (check novel-kmp package as example)
# host modules : vboxdrv,vboxnetflt,vboxnetadp
# guest modules : vboxguest,vboxsf vboxvideo (for Leap 15.1 and older)
echo "build kernel modules"
for vbox_module in out/linux.*/release/bin/src/vbox{drv,netflt,netadp} \
out/linux.*/release/bin/additions/src/vbox{guest,sf,video}; do
#get the module name from path
module_name=$(basename "$vbox_module")
# go through the all flavors (desktop,default ...)
for flavor in %{flavors_to_build}; do
# delete old build dir for sure
rm -rf modules_build_dir/${module_name}_${flavor}
if [ "$module_name" = "vboxdrv" -o \
"$module_name" = "vboxguest" ] ; then
SYMBOLS=""
fi
# create build directory for specific flavor
mkdir -p modules_build_dir/$flavor
# copy sources which will be used to build vbox module in last step
cp -r $vbox_module/ modules_build_dir/$flavor/
# copy vboxdrv (for host) module symbols which are used by vboxnetflt and vboxnetadp km's:
if [ "$module_name" = "vboxnetflt" -o \
"$module_name" = "vboxnetadp" ] ; then
cp $PWD/modules_build_dir/$flavor/vboxdrv/Module.symvers \
$PWD/modules_build_dir/$flavor/$module_name
SYMBOLS="$PWD/modules_build_dir/$flavor/vboxdrv/Module.symvers"
fi
# copy vboxguest (for guest) module symbols which are used by vboxsf km:
if [ "$module_name" = "vboxsf" -o \
"$module_name" = "vboxvideo" ] ; then
cp $PWD/modules_build_dir/$flavor/vboxguest/Module.symvers \
$PWD/modules_build_dir/$flavor/$module_name
SYMBOLS="$PWD/modules_build_dir/$flavor/vboxguest/Module.symvers"
fi
# build the module for the specific flavor
make -j2 -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor %{?linux_make_arch} modules \
M=$PWD/modules_build_dir/$flavor/$module_name KBUILD_EXTRA_SYMBOLS="$SYMBOLS" V=1
done
done
%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=extra
#Keep the install process from calling mkinitrd. The VB kernel modules are not in initrd. bsc#1052428
export INITRD_IN_POSTTRANS=1
export KMP_NEEDS_MKINITRD=0
#to install modules we use here similar steps like in build phase, go through all the modules :
for module_name in vbox{drv,netflt,netadp,guest,sf,video}
do
#and through the all flavors
for flavor in %{flavors_to_build}; do
make -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor modules_install M=$PWD/modules_build_dir/$flavor/$module_name
done
done
%changelog

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Jul 10 01:38:55 UTC 2020 - Gary Ching-Pang Lin <glin@suse.com>
- Switch to multibuild to so that we can maintain one spec file
for both virtualbox and virtualbox-kmp and build them separately.
(bsc#1114605)
+ Add file "_multibuild" to specify the additional "kmp" build
flavor.
+ Merge "virtualbox-kmp.spec" into "virtualbox.spec"
+ Drop file "virtualbox-kmp.changes".
-------------------------------------------------------------------
Tue Jun 23 06:10:10 UTC 2020 - Gary Ching-Pang Lin <glin@suse.com>

View File

@ -16,6 +16,23 @@
#
%if "@BUILD_FLAVOR@" == "kmp"
### macros for virtualbox-kmp ###
%define main_package 0
%define kmp_package 1
%define name_suffix kmp
%define dash -
%define package_summary Kernel modules for VirtualBox
%define package_group System/Kernel
%else
### macros for virtualbox main package ###
%define main_package 1
%define kmp_package 0
%define package_summary VirtualBox is an Emulator
%define package_group System/Emulators/PC
%define qt5ver %(rpm -q --queryformat %%{version} libQt5Core5|perl -ne '/(\\d+)\\.(\\d+)\\.(\\d+)?/&&printf "%%d%%02d%%02d\\n",$1,$2,$3')
#Compat macro for new _fillupdir macro introduced in Nov 2017
@ -43,15 +60,17 @@ python3 -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile
# For the above reasons, limit the number of jobs to 2.
%define _smp_mflags -j2
%define _vbox_instdir %{_libexecdir}/virtualbox
%define _vbox_instdir %{_prefix}/lib/virtualbox
%define _udevrulesdir /usr/lib/udev/rules.d
Name: virtualbox
%endif
# ********* If the VB version exceeds 6.1.x, notify the libvirt maintainer!!
Name: virtualbox%{?dash}%{?name_suffix}
Version: 6.1.10
Release: 0
Summary: VirtualBox is an Emulator
Summary: %{package_summary}
License: GPL-2.0-or-later
Group: System/Emulators/PC
Group: %{package_group}
URL: http://www.virtualbox.org/
#
# so you don't need to repack virtualbox by hand, just add new release of VirtualBox-x.x.x.tar.bz2 and line below with
@ -63,12 +82,14 @@ Source1: UserManual.pdf
%if 0%{?sle_version} != 120300
Source2: VirtualBox.appdata.xml
%endif
Source3: %{name}-60-vboxguest.rules
Source4: %{name}-default.virtualbox
Source3: virtualbox-60-vboxguest.rules
Source4: virtualbox-default.virtualbox
Source5: virtualbox-kmp-files
Source7: virtualbox-kmp-preamble
Source8: update-extpack.sh
Source9: %{name}-wrapper.sh
Source10: %{name}-LocalConfig.kmk
Source11: %{name}-60-vboxdrv.rules
Source9: virtualbox-wrapper.sh
Source10: virtualbox-LocalConfig.kmk
Source11: virtualbox-60-vboxdrv.rules
Source14: vboxdrv.service
Source15: vboxadd-service.service
Source16: vboxconfig.sh
@ -81,8 +102,8 @@ Source22: vboxweb-service.sh
Source23: vboxautostart.service
Source24: vboxautostart.sh
Source97: README.build
Source98: %{name}-rpmlintrc
Source99: %{name}-patch-source.sh
Source98: virtualbox-rpmlintrc
Source99: virtualbox-patch-source.sh
#rework init scripts to fit suse needs
Patch1: vbox-vboxdrv-init-script.diff
Patch2: vbox-vboxadd-init-script.diff
@ -142,6 +163,8 @@ Patch125: remove_vbox_video_build.patch
Patch128: fix_lib_search.patch
# Fixes for modified kernel in Leap 42.3
Patch130: fixes_for_Leap42.3.patch
# Fixes for SLE12
Patch131: fixes_for_sle12.patch
# Fixes for Qt5.13 on 32-bit systems
Patch132: fixes_for_qt5.13.patch
# Fixes for openSUSE Leap 15.2
@ -158,6 +181,22 @@ Patch137: handle_gsoap_208103.patch
Patch138: fixes_for_5.8.patch
Patch999: virtualbox-fix-ui-background-color.patch
#
# Common BuildRequires for both virtualbox and virtualbox-kmp
BuildRequires: %{kernel_module_package_buildreqs}
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: kbuild >= 0.1.9998svn3101
BuildRequires: libcap-devel
BuildRequires: libcurl-devel
BuildRequires: libopenssl-devel
BuildRequires: libxslt-devel
BuildRequires: module-init-tools
BuildRequires: pam-devel
BuildRequires: yasm
### Requirements for virtualbox main package ###
%if %{main_package}
BuildRequires: LibVNCServer-devel
BuildRequires: SDL-devel
BuildRequires: acpica
@ -170,24 +209,16 @@ BuildRequires: libboost_headers-devel
%else
BuildRequires: boost-devel
%endif
BuildRequires: %{kernel_module_package_buildreqs}
BuildRequires: dev86
BuildRequires: device-mapper-devel
BuildRequires: dmidecode
BuildRequires: e2fsprogs-devel
BuildRequires: fdupes
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: glibc-devel-static
BuildRequires: gsoap-devel >= 2.8.50
BuildRequires: java-devel >= 1.6.0
BuildRequires: kbuild >= 0.1.9998svn3101
#BuildRequires: kernel-syms
BuildRequires: libcap-devel
BuildRequires: libcurl-devel
BuildRequires: libelf-devel
BuildRequires: libidl-devel
BuildRequires: libopenssl-devel
BuildRequires: libopus-devel
BuildRequires: libqt5-linguist
BuildRequires: libqt5-qtbase-devel
@ -195,8 +226,6 @@ BuildRequires: libqt5-qtx11extras-devel
BuildRequires: libvpx-devel
BuildRequires: libxslt-devel
BuildRequires: libzio-devel
BuildRequires: module-init-tools
BuildRequires: pam-devel
BuildRequires: pulseaudio-devel
BuildRequires: python3-devel
BuildRequires: sed
@ -205,7 +234,6 @@ BuildRequires: which
BuildRequires: xorg-x11
BuildRequires: xorg-x11-server
BuildRequires: xorg-x11-server-sdk
BuildRequires: yasm
BuildRequires: zlib-devel-static
BuildRequires: pkgconfig(fontsproto)
BuildRequires: pkgconfig(libpng)
@ -228,20 +256,6 @@ BuildRequires: pkgconfig(xineramaproto)
BuildRequires: pkgconfig(xmu)
BuildRequires: pkgconfig(xproto)
BuildRequires: pkgconfig(xrandr)
Requires: %{name}-kmp = %{version}
Requires(post): sysvinit(syslog)
Requires(pre): permissions
%if ! 0%{?suse_version} > 1325
Requires(pre): net-tools-deprecated
%endif
Requires(pre): shadow
Requires(pre): %fillup_prereq
Recommends: %{name}-gui = %{version}
#rename from ose version:
Provides: %{name}-ose = %{version}
Obsoletes: %{name}-ose < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: x86_64
%ifarch amd64 x86_64 ia32e em64t
BuildRequires: gcc-32bit
BuildRequires: gcc-c++-32bit
@ -254,7 +268,34 @@ BuildRequires: xorg-x11-libXt-devel-32bit
# package i4l-vbox from source package i4l-base shares the directory /etc/vbox
# with us, but with different owner.
Conflicts: i4l-vbox
Requires: %{name}-kmp = %{version}
Requires(post): sysvinit(syslog)
Requires(pre): permissions
%if ! 0%{?suse_version} > 1325
Requires(pre): net-tools-deprecated
%endif
Requires(pre): shadow
Requires(pre): %fillup_prereq
Recommends: %{name}-gui = %{version}
#rename from ose version:
Provides: %{name}-ose = %{version}
Obsoletes: %{name}-ose < %{version}
%endif # main_package
### Requirements for virtualbox-kmp ###
%if %{kmp_package}
BuildRequires: libxml2-devel
%(sed -e '/^Provides: multiversion(kernel)/d' %{_libexecdir}/rpm/kernel-module-subpackage > %{_builddir}/virtualbox-kmp-template)
%kernel_module_package -t %{_builddir}/virtualbox-kmp-template -p %{SOURCE7} -n virtualbox -f %{SOURCE5} -x kdump um xen pae xenpae pv
Obsoletes: virtualbox-guest-kmp
Obsoletes: virtualbox-host-kmp
%endif # kmp_package
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: x86_64
### Description and subpackages of virtualbox main package ###
%if %{main_package}
%description
VirtualBox is a hosted hypervisor for x86 computers. It supports the
creation and management of guest virtual machines running versions
@ -272,7 +313,7 @@ Requires(pre): permissions
Provides: %{name}-gui = %{version}
#this is needed during update to trigger installing qt subpackage
#http://en.opensuse.org/openSUSE:Upgrade_dependencies_explanation#Splitting_and_Merging
Provides: %{name}-ose:%{_libexecdir}/virtualbox/VirtualBox.so
Provides: %{name}-ose:%{_prefix}/lib/virtualbox/VirtualBox.so
#rename from "ose" version:
Provides: %{name}-ose-qt = %{version}
Obsoletes: %{name}-ose-qt < %{version}
@ -403,6 +444,13 @@ Virtual Network Computing (VNC) is a graphical desktop sharing system that uses
protocol (RFB) to remotely control another computer. When this optional feature is desired, it is installed
as an "extpack" for VirtualBox. The implementation is licensed under GPL.
###########################################
%endif # main_package
### Description of virtualbox-kmp ###
%if %{kmp_package}
%description
This package contains the kernel-modules that VirtualBox uses to create or run virtual machines.
%endif # kmp_package
%prep
%setup -q -n VirtualBox-%{version}
@ -439,6 +487,7 @@ as an "extpack" for VirtualBox. The implementation is licensed under GPL.
# Patch for Leap 42.3
%patch130 -p1
%endif
%patch131 -p1
# Handle the 32-bit changes needed for Qt 5.13
%ifarch %ix86 && 0%{?qt5ver} >= 51300
%patch132 -p1
@ -452,6 +501,8 @@ as an "extpack" for VirtualBox. The implementation is licensed under GPL.
# make VB UI background colors look sane again
%patch999 -p1
### Documents for virtualbox main package ###
%if %{main_package}
#copy user manual
cp %{SOURCE1} UserManual.pdf
#copy README.build
@ -460,6 +511,8 @@ cp %{SOURCE97} README.build
cp %{SOURCE10} LocalConfig.kmk
#copy autostart doc
cp %{SOURCE20} README.autostart
%endif # main_package
#
##########################
####workaround kmk_sed --v
@ -482,6 +535,8 @@ echo "SED = $RPM_BUILD_DIR/VirtualBox-%{version}/kmk_sed" >> LocalConfig.kmk
# fix build of vboxvideo kernel module: replace relative drm include path with absolute include path
sed -i 's:include/drm:/usr/src/linux/include/drm:' src/VBox/Additions/linux/drm/Makefile.module.kms
### %build, %install, and %file sections for virtualbox ###
%if %{main_package}
%build
# Disable LTO - Link Time Optimization
%define _lto_cflags %{nil}
@ -1026,4 +1081,140 @@ export DISABLE_RESTART_ON_UPDATE=yes
%dir %{_datadir}/licenses
%{_datadir}/licenses/LICENSE.vnc
%endif # main_package
### %build and %install sections of virtualbox-kmp ###
%if %{kmp_package}
%build
# Disable LTO - Link Time Optimization
%define _lto_cflags %{nil}
#ensure we don't ever use them
rm -rf src/libs/{libpng-*,libxml2-*,libxslt-*,zlib-*,boost-*}
# Craft LocalConfig.kmk
echo "
VBOX_GCC_OPT := %{optflags}
VBOX_GCC_WERR :=
VBOX_BUILD_PUBLISHER := _SUSE
VBOX_OSE := 1
VBOX_WITH_DOCS :=
VBOX_WITHOUT_LINUX_TEST_BUILDS := 1
VBOX_WITH_TESTCASES :=
SDK_VBOX_LIBXML2_DEFS := _REENTRANT
SDK_VBOX_LIBXML2_INCS := /usr/include/libxml2
SDK_VBOX_LIBXML2_LIBS := xml2
SDK_VBOX_OPENSSL_INCS :=
SDK_VBOX_OPENSSL_LIBS := ssl crypto
SDK_VBOX_BLD_OPENSSL_LIBS := ssl crypto
SDK_VBOX_LIBCURL_INCS :=
SDK_VBOX_LIBCURL_LIBS := curl
" > LocalConfig.kmk
COMMON_KMK_FLAGS="
KBUILD_VERBOSE=2 \
KBUILD_TARGET=linux \
BUILD_TARGET=linux \
"
# Architecture specific flags
%ifarch x86_64
COMMON_KMK_FLAGS+="
KBUILD_TARGET_ARCH=amd64 \
BUILD_TARGET_ARCH=amd64
"
%endif
# Build additions to export the source code of vbox{guest,sf,video} to
# out/linux.*/release/bin/additions/src/
%{_bindir}/kmk %_smp_mflags \
${COMMON_KMK_FLAGS} \
VBOX_WITH_X11_ADDITIONS= \
VBOX_ONLY_ADDITIONS=1
# The following kmk commands are used to extract the source of
# vbox{drv,netflt,netadp} without building the whole virtualbox
# program.
# 1. build src/bldprogs/ to get bin2c and VBoxTpG
%{_bindir}/kmk %_smp_mflags -C src/bldprogs/ \
${COMMON_KMK_FLAGS} \
VBOX_ONLY_EXTPACKS=1
# 2. build src/VBox/HostDrivers/ with VBOX_ONLY_EXTPACKS=1 to
# get SUPR3.a for src/VBox/Runtime/
%{_bindir}/kmk %_smp_mflags -C src/VBox/HostDrivers/ \
${COMMON_KMK_FLAGS} \
VBOX_ONLY_EXTPACKS=1
# 3. build src/VBox/Runtime/ with VBOX_ONLY_BUILD=1 to get
# VBoxRt.so for src/VBox/HostDrivers/Support/
%{_bindir}/kmk %_smp_mflags -C src/VBox/Runtime/ \
${COMMON_KMK_FLAGS} \
VBOX_ONLY_BUILD=1
# 4. build src/VBox/HostDrivers/ to export the source of
# host kernel modules to out/linux.*/release/bin/src/
%{_bindir}/kmk %_smp_mflags -C src/VBox/HostDrivers/ \
${COMMON_KMK_FLAGS}
#
# build kernel modules for guest and host (check novel-kmp package as example)
# host modules : vboxdrv,vboxnetflt,vboxnetadp
# guest modules : vboxguest,vboxsf vboxvideo (for Leap 15.1 and older)
echo "build kernel modules"
for vbox_module in out/linux.*/release/bin/src/vbox{drv,netflt,netadp} \
out/linux.*/release/bin/additions/src/vbox{guest,sf,video}; do
#get the module name from path
module_name=$(basename "$vbox_module")
# go through the all flavors (desktop,default ...)
for flavor in %{flavors_to_build}; do
# delete old build dir for sure
rm -rf modules_build_dir/${module_name}_${flavor}
if [ "$module_name" = "vboxdrv" -o \
"$module_name" = "vboxguest" ] ; then
SYMBOLS=""
fi
# create build directory for specific flavor
mkdir -p modules_build_dir/$flavor
# copy sources which will be used to build vbox module in last step
cp -r $vbox_module/ modules_build_dir/$flavor/
# copy vboxdrv (for host) module symbols which are used by vboxnetflt and vboxnetadp km's:
if [ "$module_name" = "vboxnetflt" -o \
"$module_name" = "vboxnetadp" ] ; then
cp $PWD/modules_build_dir/$flavor/vboxdrv/Module.symvers \
$PWD/modules_build_dir/$flavor/$module_name
SYMBOLS="$PWD/modules_build_dir/$flavor/vboxdrv/Module.symvers"
fi
# copy vboxguest (for guest) module symbols which are used by vboxsf km:
if [ "$module_name" = "vboxsf" -o \
"$module_name" = "vboxvideo" ] ; then
cp $PWD/modules_build_dir/$flavor/vboxguest/Module.symvers \
$PWD/modules_build_dir/$flavor/$module_name
SYMBOLS="$PWD/modules_build_dir/$flavor/vboxguest/Module.symvers"
fi
# build the module for the specific flavor
make -j2 -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor %{?linux_make_arch} modules \
M=$PWD/modules_build_dir/$flavor/$module_name KBUILD_EXTRA_SYMBOLS="$SYMBOLS" V=1
done
done
%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=extra
#Keep the install process from calling mkinitrd. The VB kernel modules are not in initrd. bsc#1052428
export INITRD_IN_POSTTRANS=1
export KMP_NEEDS_MKINITRD=0
#to install modules we use here similar steps like in build phase, go through all the modules :
for module_name in vbox{drv,netflt,netadp,guest,sf,video}
do
#and through the all flavors
for flavor in %{flavors_to_build}; do
make -C %{_prefix}/src/linux-obj/%{_target_cpu}/$flavor modules_install M=$PWD/modules_build_dir/$flavor/$module_name
done
done
%endif # kmp_package
%changelog