APPLIED: [UNSTABLE][PATCH] UBUNTU: [Packaging] Support skipped dkms modules
Andrea Righi
andrea.righi at canonical.com
Thu Oct 20 06:28:18 UTC 2022
On Wed, Oct 19, 2022 at 05:03:06PM +0100, Dimitri John Ledkov wrote:
> 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 at canonical.com>
This looks very useful to me. Applied to kinetic/linux-unstable.
Thanks,
-Andrea
> ---
> debian/rules.d/2-binary-arch.mk | 3 ++-
> debian/scripts/dkms-build | 5 ++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index eb3acba7d7..46cf3499bc 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -66,7 +66,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 =
> @@ -604,6 +604,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)-$*
> diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build
> index 67566a47df..6690322476 100755
> --- a/debian/scripts/dkms-build
> +++ b/debian/scripts/dkms-build
> @@ -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"
> --
> 2.34.1
>
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
More information about the kernel-team
mailing list