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 <dimitri.ledkov@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
Dimitri John Ledkov
2023-07-26 20:24:53 +01:00
committed by Paolo Pisati
parent 03345691b1
commit 8e5f6e5fb4
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -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 [amd64],
rust-src [amd64],
+5 -3
View File
@@ -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))