VirtualBox-OSE patches

Kevin Pouget kevin.pouget at agorabox.org
Fri Jun 26 15:31:18 CEST 2009


Dear list

Here are 3 files for the VirtualBox-OSE package :
 - 2 patches to fix the VirtualBox additions
 - One specfile for a new package : kmod-VirtualBox-OSE-guest.

At this time, the kernel modules (for both guest and host) are provided 
by the same package which makes very little sense :
- Unless your virtualize your own system, you only use either the host 
drivers or the guest drivers
- One drawback of the previous approach is that you have to install the 
full VirtualBox suite to be able to use the Guest Additions
So I splitted out the kernel modules into 2 parts.

The guest additions didn't work properly on my fresh install of Fedora 11.
Some of these proposed fixes come from the VirtualBox installer.

Here is the list of the changes :
- Removed VirtualBox-OSE-guest dependency on VirtualBox-OSE
- Split out kmodsrc and guest-kmodsrc
- Put proper X11 drivers for guests in proper directory
- Added HAL rule for mouse driver
- Added forgotten? VBoxRandR script
- Added autostart for guest additions
- Added udev rule for guest additions ACL
- Create xorg.conf at guest additions installation (required)

HTH
Regards

Kevin Pouget
-------------- next part --------------
--- a/VirtualBox-OSE.spec	2009-06-26 14:34:44.000000000 +0200
+++ b/VirtualBox-OSE.spec	2009-06-26 14:37:31.000000000 +0200
@@ -10,7 +10,7 @@
 
 Name:           VirtualBox-OSE
 Version:        2.2.4
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A general-purpose full virtualizer for PC hardware
 
 Group:          Development/Tools
@@ -66,8 +66,8 @@
 %package guest
 Summary:        %{name} Guest Additions
 Group:          System Environment/Base
-Requires:       %{name}-kmod = %{version}
-Provides:       %{name}-kmod-common = %{version}
+Requires:       %{name}-guest-kmod = %{version}
+Provides:       %{name}-guest-kmod-common = %{version}
 
 %description guest
 Tools that utilize kernel modules for supporting integration
@@ -85,10 +85,20 @@
 which is generated during the build of main package.
 
 
+%package guest-kmodsrc
+Summary:        %{name} Guest Additions kernel module source code
+Group:          System Environment/Kernel
+Requires:       xorg-x11-server-Xorg
+
+%description guest-kmodsrc
+Source tree used for building kernel module packages (%{name}-guest-kmod)
+which is generated during the build of main package.
+
+
 %package -n xorg-x11-drv-%{name}
 Summary:        X.org X11 %{name} video and mouse driver
 Group:          User Interface/X Hardware Support
-Requires:       xorg-x11-server-Xorg
+Requires:       xorg-x11-server-Xorg > 1.5.99 xorg-x11-server-Xorg < 1.6.99
 
 %description -n xorg-x11-drv-%{name}
 X.org X11 %{name} video and mouse driver.
@@ -194,10 +204,12 @@
         obj/bin/VBox.png
 
 # X.Org drivers
-install -m 0755 -D obj/bin/additions/vboxmouse_drv_71.so \
-        $RPM_BUILD_ROOT%{_libdir}/xorg/modules/drivers/vboxmouse_drv.so
-install -m 0755 -D obj/bin/additions/vboxvideo_drv_71.so \
+install -m 0755 -D obj/bin/additions/vboxmouse_drv_16.so \
+        $RPM_BUILD_ROOT%{_libdir}/xorg/modules/input/vboxmouse_drv.so
+install -m 0755 -D obj/bin/additions/vboxvideo_drv_16.so \
         $RPM_BUILD_ROOT%{_libdir}/xorg/modules/drivers/vboxvideo_drv.so
+install -m 0755 -D src/VBox/Additions/linux/installer/90-vboxguest.fdi \
+        $RPM_BUILD_ROOT%{_datadir}/hal/fdi/policy/20thirdparty/90-vboxguest.fdi
 
 # Guest Additions
 install -p -m 0755 -t $RPM_BUILD_ROOT%{_bindir} \
@@ -205,6 +217,12 @@
         obj/bin/additions/vboxadd-timesync      \
         obj/bin/additions/VBoxClient            \
         obj/bin/additions/VBoxControl
+install -m 0755 -D src/VBox/Additions/x11/Installer/VBoxRandR.sh \
+        $RPM_BUILD_ROOT%{_bindir}/VBoxRandR
+install -m 0755 -D src/VBox/Additions/x11/Installer/98vboxadd-xclient \
+        $RPM_BUILD_ROOT%{_bindir}/VBoxClient-all
+install -m 0755 -D src/VBox/Additions/x11/Installer/vboxclient.desktop \
+        $RPM_BUILD_ROOT/%{_sysconfdir}/xdg/autostart/vboxclient.desktop
 
 # Installation root configuration
 install -d $RPM_BUILD_ROOT/%{_sysconfdir}/vbox
