From 2468c1ec900c849d1f41a4a2c9ec15b6a987a95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 28 Mar 2024 05:55:22 +0100 Subject: [PATCH] Skip building v4l2loopback dkms module on qubes kernel Qubes kernel already include v4l2loopback module by default, and it's usually newer version (or at least compatible with that kernel). Skip building the dkms module in that case. Since dkms doesn't have a setting to skip building on some specific version, try to exclude qubes kernels by a heuristic - looking for CONFIG_IKCONFIG. Usually distribution kernels have it disabled (especially Debian and Fedora kernels have) while Qubes has it enabled. This should still make the dkms module build for in-vm kernel. The guard on the running kernel may look a bit weird, but an additional safeguard if somebody want to build it for their in-vm kernel even if it has CONFIG_IKCONFIG enabled (maybe a different distribution? or a custom build?). While dkms will attempt to build for all installed kernels, the dom0-provided kernel source tree is available only when running dom0-provided kernel, so that `uname -r` call is valid. --- Makefile | 1 + rpm_spec/qubes-video-companion.spec.in | 1 + scripts/dkms-skip.conf | 9 +++++++++ 3 files changed, 11 insertions(+) create mode 100644 scripts/dkms-skip.conf diff --git a/Makefile b/Makefile index 7d17248..bb074f1 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ install-vm: install-both echo 'wait-for-session=1' > $(DESTDIR)$(SYSCONFDIR)/qubes/rpc-config/qvc.ScreenShare $(INSTALL_DIR) $(DESTDIR)$(DATADIR)/$(PKGNAME)/scripts $(INSTALL_DATA) scripts/webcam.html $(DESTDIR)$(DATADIR)/$(PKGNAME)/scripts + $(INSTALL_DATA) scripts/dkms-skip.conf $(DESTDIR)$(SYSCONFDIR)/dkms/v4l2loopback.conf $(INSTALL_DIR) $(DESTDIR)$(DATADIR)/$(PKGNAME)/scripts/v4l2loopback $(MAKE) -C doc install diff --git a/rpm_spec/qubes-video-companion.spec.in b/rpm_spec/qubes-video-companion.spec.in index 523a3ef..c7c925b 100644 --- a/rpm_spec/qubes-video-companion.spec.in +++ b/rpm_spec/qubes-video-companion.spec.in @@ -95,6 +95,7 @@ resolutions at 30 or more frames per second. This package contains the video-receiving portion of Qubes Video Companion. %files receiver +%{_sysconfdir}/dkms/v4l2loopback.conf %{_mandir}/man1/qubes-video-companion.1.gz %{_bindir}/qubes-video-companion %{_datadir}/qubes-video-companion/receiver/setup.sh diff --git a/scripts/dkms-skip.conf b/scripts/dkms-skip.conf new file mode 100644 index 0000000..6ae923c --- /dev/null +++ b/scripts/dkms-skip.conf @@ -0,0 +1,9 @@ +# Skip building for dom0-provided kernel (or rather: only build for standard +# distribution kernel) if the v4l2loopback module is already included +if uname -r | grep -q qubes && modinfo -n v4l2loopback >/dev/null; then + # there is only an option for possitive kernel selection, not negative, so + # express "skip on qubes kernel" as "build on debian/fedora kernel" by + # using config differences - qubes has CONFIG_IKCONFIG enabled, while + # others have it disabled + BUILD_EXCLUSIVE_CONFIG="!CONFIG_IKCONFIG" +fi