[MANTIC][NOBLE][UNSTABLE][PATCH] UBUNTU: [Packaging] make ZSTD module compression conditional
Dimitri John Ledkov
dimitri.ledkov at canonical.com
Mon Nov 20 22:32:17 UTC 2023
Make ZSTD module compression conditional. Only enable it when building
on recent series, such that backports of v6.5 kernels to jammy keep
uncompressed modules, with zstd compressed .deb.
Fixes: b2638e9702 ("UBUNTU: [Packaging] ZSTD compress modules")
Ignore: yes
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
---
Fixup zstd module compression for easy backports to jammy.
If active changelog targets jammy the build is uncompressed .ko, compressed debs:
$ make -nf ./debian/rules binary 2>&1 | grep -e zstd -e dh_builddeb | grep linux-modules
dh_builddeb -plinux-modules-6.5.0-14-generic
dh_builddeb -plinux-modules-extra-6.5.0-14-generic; \
dh_builddeb -plinux-modules-ipu6-6.5.0-14-generic; dh_installchangelogs -plinux-modules-ivsc-6.5.0-14-generic
dh_builddeb -plinux-modules-ivsc-6.5.0-14-generic; dh_installchangelogs -plinux-modules-iwlwifi-6.5.0-14-generic
dh_builddeb -plinux-modules-iwlwifi-6.5.0-14-generic;
If active changelog is not jammy the build is compressed .ko, uncompressed debs:
$ make -nf ./debian/rules binary 2>&1 | grep -e zstd -e dh_builddeb | grep linux-modules
find debian/linux-modules-6.5.0-14-generic -name '*.ko' -print0 | xargs -0 -n1 -P 2 zstd -19 --quiet --rm
dh_builddeb -plinux-modules-6.5.0-14-generic -- -Znone
find debian/linux-modules-extra-6.5.0-14-generic -name '*.ko' -print0 | xargs -0 -n1 -P 2 zstd -19 --quiet --rm; \
dh_builddeb -plinux-modules-extra-6.5.0-14-generic -- -Znone; \
find debian/linux-modules-ipu6-6.5.0-14-generic -name '*.ko' -print0 | xargs -0 -n1 -P 2 zstd -19 --quiet --rm
dh_builddeb -plinux-modules-ipu6-6.5.0-14-generic -- -Znone; dh_installchangelogs -plinux-modules-ivsc-6.5.0-14-generic
find debian/linux-modules-ivsc-6.5.0-14-generic -name '*.ko' -print0 | xargs -0 -n1 -P 2 zstd -19 --quiet --rm
dh_builddeb -plinux-modules-ivsc-6.5.0-14-generic -- -Znone; dh_installchangelogs -plinux-modules-iwlwifi-6.5.0-14-generic
find debian/linux-modules-iwlwifi-6.5.0-14-generic -name '*.ko' -print0 | xargs -0 -n1 -P 2 zstd -19 --quiet --rm
dh_builddeb -plinux-modules-iwlwifi-6.5.0-14-generic -- -Znone;
Tested by producing both builds in cbd with both changelogs:
$ file *-build/amd64/linux-modules*.deb
jammy-build/amd64/linux-modules-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar.zs, data compression zst
jammy-build/amd64/linux-modules-extra-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar.zs, data compression zst
jammy-build/amd64/linux-modules-ipu6-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar.zs, data compression zst
jammy-build/amd64/linux-modules-ivsc-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar.zs, data compression zst
jammy-build/amd64/linux-modules-iwlwifi-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar.zs, data compression zst
$ less jammy-build/amd64/linux-modules*.deb | grep iwlwifi.ko
-rw-r--r-- root/root 1256145 2023-11-20 21:11 ./lib/modules/6.5.0-14-generic/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko
-rw-r--r-- root/root 1204353 2023-11-20 21:15 ./lib/modules/6.5.0-14-generic/ubuntu/iwlwifi/iwlwifi.ko
mantic-build/amd64/linux-modules-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar
mantic-build/amd64/linux-modules-extra-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar
mantic-build/amd64/linux-modules-ipu6-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar
mantic-build/amd64/linux-modules-ivsc-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar
mantic-build/amd64/linux-modules-iwlwifi-6.5.0-14-generic_6.5.0-14.14_amd64.deb: Debian binary package (format 2.0), with control.tar
$ less mantic-build/amd64/linux-modules*.deb | grep iwlwifi.ko
-rw-r--r-- root/root 248816 2023-11-20 21:12 ./lib/modules/6.5.0-14-generic/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko.zst
-rw-r--r-- root/root 235220 2023-11-20 21:15 ./lib/modules/6.5.0-14-generic/ubuntu/iwlwifi/iwlwifi.ko.zst
Mark commit as Ignore: yes, as it actually doesn't introduce any
changes to the end user in mantic+ kernels.
Once this is applied the previous revert of all zst compressed modules
applied in hwe-6.5 only, should be dropped upon rebase.
debian/rules.d/0-common-vars.mk | 6 ++++++
debian/rules.d/2-binary-arch.mk | 10 +++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index 410de315af..1dc77bcf78 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -199,6 +199,12 @@ do_dtbs=false
# FIPS check
do_fips_checks=false
+# ZSTD compressed kernel modules
+do_zstd_ko=true
+ifeq ($(series),jammy)
+do_zstd_ko=
+endif
+
# Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
#
# These 2 environment variables set the -j value of the kernel build. For example,
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 53fbb55c19..444564faea 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -567,8 +567,8 @@ define dh_all
dh_installchangelogs -p$(1)
dh_installdocs -p$(1)
dh_compress -p$(1)
- # Compress kernel modules
- find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) zstd -19 --quiet --rm
+ # Compress kernel modules, on mantic+
+ $(if $(do_zstd_ko),find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) zstd -19 --quiet --rm, true)
dh_fixperms -p$(1) -X/boot/
dh_shlibdeps -p$(1) $(shlibdeps_opts)
dh_installdeb -p$(1)
@@ -621,7 +621,7 @@ binary-%: checks-%
dh_testroot
$(call dh_all,$(pkgimg)) -- -Znone
- $(call dh_all,$(pkgimg_mods)) -- -Znone
+ $(call dh_all,$(pkgimg_mods))$(if $(do_zstd_ko), -- -Znone)
ifeq ($(do_extras_package),true)
ifeq ($(ship_extras_package),false)
@@ -633,13 +633,13 @@ ifeq ($(do_extras_package),true)
| tee -a $(target_flavour).not-shipped.log;
else
if [ -f $(DEBIAN)/control.d/$(target_flavour).inclusion-list ] ; then \
- $(call dh_all_inline,$(pkgimg_ex)) -- -Znone; \
+ $(call dh_all_inline,$(pkgimg_ex))$(if $(do_zstd_ko), -- -Znone); \
fi
endif
endif
$(foreach _m,$(all_standalone_dkms_modules), \
- $(if $(enable_$(_m)),$(call dh_all,$(dkms_$(_m)_pkg_name)-$*) -- -Znone;)\
+ $(if $(enable_$(_m)),$(call dh_all,$(dkms_$(_m)_pkg_name)-$*)$(if $(do_zstd_ko), -- -Znone);)\
)
$(call dh_all,$(pkgbldinfo))
--
2.34.1
More information about the kernel-team
mailing list