diff mbox series

[MANTIC,3/3] UBUNTU: [Packaging] ZSTD compress modules

Message ID 20230726192453.986665-4-dimitri.ledkov@canonical.com
State New
Headers show
Series Enable zstd compressed modules | expand

Commit Message

Dimitri John Ledkov July 26, 2023, 7:24 p.m. UTC
Compress modules with zstd, this significantly reduced install-size of
the linux kernel, but also improves initrd creation time and boot
speed with the upcoming initramfs-tools changes.

Note that upstream modinst compression is not used. During our package
build time the modules are copied and processed multiple times. If
they are compressed during modinst time, it will mean they will all be
uncompressed, again, during processing. Separately 3rd-party module
signing performed by various tools relies on uncompressed modules as
well. For Zstd higher compression level is used.

BugLink: https://bugs.launchpad.net/bugs/2028568
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
 debian.master/control.stub.in   | 2 +-
 debian/rules.d/2-binary-arch.mk | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/debian.master/control.stub.in b/debian.master/control.stub.in
index 5256f05d09..85c17a177d 100644
--- a/debian.master/control.stub.in
+++ b/debian.master/control.stub.in
@@ -37,7 +37,7 @@  Build-Depends:
  libnuma-dev [amd64 arm64 ppc64el s390x] <!stage1>,
  dkms <!stage1>,
  curl <!stage1>,
- zstd [amd64 s390x] <!stage1>,
+ zstd <!stage1>,
  pahole [amd64 arm64 armhf ppc64el s390x riscv64] | dwarves (>= 1.21) [amd64 arm64 armhf ppc64el s390x riscv64] <!stage1>,
  rustc-1.62 [amd64],
  rust-1.62-src [amd64],
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index b90e26df1e..182ad2afa5 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -576,6 +576,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
 	dh_fixperms -p$(1) -X/boot/
 	dh_shlibdeps -p$(1) $(shlibdeps_opts)
 	dh_installdeb -p$(1)
@@ -628,7 +630,7 @@  binary-%: checks-%
 	dh_testroot
 
 	$(call dh_all,$(pkgimg)) -- -Znone
-	$(call dh_all,$(pkgimg_mods))
+	$(call dh_all,$(pkgimg_mods)) -- -Znone
 
 ifeq ($(do_extras_package),true)
   ifeq ($(ship_extras_package),false)
@@ -640,13 +642,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)); \
+		$(call dh_all_inline,$(pkgimg_ex)) -- -Znone; \
 	fi
   endif
 endif
 
 	$(foreach _m,$(all_standalone_dkms_modules), \
-	  $(if $(enable_$(_m)),$(call dh_all,$(dkms_$(_m)_pkg_name)-$*);)\
+	  $(if $(enable_$(_m)),$(call dh_all,$(dkms_$(_m)_pkg_name)-$*) -- -Znone;)\
 	)
 
 	$(call dh_all,$(pkgbldinfo))