@@ -219,11 +237,18 @@
 
 # Module Source Code
 mkdir -p %{name}-kmod-%{version}
-cp -al obj/bin/src/vbox* obj/bin/additions/src/vbox* %{name}-kmod-%{version}
+cp -al obj/bin/src/vbox* %{name}-kmod-%{version}
 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}-kmod-%{version}
 tar --use-compress-program lzma -cf $RPM_BUILD_ROOT%{_datadir}/%{name}-kmod-%{version}/%{name}-kmod-%{version}.tar.lzma \
         %{name}-kmod-%{version}
 
+# Guest Additions Module Source Code
+mkdir -p %{name}-guest-kmod-%{version}
+cp -al obj/bin/additions/src/vbox* %{name}-guest-kmod-%{version}
+install -d $RPM_BUILD_ROOT%{_datadir}/%{name}-guest-kmod-%{version}
+tar --use-compress-program lzma -cf $RPM_BUILD_ROOT%{_datadir}/%{name}-guest-kmod-%{version}/%{name}-guest-kmod-%{version}.tar.lzma \
+        %{name}-guest-kmod-%{version}
+
 # Menu entry
 desktop-file-install --dir=$RPM_BUILD_ROOT%{_datadir}/applications \
         --remove-key=DocPath --remove-category=X-MandrivaLinux-System \
@@ -260,6 +285,8 @@
                 $RPM_BUILD_ROOT%{_bindir}/*             \
                 $RPM_BUILD_ROOT%{_datadir}/{pixmaps,applications}/* \
                 -maxdepth 0 -type f                     \
+                -not -name VBoxRandR                    \
+                -not -name VBoxClient-all               \
                 -not -name VBox -exec basename '{}' \; |sort)
 set -o posix
 
@@ -268,6 +295,26 @@
 rm -rf $RPM_BUILD_ROOT
 
 
+%post guest
+# Let VBoxClient started as user to access to vboxadd device  
+/usr/sbin/useradd -d /var/run/vboxadd -g 1 -r -s /bin/sh vboxadd >/dev/null 2>&1
+/bin/echo "KERNEL==${udev_fix}\"vboxadd\", NAME=\"vboxadd\", OWNER=\"vboxadd\", MODE=\"0660\"" > /etc/udev/rules.d/60-vboxadd.rules
+/bin/echo "KERNEL==${udev_fix}\"vboxuser\", NAME=\"vboxuser\", OWNER=\"vboxadd\", MODE=\"0666\"" >> /etc/udev/rules.d/60-vboxadd.rules
+
+# VirtualBox guest additions still require xorg.conf...
+cp /etc/X11/xorg.conf /etc/X11/xorg.conf.vbox.bak >/dev/null 2>&1
+cat > /etc/X11/xorg.conf << EOF
+# Default xorg.conf for Xorg 1.5+ without PCI_TXT_IDS_PATH enabled.
+#
+# This file was created by VirtualBox Additions installer as it
+# was unable to find any existing configuration file for X.
+
+Section "Device"
+        Identifier      "VirtualBox Video Card"
+        Driver          "vboxvideo"
+EndSection
+EOF
+
 %files
 %defattr(-,root,root,-)
 %{_bindir}/VBox
@@ -297,7 +344,10 @@
 %{_bindir}/mountvboxsf
 %{_bindir}/vboxadd-timesync
 %{_bindir}/VBoxClient
+%{_bindir}/VBoxClient-all
 %{_bindir}/VBoxControl
+%{_bindir}/VBoxRandR
+%config %{_sysconfdir}/xdg/autostart/vboxclient.desktop
 %config %{_sysconfdir}/sysconfig/modules/%{name}-guest.modules
 %doc COPYING
 
@@ -307,12 +357,29 @@
 %{_datadir}/%{name}-kmod-%{version}
 
 
+%files guest-kmodsrc
+%defattr(-,root,root,-)
+%{_datadir}/%{name}-guest-kmod-%{version}
+
+
 %files -n xorg-x11-drv-%{name}
 %defattr(-,root,root,-)
-%{_libdir}/xorg/modules/drivers/*
+%{_libdir}/xorg/modules/drivers/vboxvideo_drv.so
+%{_libdir}/xorg/modules/input/vboxmouse_drv.so
+%{_datadir}/hal/fdi/policy/20thirdparty/90-vboxguest.fdi
 
 
 %changelog
+* Fri Jun 26 2009 Kevin Pouget <pouget at agorabox.org> - 2.2.4-2
+- Removed VirtualBox-OSE-guest dependency on VirtualBox-OSE
+- Split out kmodsrc and guest-kmodsrc
+- Put proper X11 drivers for guests in proper directory
+- Added HAL rule for mouse driver
+- Added forgotten VBoxRandR script
+- Added autostart for guest additions
+- Added udev rule for guest additions ACL
+- Create xorg.conf at guest additions installation (required)
+
 * Sun May 31 2009 Lubomir Rintel <lkundrak at v3.sk> - 2.2.4-1
 - New upstream release
 
-------------- next part --------------
# buildforkernels macro hint: when you build a new version or a new release
# that contains bugfixes or other improvements then you must disable the
# "buildforkernels newest" macro for just that build; immediately after
# queuing that build enable the macro again for subsequent builds; that way
# a new akmod package will only get build when a new one is actually needed
#define buildforkernels newest

Name:           VirtualBox-OSE-guest-kmod
Version:        2.2.4
Release:        1%{?dist}.1

Summary:        Kernel module for VirtualBox-OSE Guest Additions
Group:          System Environment/Kernel
License:        GPLv2 or CDDL
URL:            http://www.virtualbox.org/wiki/VirtualBox
# This filters out the XEN kernel, since we don't run on XEN
Source1:        VirtualBox-OSE-kmod-1.6.4-kernel-variants.txt
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%global AkmodsBuildRequires %{_bindir}/kmodtool, VirtualBox-OSE-guest-kmodsrc = %{version}
BuildRequires:  %{AkmodsBuildRequires}

Requires:       VirtualBox-OSE-guest = %{version}-%{release}

# needed for plague to make sure it builds for i586 and i686
ExclusiveArch:  i586 i686 x86_64

# get the proper build-sysbuild package from the repo, which
# tracks in all the kernel-devel packages
%{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} }

# kmodtool does its magic here
%{expand:%(kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} --filterfile %{SOURCE1} 2>/dev/null) }


%description
Kernel module for VirtualBox-OSE Guest Additions


%prep
%setup -T -c
tar --use-compress-program lzma -xf %{_datadir}/%{name}-%{version}/%{name}-%{version}.tar.lzma

# error out if there was something wrong with kmodtool
%{?kmodtool_check}

# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu}  --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} --filterfile %{SOURCE1} 2>/dev/null


for kernel_version in %{?kernel_versions} ; do
    cp -al %{name}-%{version} _kmod_build_${kernel_version%%___*}
done


%build
for kernel_version in %{?kernel_versions}; do
    for module in vbox{add,vfs}; do
        make VBOX_USE_INSERT_PAGE=1 %{?_smp_mflags} -C "${kernel_version##*___}" SUBDIRS="${PWD}/_kmod_build_${kernel_version%%___*}/${module}"  modules
    done
done


%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT

for kernel_version in %{?kernel_versions}; do
    install -d ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}
    install _kmod_build_${kernel_version%%___*}/*/*.ko ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}
