Skip to content

Commit

Permalink
Skip building v4l2loopback dkms module on qubes kernel
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marmarek committed Mar 28, 2024
1 parent 266e229 commit 2468c1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions rpm_spec/qubes-video-companion.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions scripts/dkms-skip.conf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2468c1e

Please sign in to comment.