@@ -112,10 +112,6 @@ endif
# Either tools package needs the common source preparation
do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
-# Versions of dkms packages.
-dkms_zfs_linux_version=$(shell gawk '/^zfs-linux / { print $$2; }' debian/dkms-versions)
-dkms_v4l2loopback_version=$(shell gawk '/^v4l2loopback / { print $$2; }' debian/dkms-versions)
-
# NVIDIA DKMS package gross series split into desktop and server.
nvidia_desktop_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*\) .*/\1/p' debian/dkms-versions)
nvidia_server_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*-server\) .*/\1/p' debian/dkms-versions)
@@ -285,3 +285,11 @@ custom_override = \
# selftests that Ubuntu cares about
ubuntu_selftests = breakpoints cpu-hotplug efivarfs memfd memory-hotplug mount net ptrace seccomp timers powerpc user ftrace
+
+# DKMS
+_all_dkms_versions = $(shell gawk '{ print $$1 ":" $$2 }' debian/dkms-versions)
+dkms_srcpkg_to_module = $(if $(filter zfs-linux,$(1)),zfs,$(1))
+$(foreach _v,$(_all_dkms_versions),$(eval dkms_$(call dkms_srcpkg_to_module,$(firstword $(subst :, ,$(_v))))_version = $(word 2,$(subst :, ,$(_v)))))
+all_dkms_modules = $(foreach _v,$(_all_dkms_versions),$(call dkms_srcpkg_to_module,$(firstword $(subst :, ,$(_v)))))
+dkms_v4l2loopback_deb_path = pool/universe/v/v4l2loopback/v4l2loopback-dkms_$(dkms_v4l2loopback_version)_all.deb
+dkms_zfs_deb_path = pool/universe/z/zfs-linux/zfs-dkms_$(dkms_zfs_version)_all.deb
@@ -117,8 +117,8 @@ $(stampdir)/stamp-install-%: MODSECKEY=$(builddir)/build-$*/certs/signing_key.pe
$(stampdir)/stamp-install-%: MODPUBKEY=$(builddir)/build-$*/certs/signing_key.x509
$(stampdir)/stamp-install-%: build_dir=$(builddir)/build-$*
$(stampdir)/stamp-install-%: dkms_dir=$(call dkms_dir_prefix,$(builddir)/build-$*)
-$(stampdir)/stamp-install-%: enable_zfs = $(call custom_override,do_zfs,$*)
-$(stampdir)/stamp-install-%: enable_v4l2loopback = $(call custom_override,do_v4l2loopback,$*)
+$(foreach _m,$(all_dkms_modules), \
+ $(eval $$(stampdir)/stamp-install-%: enable_$(_m) = $$(call custom_override,do_$(_m),$$*)))
$(stampdir)/stamp-install-%: dbgpkgdir_dkms = $(if $(filter true,$(skipdbg)),"",$(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/kernel)
$(stampdir)/stamp-install-%: $(stampdir)/stamp-build-% $(stampdir)/stamp-install-headers
@echo Debug: $@ kernel_file $(kernel_file) kernfile $(kernfile) install_file $(install_file) instfile $(instfile)
@@ -412,8 +412,7 @@ endif
install -d $(dkms_dir) $(dkms_dir)/headers $(dkms_dir)/build $(dkms_dir)/source
cp -rp "$(hdrdir)" "$(indep_hdrdir)" "$(dkms_dir)/headers"
- $(if $(filter true,$(enable_zfs)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, $(dbgpkgdir_dkms), zfs, pool/universe/z/zfs-linux/zfs-dkms_$(dkms_zfs_linux_version)_all.deb))
- $(if $(filter true,$(enable_v4l2loopback)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, $(dbgpkgdir_dkms), v4l2loopback, pool/universe/v/v4l2loopback/v4l2loopback-dkms_$(dkms_v4l2loopback_version)_all.deb))
+ $(foreach _m,$(all_dkms_modules),$(if $(filter true,$(enable_$(_m))),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, $(dbgpkgdir_dkms),$(_m),$(dkms_$(_m)_deb_path))))
ifneq ($(skipdbg),true)