From 8e5f6e5fb432902649bdc175beb8f67c3127b403 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 26 Jul 2023 20:24:53 +0100 Subject: [PATCH] UBUNTU: [Packaging] ZSTD compress modules 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 Signed-off-by: Andrea Righi --- debian.master/control.stub.in | 2 +- debian/rules.d/2-binary-arch.mk | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/debian.master/control.stub.in b/debian.master/control.stub.in index 8efedc6eb19a..b1b082edf4ee 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] , dkms , curl , - zstd [amd64 s390x] , + zstd , pahole [amd64 arm64 armhf ppc64el s390x riscv64] | dwarves (>= 1.21) [amd64 arm64 armhf ppc64el s390x riscv64] , rustc [amd64], rust-src [amd64], diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index b90e26df1e8d..182ad2afa554 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))