From: Prarit Bhargava on gitlab.com Merge Request: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2173
Most of the kernel and its packing is currently xz. There is one exception, KABI. Remove gzip change the KABI symbol compression to xz.
There are other compression algorithms that are becoming more popular. To prepare for this change, add a compression variable and compression file extension variable.
Signed-off-by: Prarit Bhargava prarit@redhat.com
--- redhat/kernel.spec.template | 35 ++++++++++++++--------------------- 1 files changed, 14 insertions(+), 21 deletions(-)
From: Prarit Bhargava prarit@redhat.com
kernel.spec.template: Remove gzip related aarch64 code
With the move to CONFIG_EFI_ZBOOT, the aarch64 gzip code is no longer necessary and can be removed.
Signed-off-by: Prarit Bhargava prarit@redhat.com
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -1807,14 +1807,7 @@ BuildKernel() { CopyKernel=cp fi
- # Sign the image if we're using EFI - # aarch64 kernels are gziped EFI images - KernelExtension=${KernelImage##*.} - if [ "$KernelExtension" == "gz" ]; then - SignImage=${KernelImage%.*} - else - SignImage=$KernelImage - fi + SignImage=$KernelImage
%ifarch x86_64 aarch64 %pesign -s -i $SignImage -o vmlinuz.tmp -a %{secureboot_ca_0} -c %{secureboot_key_0} -n %{pesign_name_0} @@ -1837,9 +1830,6 @@ BuildKernel() { exit 1 fi mv vmlinuz.signed $SignImage - if [ "$KernelExtension" == "gz" ]; then - gzip -f9 $SignImage - fi # signkernel %endif
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2173
From: Prarit Bhargava prarit@redhat.com
kernel.spec.template: Use xz for KABI
Use xz for KABI instead of gzip. This allows the removal of gzip as a kernel dependency.
Signed-off-by: Prarit Bhargava prarit@redhat.com
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -603,7 +603,7 @@ Provides: installonlypkg(kernel) # List the packages used during the kernel build # BuildRequires: kmod, bash, coreutils, tar, git-core, which -BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk +BuildRequires: bzip2, xz, findutils, m4, perl-interpreter, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc, bison, flex, gcc-c++ BuildRequires: net-tools, hostname, bc, elfutils-devel BuildRequires: dwarves @@ -1906,8 +1906,8 @@ BuildKernel() { # NOTENOTE: checksums to the rpm metadata provides list. # NOTENOTE: if you change the symvers name, update the backend too echo "**** GENERATING kernel ABI metadata ****" - gzip -c9 < Module.symvers > $RPM_BUILD_ROOT/boot/symvers-$KernelVer.gz - cp $RPM_BUILD_ROOT/boot/symvers-$KernelVer.gz $RPM_BUILD_ROOT/lib/modules/$KernelVer/symvers.gz + xz -c9 < Module.symvers > $RPM_BUILD_ROOT/boot/symvers-$KernelVer.xz + cp $RPM_BUILD_ROOT/boot/symvers-$KernelVer.xz $RPM_BUILD_ROOT/lib/modules/$KernelVer/symvers.xz
%if %{with_kabichk} echo "**** kABI checking is enabled in kernel SPEC file. ****" @@ -2984,9 +2984,9 @@ fi\ %endif\ rm -f %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{KVERREL}%{?1:+%{1}}\ /bin/kernel-install add %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\ -if [[ ! -e "/boot/symvers-%{KVERREL}%{?1:+%{1}}.gz" ]]; then\ - ln -s "/lib/modules/%{KVERREL}%{?1:+%{1}}/symvers.gz" "/boot/symvers-%{KVERREL}%{?1:+%{1}}.gz"\ - command -v restorecon &>/dev/null && restorecon "/boot/symvers-%{KVERREL}%{?1:+%{1}}.gz" \ +if [[ ! -e "/boot/symvers-%{KVERREL}%{?1:+%{1}}.xz" ]]; then\ + ln -s "/lib/modules/%{KVERREL}%{?1:+%{1}}/symvers.xz" "/boot/symvers-%{KVERREL}%{?1:+%{1}}.xz"\ + command -v restorecon &>/dev/null && restorecon "/boot/symvers-%{KVERREL}%{?1:+%{1}}.xz" \ fi\ %{nil}
@@ -3265,10 +3265,10 @@ fi %endif\ %attr(0600, root, root) /lib/modules/%{KVERREL}%{?3:+%{3}}/System.map\ %ghost %attr(0600, root, root) /boot/System.map-%{KVERREL}%{?3:+%{3}}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/symvers.gz\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/symvers.xz\ /lib/modules/%{KVERREL}%{?3:+%{3}}/config\ /lib/modules/%{KVERREL}%{?3:+%{3}}/modules.builtin*\ -%ghost %attr(0600, root, root) /boot/symvers-%{KVERREL}%{?3:+%{3}}.gz\ +%ghost %attr(0600, root, root) /boot/symvers-%{KVERREL}%{?3:+%{3}}.xz\ %ghost %attr(0600, root, root) /boot/initramfs-%{KVERREL}%{?3:+%{3}}.img\ %ghost %attr(0644, root, root) /boot/config-%{KVERREL}%{?3:+%{3}}\ %{expand:%%files -f kernel-%{?3:%{3}-}modules-core.list %{?3:%{3}-}modules-core}\
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2173
From: Prarit Bhargava prarit@redhat.com
kernel.spec.template: Add global compression variables
Add global compression variables. 'compression' is the compression utility, and 'compext' is the compression extension. In the case of xz, these variables have the same value but that may not always be the case.
Signed-off-by: Prarit Bhargava prarit@redhat.com
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -106,8 +106,11 @@ Summary: The Linux kernel %global zipmodules 1 %endif
+# Default compression algorithm +%global compression xz +%global compext xz %if %{zipmodules} -%global zipsed -e 's/.ko$/.ko.xz/' +%global zipsed -e 's/.ko$/.ko.%compext/' %endif
%if 0%{?fedora} @@ -1906,8 +1909,8 @@ BuildKernel() { # NOTENOTE: checksums to the rpm metadata provides list. # NOTENOTE: if you change the symvers name, update the backend too echo "**** GENERATING kernel ABI metadata ****" - xz -c9 < Module.symvers > $RPM_BUILD_ROOT/boot/symvers-$KernelVer.xz - cp $RPM_BUILD_ROOT/boot/symvers-$KernelVer.xz $RPM_BUILD_ROOT/lib/modules/$KernelVer/symvers.xz + %compression -c9 < Module.symvers > $RPM_BUILD_ROOT/boot/symvers-$KernelVer.%compext + cp $RPM_BUILD_ROOT/boot/symvers-$KernelVer.%compext $RPM_BUILD_ROOT/lib/modules/$KernelVer/symvers.%compext
%if %{with_kabichk} echo "**** kABI checking is enabled in kernel SPEC file. ****" @@ -2556,7 +2559,7 @@ find Documentation -type d | xargs chmod u+w fi \ if [ "%{zipmodules}" -eq "1" ]; then \ echo "Compressing kernel modules ..." \ - find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs -n 16 -P${RPM_BUILD_NCPUS} -r xz; \ + find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs -n 16 -P${RPM_BUILD_NCPUS} -r %compression; \ fi \ %{nil}
@@ -2984,9 +2987,9 @@ fi\ %endif\ rm -f %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{KVERREL}%{?1:+%{1}}\ /bin/kernel-install add %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\ -if [[ ! -e "/boot/symvers-%{KVERREL}%{?1:+%{1}}.xz" ]]; then\ - ln -s "/lib/modules/%{KVERREL}%{?1:+%{1}}/symvers.xz" "/boot/symvers-%{KVERREL}%{?1:+%{1}}.xz"\ - command -v restorecon &>/dev/null && restorecon "/boot/symvers-%{KVERREL}%{?1:+%{1}}.xz" \ +if [[ ! -e "/boot/symvers-%{KVERREL}%{?1:+%{1}}.%compext" ]]; then\ + ln -s "/lib/modules/%{KVERREL}%{?1:+%{1}}/symvers.%compext" "/boot/symvers-%{KVERREL}%{?1:+%{1}}.%compext"\ + command -v restorecon &>/dev/null && restorecon "/boot/symvers-%{KVERREL}%{?1:+%{1}}.%compext" \ fi\ %{nil}
@@ -3265,10 +3268,10 @@ fi %endif\ %attr(0600, root, root) /lib/modules/%{KVERREL}%{?3:+%{3}}/System.map\ %ghost %attr(0600, root, root) /boot/System.map-%{KVERREL}%{?3:+%{3}}\ -/lib/modules/%{KVERREL}%{?3:+%{3}}/symvers.xz\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/symvers.%compext\ /lib/modules/%{KVERREL}%{?3:+%{3}}/config\ /lib/modules/%{KVERREL}%{?3:+%{3}}/modules.builtin*\ -%ghost %attr(0600, root, root) /boot/symvers-%{KVERREL}%{?3:+%{3}}.xz\ +%ghost %attr(0600, root, root) /boot/symvers-%{KVERREL}%{?3:+%{3}}.%compext\ %ghost %attr(0600, root, root) /boot/initramfs-%{KVERREL}%{?3:+%{3}}.img\ %ghost %attr(0644, root, root) /boot/config-%{KVERREL}%{?3:+%{3}}\ %{expand:%%files -f kernel-%{?3:%{3}-}modules-core.list %{?3:%{3}-}modules-core}\
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2173
From: Prarit Bhargava on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2173#note_1344063...
:) whoops. Fixed.
kernel@lists.fedoraproject.org