diff mbox series

[MANTIC,NOBLE,UNSTABLE] UBUNTU: [Packaging] make ZSTD module compression conditional

Message ID 20231120223217.545437-1-dimitri.ledkov@canonical.com
State New
Headers show
Series [MANTIC,NOBLE,UNSTABLE] UBUNTU: [Packaging] make ZSTD module compression conditional | expand

Commit Message

Dimitri John Ledkov Nov. 20, 2023, 10:32 p.m. UTC
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@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(-)

Comments

Andrea Righi Nov. 22, 2023, 5:54 a.m. UTC | #1
On Mon, Nov 20, 2023 at 10:32:17PM +0000, Dimitri John Ledkov wrote:
> 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

Why ignore yes? Is there any reason to not report this in the changelog?

Apart than that it all makes sense to me:

Acked-by: Andrea Righi <andrea.righi@canonical.com>

> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@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
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Roxana Nicolescu Nov. 22, 2023, 8:43 a.m. UTC | #2
On 20/11/2023 23:32, Dimitri John Ledkov wrote:
> 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@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))
Looks correct. I would also include a buglink and add this in the changelog.

Acked-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Dimitri John Ledkov Nov. 22, 2023, 11:18 a.m. UTC | #3
On Wed, 22 Nov 2023 at 05:54, Andrea Righi <andrea.righi@canonical.com> wrote:
>
> On Mon, Nov 20, 2023 at 10:32:17PM +0000, Dimitri John Ledkov wrote:
> > 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
>
> Why ignore yes? Is there any reason to not report this in the changelog?

We can report it in a changelog, but for end users there will be no
change for most kernels.
As behaviour doesn't actually change for anybody on mantic.
And behaviour doesn't change for hwe-6.5 kernels that had the previous
patch to zstd compress modules reverted.
And any new kernels backported to jammy will behave correctly.
To me it seems like emitting this change in changelog will be
confusing for the reader.
But i guess our changelogs are so large anyway, that maybe it doesn't matter.

I recall we used to hand edit changelogs after close to make them
extra pretty, but i guess we no longer do that, because it is all
mechanically generated.

>
> Apart than that it all makes sense to me:
>
> Acked-by: Andrea Righi <andrea.righi@canonical.com>
>
> > Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@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
> >
> >
> > --
> > kernel-team mailing list
> > kernel-team@lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/kernel-team
Stefan Bader Dec. 1, 2023, 2:24 p.m. UTC | #4
On 20.11.23 23:32, Dimitri John Ledkov wrote:

BugLink: https://bugs.launchpad.net/bugs/2045412

> 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@canonical.com>
> ---

Applied to mantic:linux/master-next using above bug report. Thanks.

-Stefan

> 
> 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))
Dimitri John Ledkov Dec. 4, 2023, 10:36 p.m. UTC | #5
Applied to unstable only; with a buglink + without ignore, as per
review comments.

On Mon, 20 Nov 2023 at 22:32, Dimitri John Ledkov
<dimitri.ledkov@canonical.com> wrote:
>
> 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@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
>
diff mbox series

Patch

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))