done

%{?akmod_install}


%clean
rm -rf $RPM_BUILD_ROOT


%changelog
* Wed Jun 24 2009 kevin Pouget <pouget at agorabox.org> - 2.2.4-1.1
- Initial spec, split out from VirtualBox-OSE-kmod spec
-------------- next part --------------
--- a/VirtualBox-OSE-kmod.spec	2009-06-26 14:34:44.000000000 +0200
+++ b/VirtualBox-OSE-kmod.spec	2009-06-26 13:00:43.000000000 +0200
@@ -7,7 +7,7 @@
 
 Name:           VirtualBox-OSE-kmod
 Version:        2.2.4
-Release:        1%{?dist}.2
+Release:        1%{?dist}.3
 
 Summary:        Kernel module for VirtualBox-OSE
 Group:          System Environment/Kernel
@@ -55,7 +55,7 @@
 
 %build
 for kernel_version in %{?kernel_versions}; do
-    for module in vbox{drv,netflt,add,vfs}; do
+    for module in vbox{drv,netflt}; do
         make VBOX_USE_INSERT_PAGE=1 %{?_smp_mflags} -C "${kernel_version##*___}" SUBDIRS="${PWD}/_kmod_build_${kernel_version%%___*}/${module}"  modules
     done
 done
@@ -78,6 +78,9 @@
 
 
 %changelog
+* Fri Jun 26 2009 Kevin Pouget <pouget at agorabox.org> - 2.2.4-1.3
+- Split out VirtualBox-OSE kmod and VirtualBox-OSE guest additions kmod
+
 * Sun Jun 21 2009 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2.2.4-1.2
 - rebuild for new kernels
 


More information about the rpmfusion-developers mailing list