patched to fix for R0 module error (https://www.virtualbox.org/ticket/20904)

guest additions: updated with more systemd support and refactored subpackage names [release 6.1.34-2mamba;Tue May 17 2022]
This commit is contained in:
Silvan Calarco 2024-01-05 17:54:51 +01:00
parent 654a476ca1
commit a4cacfcc4a
9 changed files with 128 additions and 200 deletions

View File

@ -0,0 +1,18 @@
--- a/Config.kmk
+++ b/Config.kmk
@@ -4502,11 +4502,14 @@ ifeq ($(VBOX_LDR_FMT),elf)
TEMPLATE_VBoxR0_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBoxR0_CFLAGS = -fno-pie -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) \
$(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions \
- $(VBOX_GCC_fno-stack-protector) -fno-common $(VBOX_GCC_fvisibility-hidden) -std=gnu99 $(VBOX_GCC_IPRT_FMT_CHECK)
+ $(VBOX_GCC_fno-stack-protector) -fno-common -ffreestanding $(VBOX_GCC_fvisibility-hidden) -std=gnu99 $(VBOX_GCC_IPRT_FMT_CHECK)
TEMPLATE_VBoxR0_CXXFLAGS = -fno-pie -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) \
$(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions \
$(VBOX_GCC_fno-stack-protector) -fno-common $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) \
-fno-rtti $(VBOX_GCC_IPRT_FMT_CHECK)
+ if $(VBOX_GCC_VERSION_CC) >= 40500 # 4.1.2 complains, 4.5.2 is okay, didn't check which version inbetween made it okay with g++.
+TEMPLATE_VBoxR0_CXXFLAGS += -ffreestanding
+ endif
TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fasynchronous-unwind-tables -ffreestanding
TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fasynchronous-unwind-tables
TEMPLATE_VBoxR0_CXXFLAGS.freebsd = -ffreestanding

View File

@ -1,79 +0,0 @@
#! /bin/sh
#
# virtualbox: Starts the VirtualBox kernel module
#
# chkconfig: 35 30 60
# description: VirtualBox Linux kernel module
#
### BEGIN INIT INFO
# Provides: vboxdrv
# Required-Start: $syslog
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: VirtualBox Linux kernel module
# Should-Start: dkms
### END INIT INFO
. /etc/sysconfig/rc
. $rc_functions
NAME=virtualbox
LOCKFILE=/var/lock/subsys/$NAME
MODULE=vboxdrv
MODULE2=vboxnetflt
running() {
/sbin/lsmod | grep -q $MODULE[^_-]
}
case "$1" in
start)
# Check if it is already running
if ! running; then
echo -n $"Starting"" $NAME: "
/sbin/modprobe $MODULE
/sbin/modprobe $MODULE2
[ -e /proc/bus/usb/devices ] || mount -t usbfs usbfs /proc/bus/usb -o devgid=30,devmode=664
evaluate_retval
[ $? -eq 0 ] && touch $LOCKFILE
else
echo "$NAME "$"daemon is already running"
fi
echo
;;
stop)
echo -n $"Stopping"" $NAME: "
killall -q VBoxSVC VBoxXPCOMIPCD
if running; then
/sbin/modprobe -r $MODULE2
/sbin/modprobe -r $MODULE
evaluate_retval
[ $? -eq 0 ] && rm -f $LOCKFILE
else
echo "$NAME "$"daemon is already stopped"
fi
echo
;;
restart)
$0 stop
$0 start
;;
status)
if running; then
STATUS="loaded"
else
STATUS="not loaded"
fi
echo "$NAME kernel module is $STATUS."
;;
condrestart)
[ -e "$DAEMONLOCK" ] && $0 restart || :
;;
*)
echo $"Usage: ""/etc/init.d/$NAME {start|stop|restart|condrestart|status}"
exit 1
;;
esac
:

View File

