]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
UBUNTU: [Packaging] Support skipped dkms modules
authorDimitri John Ledkov <dimitri.ledkov@canonical.com>
Mon, 27 Feb 2023 14:49:51 +0000 (14:49 +0000)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 14 Mar 2023 15:46:05 +0000 (16:46 +0100)
In recent releases we have fixed up most dkms modules to correctly
detect, and skip building dkms modules when compiling against
incompatible kernels. For example, trying to build a WiFi driver
against a kernel without 80221 config enabled, results in dkms
returning error code 9 skipped build, due to incompatibility. Our DKMS
autopkgtests already honor such cases, and mark test results as
passing for skipped {kernel, dkms-module} combinations.

Improve kernel's dkms-build script to distinguish failed versus
skipped builds, by propagating exact status code. For standalone
skipped dkms modules, skip generating an empty deb packages.

Also do not fail over missing make.log for the skipped dkms builds,
which do not have one.

This change will enable us to use a static list of dkms-versions
across all kernels, without need to do anything special for cases were
a vendored dkms module is declared incompatible in dkms.conf for a
given kernel.

For example, v4l2loopback incompatible with cloud kernels that do not
enable CONFIG_VIDEO, or backports-iwlwifi incompatible with kvm
kernel.

This patch is tested against working, skipepd, and FTBFS dkms modules,
which correctly built the full kernel, skipped some dkms modules, or
failed the overall build.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
debian/rules.d/2-binary-arch.mk
debian/scripts/dkms-build

index b91fb4bc424c54d5d8692bbda169117c3ff6be48..ff352617c96b5148a54ecf51bc6ee116b2f60686 100644 (file)
@@ -72,7 +72,7 @@ define build_dkms_sign =
        )
 endef
 define build_dkms =
-       ARCH=$(build_arch) CROSS_COMPILE=$(CROSS_COMPILE) $(SHELL) $(DROOT)/scripts/dkms-build $(dkms_dir) $(abi_release)-$* '$(call build_dkms_sign,$(builddir)/build-$*)' $(1) $(2) $(3) $(4) $(5)
+       rc=0; ARCH=$(build_arch) CROSS_COMPILE=$(CROSS_COMPILE) $(SHELL) $(DROOT)/scripts/dkms-build $(dkms_dir) $(abi_release)-$* '$(call build_dkms_sign,$(builddir)/build-$*)' $(1) $(2) $(3) $(4) $(5) || rc=$$?; if [ "$$rc" = "9" ]; then echo do_$(4)_$*=false >> $(builddir)/skipped-dkms.mk; rc=0; fi; if [ "$$rc" != "0" ]; then exit $$rc; fi
 endef
 
 define install_control =
@@ -607,6 +607,7 @@ endif
        $(call dh_all,linux-libc-dev)
 endif
 
+-include $(builddir)/skipped-dkms.mk
 binary-%: pkgimg = $(bin_pkg_name)-$*
 binary-%: pkgimg_mods = $(mods_pkg_name)-$*
 binary-%: pkgimg_ex = $(mods_extra_pkg_name)-$*
index 67566a47df9a676e0e76805413fefd247c7afcc1..6690322476cc47ff055206eee5445e5f98010b82 100755 (executable)
@@ -166,14 +166,13 @@ $fakeroot /usr/sbin/dkms build --no-prepare-kernel --no-clean-kernel \
        --sourcetree "$dkms_dir/source" \
        --dkmstree "$dkms_dir/build" \
        --kernelsourcedir "$dkms_dir/headers/linux-headers-$abi_flavour" \
-       "$dkms_conf" || rc=1
+       "$dkms_conf" || rc=$?
 
 # Find the log and add it to our own.
 for log in "$dkms_dir/build/$dkms_package/$dkms_version/$abi_flavour"/*/"log/make.log" "$dkms_dir/build/$dkms_package/$dkms_version/build/make.log"
 do
-       [ -f "$log" ] && break
+       [ -f "$log" ] && sed -e "s@$dkms_dir@<<DKMSDIR>>@g" <"$log"
 done
-sed -e "s@$dkms_dir@<<DKMSDIR>>@g" <"$log"
 
 # If this build failed then exit here.
 [ "$rc" != 0 ] && exit "$rc"