TT#45502 Patch vboxsf when building against Debian/buster fails

Updating to Virtualbox 5.2.18 is a requirement but not enough
yet to build against Debian/buster, as building its vboxsf is
failing:

| /tmp/vbox.0/utils.c: In function ‘sf_init_inode’:
| /tmp/vbox.0/utils.c:165:28: error: passing argument 1 of ‘sf_ftime_from_timespec’ from incompatible pointer type [-Werror=incompatible-pointer-types]
|      sf_ftime_from_timespec(&inode->i_atime, &info->AccessTime);
|                             ^
| /tmp/vbox.0/utils.c:53:13: note: expected ‘struct timespec *’ but argument is of type ‘struct timespec64 *’

Debian's virtualbox 5.2.18-dfsg-2 (which provides a working
virtualbox-guest-dkms) includes a fix to build against kernel 4.18,
see:

  https://tracker.debian.org/news/983571/accepted-virtualbox-5218-dfsg-2-source-into-unstable/

We don't use Debian's virtualbox-guest-dkms though. Instead let's
patch the sources until upstream provides an ISO which includes the
according change for compiling vboxsf against more recent kernel
versions.

I adapted the VirtualBox-kernel-4.18.patch, based on the relevant
change from Debian::

  b00c7b4d53/debian/patches/kernel-4.18.patch

NOTE: We need to patch the source after it was installed by
`/media/cdrom/VBoxLinuxAdditions.run --nox11`. If we'd invoke
`/media/cdrom/VBoxLinuxAdditions.run` again it would overwrite our
modified sources. Instead patch the source and directly invoke the
relevant steps to compile and install the module.

Change-Id: Iea86c07009838dea5b42af91cbfb0dc233179533
changes/89/24089/1
Michael Prokop 8 years ago
parent 924ccd0405
commit 805bfcbabb

@ -1788,6 +1788,26 @@ vagrant_configuration() {
tail -10 "${TARGET}/var/log/VBoxGuestAdditions.log"
umount "${TARGET}/media/cdrom/"
if [[ "$DEBIAN_RELEASE" == "buster" ]] && grep -q 'error: passing argument' "${TARGET}/var/log/vboxadd-setup.log"* ; then
echo "Applying Virtualbox workaround for buster and kernel >=4.18"
cat > "${TARGET}/tmp/vbox-kernel-fix.sh" << EOT
#!/bin/bash
set -e -o pipefail
cd /opt/VBoxGuestAdditions-5.2.18/src/vboxguest-5.2.18/vboxsf
wget --retry-connrefused --no-verbose -c "${SIPWISE_URL}/files/VirtualBox-kernel-4.18.patch"
if ! echo "c585cd24e078df9f458e493d412ce7e4cc9a581bf79ed50da4b2a570b366fff6 VirtualBox-kernel-4.18.patch" | sha256sum --check ; then
echo "Error: failed to compute checksum for Virtualbox patch. Exiting."
exit 1
fi
patch -p1 < VirtualBox-kernel-4.18.patch
make
make install
depmod -a
EOT
UTS_RELEASE=$KERNELVERSION LD_PRELOAD=/tmp/fake-uname.so grml-chroot "${TARGET}" /bin/bash /tmp/vbox-kernel-fix.sh
fi
# VBoxLinuxAdditions.run chooses /usr/lib64 as soon as this directory exists, which
# is the case for our PRO systems shipping the heartbeat-2 package; then the
# symlink /sbin/mount.vboxsf points to the non-existing /usr/lib64/VBoxGuestAdditions/mount.vboxsf

Loading…
Cancel
Save