@ -18,23 +18,27 @@
Name: VirtualBox
Version: 6.1.34
Release: 1mamba
Release: 2mamba
Summary: A general-purpose full virtualizer for x86 hardware
Group: Graphical Desktop/Applications/Utilities
Vendor: openmamba
Distribution: openmamba
Packager: Stefano Cotta Ramusino <stefano.cotta@openmamba.org>
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://www.virtualbox.org/
# 6.1.12: real source is 6.1.12a
Source0: http://download.virtualbox.org/virtualbox/%{version}/VirtualBox-%{version}.tar.bz2
Source1: %{name}-wrapper
Source2: %{name}-initscript
Source3: %{name}-desktop
Source4: http://download.virtualbox.org/virtualbox/%{version}/VBoxGuestAdditions_%{version}.iso
Source5: %{name}-modprobe
# git clone https://github.com/Thorsten-Sick/vdfuse.git
Source6: vdfuse-20140417git.tar.xz
Source7: VBox.png
Source10: vboxweb.service
Source11: vboxservice.service
Source12: vboxdrmclient.service
Source13: vboxdrmclient.path
Source14: vboxguest.rules
Source15: virtualbox-guest.sysusers
Patch0: %{name}-4.0.8-enable_ffmpeg_capture.patch
Patch1: %{name}-4.1.8-x86_64-disable_check_32bit.patch
Patch2: VirtualBox-4.3.12-gcc-4.9.patch
@ -49,6 +53,7 @@ Patch10: VirtualBox-5.2.30-x86-conflicting_type_ptrdiff_t.patch
Patch11: VirtualBox-6.0.14-vbox-cpuhotplug-build.patch
Patch12: VirtualBox-6.1.10-vboxweb-gsoap.patch
Patch13: VirtualBox-6.1.18-kernel-5.10.patch
Patch14: VirtualBox-6.1.34-ffreestanding.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
@ -69,10 +74,7 @@ BuildRequires: libopenssl-devel
BuildRequires: libopus-devel
BuildRequires: libpam-devel
BuildRequires: libpng-devel
BuildRequires: libpython27-devel
BuildRequires: libpython3-devel
BuildRequires: libpython36-devel
BuildRequires: libpython39-devel
BuildRequires: libstdc++6-devel
BuildRequires: libvncserver-devel
BuildRequires: libvpx-devel
@ -127,20 +129,24 @@ Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description web
A service which allows to control VirtualBox from the Web.
%package additions
%package guest
Summary: VirtualBox Guest additions
Group: Applications/Emulators
Provides: VirtualBox-additions
Obsoletes: VirtualBox-additions < 6.1.34-2mamba
%description additions
%description guest
VirtualBox Guest additions.
%package additions-VBoxGuest
%package guest-iso
Summary: VirtualBox Guest additions ISO image
Group: Applications/Emulators
Provides: virtualbox-additions-VBoxGuest
Obsoletes: virtualbox-additions-VBoxGuest < 6.1.18
Provides: VirtualBox-additions-VBoxGuest
Obsoletes: VirtualBox-additions-VBoxGuest < 6.1.34-2mamba
%description additions-VBoxGuest
%description guest-iso
VirtualBox Guest additions ISO image.
%package -n xorg-drv-video-vboxvideo
@ -168,23 +174,11 @@ Requires: xorg-server <= %{xorg_ver}.255
%description -n xorg-drv-input-vboxmouse
X.org mouse driver for VirtualBox guest machine.
#%package vboxguest
#Group: System/Kernel and Hardware
#Summary: Kernel DRM driver for VirtualBox guest machines
#Requires(post):dkms
#Requires(post):kernelheaders
#Requires(post):libelf-devel
#Provides: kernelvboxvideo
#Obsoletes: kernelvboxvideo
#
#%description vboxguest
#Kernel DRM driver for VirtualBox guest machines.
%debug_package
%prep
%setup -q -a6
#-D -T
#% setup -q -D -T
#:<< _EOF
%patch5 -p1
%patch7 -p1
@ -194,6 +188,7 @@ X.org mouse driver for VirtualBox guest machine.
%endif
#%patch12 -p1
#%patch13 -p1
%patch14 -p1 -b .ffreestanding
%ifarch %{ix86}
sed -i "s|VBOX_SUPPORTED_HOST_ARCHS := amd64|VBOX_SUPPORTED_HOST_ARCHS := x86|" Config.kmk
@ -244,8 +239,6 @@ export CXXFLAGS="%optflags"
--disable-java
%endif
# --disable-hardening \
#_EOF
. ./env.sh
@ -256,26 +249,6 @@ export KERN_DIR=/usr/src/linux-mamba-x86_64
export KERN_DIR=/usr/src/linux-mamba
%endif
kmk %{?_smp_mflags} CPPFLAGS="%{optflags} -fpermissive"
# EB_LD=ld.bfd
# || true
## workaround
#kmk VBOX_GCC_WERR= \
# VBOX_VERSION_STRING='$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)'_openmamba \
# VBOX_JAVA_HOME=%{_jvmdir}/jdk \
# EB_LD=ld.bfd || true
## files that needs editing before they can be included in the generic installer.
#sed "s|\%NOLSB\%|yes|g; \
# s|\%DEBIAN\%||g; \
# s|\%PACKAGE\%|virtualbox|g" src/VBox/Installer/linux/vboxballoon-service.sh.in > \
# src/VBox/Installer/linux/vboxballoon-service.sh
#sed "s|\%NOLSB\%|yes|g; \
# s|\%DEBIAN\%||g; \
# s|lfs-release|openmamba-release|g; \
# s|\%PACKAGE\%|virtualbox|g" src/VBox/Installer/linux/vboxweb-service.sh.in > \
# src/VBox/Installer/linux/vboxweb-service.sh
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
@ -317,16 +290,16 @@ cat > %{buildroot}%{_sysconfdir}/vbox/vbox.cfg << EOF
INSTALL_DIR="%{_libdir}/%{name}"
EOF
install -m 755 %{S:1} %{buildroot}%{_libdir}/%{name}/vbox-run.sh
install -m 755 %{SOURCE1} %{buildroot}%{_libdir}/%{name}/vbox-run.sh
install -d %{buildroot}%{_bindir} %{buildroot}%{_sbindir}
ln -s %{_libdir}/%{name}/vbox-run.sh %{buildroot}%{_bindir}/VirtualBox
ln -s %{_libdir}/%{name}/vbox-run.sh %{buildroot}%{_bindir}/VBoxManage
ln -s %{_libdir}/%{name}/vbox-run.sh %{buildroot}%{_bindir}/VBoxSDL
ln -s %{_libdir}/%{name}/vbox-run.sh %{buildroot}%{_bindir}/vditool
ln -s ../%{_lib}/%{name}/vbox-run.sh %{buildroot}%{_bindir}/VirtualBox
ln -s ../%{_lib}/%{name}/vbox-run.sh %{buildroot}%{_bindir}/VBoxManage
ln -s ../%{_lib}/%{name}/vbox-run.sh %{buildroot}%{_bindir}/VBoxSDL
ln -s ../%{_lib}/%{name}/vbox-run.sh %{buildroot}%{_bindir}/vditool
# vboxwebsrv
ln -s %{_libdir}/%{name}/vboxwebsrv %{buildroot}%{_bindir}/vboxwebsrv
install -D -m0755 src/VBox/Installer/linux/vboxweb-service.sh %{buildroot}%{_initrddir}/vboxweb-service
install -D -m0644 %{SOURCE10} %{buildroot}%{_unitdir}/vboxweb.service
#install -D -m0755 src/VBox/Installer/linux/vboxballoonctrl-service.sh.in %{buildroot}%{_initrddir}/vboxballoon-service
@ -343,9 +316,9 @@ SUBSYSTEM=="usb_device", ACTION=="remove", RUN="VBoxCreateUSBNode.sh --remove \$
SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN="VBoxCreateUSBNode.sh --remove \$major \$minor"
EOF
install -d -m0755 %{buildroot}/lib/udev/
install -d -m0755 %{buildroot}%{_prefix}/lib/udev/
mv %{buildroot}%{_libdir}/VirtualBox/VBoxCreateUSBNode.sh \
%{buildroot}/lib/udev/VBoxCreateUSBNode.sh
%{buildroot}%{_prefix}/lib/udev/VBoxCreateUSBNode.sh
%endif
# install icons
@ -366,14 +339,27 @@ rm -rf %{buildroot}%{_libdir}/%{name}/additions/src
rm -f %{buildroot}%{_libdir}/%{name}/tst*
#rm -f %{buildroot}%{_libdir}/%{name}/*.ko
rm -rf %{buildroot}%{_libdir}/%{name}/VBoxPython2_4.so
rm -rf %{buildroot}%{_libdir}/%{name}/VBoxPython2_6.so
rm -f %{buildroot}%{_libdir}/%{name}/VBoxPython2_*.so
rm -f %{buildroot}%{_libdir}/%{name}/VBoxPython3_6*.so
rm -f %{buildroot}%{_libdir}/%{name}/VBoxPython3_9.so
# install additions
#mv %{buildroot}%{_libdir}/%{name}/additions/VBoxOGL*.so %{buildroot}%{_libdir}/
cp src/VBox/Additions/linux/installer/vboxadd-service.sh %{buildroot}%{_initrddir}/vboxadd
#
# install guest additions
#
install -D -m0755 src/VBox/Additions/x11/Installer/98vboxadd-xclient \
%{buildroot}%{_sbindir}/VBoxClient-all
install -D -m0644 src/VBox/Additions/x11/Installer/vboxclient.desktop \
%{buildroot}%{_sysconfdir}/xdg/autostart/vboxclient.desktop
install -d -m 0755 %{buildroot}%{_sbindir}
mv %{buildroot}%{_libdir}/%{name}/additions/{VBoxService,VBoxClient,VBoxControl} %{buildroot}%{_sbindir}/
mv %{buildroot}%{_libdir}/%{name}/additions/{VBoxService,VBoxClient,VBoxDRMClient,VBoxControl} %{buildroot}%{_bindir}/
install -d -m 0755 %{buildroot}%{_libdir}/security
mv %{buildroot}%{_libdir}/%{name}/additions/pam_vbox.so %{buildroot}%{_libdir}/security/
install -D -m0644 %{SOURCE14} %{buildroot}%{_udevrulesdir}/60-vboxguest.rules
install -D -m0644 %{SOURCE13} %{buildroot}%{_unitdir}/vboxdrmclient.path
install -D -m0644 %{SOURCE12} %{buildroot}%{_unitdir}/vboxdrmclient.service
install -D -m0644 %{SOURCE11} %{buildroot}%{_unitdir}/vboxservice.service
install -D -m0644 %{SOURCE15} %{buildroot}%{_sysusersdir}/virtualbox-guest.conf
# install suspend configuration file to fix suspend/hibernate since 4.1.0
install -d -m0755 %{buildroot}%{_sysconfdir}/pm/config.d/
@ -386,20 +372,14 @@ cat > %{buildroot}%{_sysconfdir}/default/virtualbox << _EOF
VBOXWEB_USER=root
_EOF
#
# dkms
#
for p in vboxdrv vboxnetadp vboxnetflt; do
install -d -m0755 %{buildroot}%{_prefix}/src/${p}-%{version}
cp -a out/linux.%virtualbox_arch/release/bin/src/${p}/* %{buildroot}%{_prefix}/src/${p}-%{version}/
done
## dkms for vboxvideo
#install -d -m0755 %{buildroot}%{_prefix}/src/vboxvideo-%{version}
#cp -a out/linux.%virtualbox_arch/release/bin/additions/src/vboxvideo/* %{buildroot}%{_prefix}/src/vboxvideo-%{version}/
## dkms for vboxguest
#install -d -m0755 %{buildroot}%{_prefix}/src/vboxguest-%{version}
#cp -a out/linux.%virtualbox_arch/release/bin/additions/src/vboxguest/* %{buildroot}%{_prefix}/src/vboxguest-%{version}/
for p in vboxdrv; do
cat > %{buildroot}%{_prefix}/src/${p}-%{version}/dkms.conf << _EOF
@ -410,7 +390,6 @@ CLEAN="make -C \${kernel_source_dir} M=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE
BUILT_MODULE_NAME=${p}
BUILT_MODULE_LOCATION=./
DEST_MODULE_LOCATION=/kernel/drivers/virtualbox
REMAKE_INITRD=no
AUTOINSTALL=yes
_EOF
@ -426,7 +405,6 @@ CLEAN="make -C \${kernel_source_dir} M=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE
BUILT_MODULE_NAME=${p}
BUILT_MODULE_LOCATION=./
DEST_MODULE_LOCATION=/kernel/drivers/virtualbox
REMAKE_INITRD=no
AUTOINSTALL=yes
_EOF
@ -503,45 +481,17 @@ fi
:
%post web
%systemd_post vboxweb-service
%systemd_post vboxweb.service
:
%preun web
%systemd_preun vboxweb-service
%systemd_preun vboxweb.service
:
%postun web
%systed_postun_with_restart wboxweb-service
%systed_postun_with_restart wboxweb.service
:
#%preun vboxguest
## erase
#dkms remove -q -m vboxguest -v %{version} --all
#dkms remove -q -m vboxvideo -v %{version} --all
#:
#%post vboxguest
#dkms remove -q -m vboxguest -v 4.2.10 --all
#dkms remove -q -m vboxvideo -v 4.2.10 --all
#dkms remove -q -m vboxguest -v 4.2.12 --all
#dkms remove -q -m vboxvideo -v 4.2.12 --all
#dkms remove -q -m vboxguest -v 4.2.14 --all
#dkms remove -q -m vboxvideo -v 4.2.14 --all
#dkms remove -q -m vboxguest -v 4.2.16 --all
#dkms remove -q -m vboxvideo -v 4.2.16 --all
#dkms remove -q -m vboxguest -v 4.2.18 --all
#dkms remove -q -m vboxvideo -v 4.2.18 --all
#:
#%posttrans vboxguest
#if [ $1 -ge 1 ]; then
# dkms add -q -m vboxguest -v %{version}
# dkms add -q -m vboxvideo -v %{version}
# dkms install -q -m vboxguest -v %{version} --force
# dkms install -q -m vboxvideo -v %{version} --force
#fi
#:
%files
%defattr(-,root,root)
%config %{_sysconfdir}/vbox/vbox.cfg
@ -553,7 +503,7 @@ fi
%{_bindir}/VirtualBox
%{_bindir}/vditool
%{_udevrulesdir}/59-vboxdrv.rules
/lib/udev/VBoxCreateUSBNode.sh
%{_prefix}/lib/udev/VBoxCreateUSBNode.sh
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/DbgPlugInDiggers.so
%{_libdir}/%{name}/SUPInstall
@ -662,7 +612,7 @@ fi
%files web
%defattr(-,root,root)
%{_initrddir}/vboxweb-service
%{_unitdir}/vboxweb.service
%{_libdir}/VirtualBox/vboxwebsrv
%{_libdir}/VirtualBox/webtest
%{_bindir}/vboxwebsrv
@ -673,33 +623,33 @@ fi
#%{_libdir}/dri/vboxvideo_dri.so
#%{_libdir}/xorg/modules/drivers/vboxvideo_drv.so
%files additions
%files guest
%defattr(-,root,root)
%{_initrddir}/vboxadd
%{_libdir}/VirtualBox/additions/VBoxDRMClient
#%{_libdir}/VirtualBox/additions/VBoxEGL.so
#%{_libdir}/VBoxOGL*.so
%{_sbindir}/VBoxClient
%{_sbindir}/VBoxControl
%{_sbindir}/VBoxService
%{_sysconfdir}/xdg/autostart/vboxclient.desktop
%{_sbindir}/VBoxClient-all
%{_unitdir}/vboxservice.service
%{_unitdir}/vboxdrmclient.path
%{_unitdir}/vboxdrmclient.service
%{_sysusersdir}/virtualbox-guest.conf
%{_udevrulesdir}/60-vboxguest.rules
%{_libdir}/security/pam_vbox.so
%{_bindir}/VBoxClient
%{_bindir}/VBoxControl
%{_bindir}/VBoxDRMClient
%{_bindir}/VBoxService
%{_libdir}/%{name}/additions/autorun.sh
%{_libdir}/%{name}/additions/mount.vboxsf
%{_libdir}/%{name}/additions/pam_vbox.so
%{_libdir}/%{name}/additions/runasroot.sh
#%{_libdir}/%{name}/additions/vboxadd*
%files additions-VBoxGuest
%files guest-iso
%defattr(-,root,root)
%{_libdir}/%{name}/additions/VBoxGuestAdditions.iso
#%files vboxguest
#%defattr(-,root,root)
#%dir %{_prefix}/src/vboxguest-%{version}
#%{_prefix}/src/vboxguest-%{version}/*
#%dir %{_prefix}/src/vboxvideo-%{version}
#%{_prefix}/src/vboxvideo-%{version}/*
%changelog
* Tue May 17 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 6.1.34-2mamba
- patched to fix for R0 module error (https://www.virtualbox.org/ticket/20904)
- guest additions: updated with more systemd support and refactored subpackage names
* Thu Apr 21 2022 Automatic Build System <autodist@mambasoft.it> 6.1.34-1mamba
- automatic version update by autodist

6
vboxdrmclient.path Normal file
View File

@ -0,0 +1,6 @@
[Unit]
Description=VirtualBox Guest VMSVGA resize client
ConditionVirtualization=oracle
[Path]
PathExistsGlob=/dev/dri/renderD*

7
vboxdrmclient.service Normal file
View File

@ -0,0 +1,7 @@
[Unit]
Description=VirtualBox Guest VMSVGA resize client
ConditionVirtualization=oracle
ConditionPathExistsGlob=/dev/dri/renderD*
[Service]
ExecStart=/usr/bin/VBoxDRMClient

2
vboxguest.rules Normal file
View File

@ -0,0 +1,2 @@
ACTION=="add", KERNEL=="vboxguest", SUBSYSTEM=="misc", OWNER="root", MODE="0600"
ACTION=="add", KERNEL=="vboxuser", SUBSYSTEM=="misc", OWNER="root", MODE="0666"

13
vboxservice.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=VirtualBox Guest Service
ConditionVirtualization=oracle
Wants=vboxdrmclient.path
[Service]
ExecStartPre=-/usr/bin/modprobe vboxguest
ExecStartPre=-/usr/bin/modprobe vboxvideo
ExecStartPre=-/usr/bin/modprobe vboxsf
ExecStart=/usr/bin/VBoxService -f
[Install]
WantedBy=multi-user.target

11
vboxweb.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=VirtualBox Web Service
After=network.target
[Service]
Type=forking
PIDFile=/run/vboxweb.pid
ExecStart=/usr/bin/vboxwebsrv --pidfile /run/vboxweb.pid --background
[Install]
WantedBy=multi-user.target

View File