From: Scott Weaver <scwea...@redhat.com>

kernel.spec: updates for automotive-only build

When we generate the kernel-automotive srpm, we only want to include
sources that will be required for that build. For automotive the
INCLUDE_FEDORA_FILES, INCLUDE_RHEL_FILES and INCLUDE_RT_FILES will be
disabled which means we need to arrange the sources so that
kernel-automotive will have all the files it requires.

When building automotive only, to generate kernel-automotive packages,
it doesn't make sense to create the automotive variant of automotive
(kernel-automotive-automotive) which would be the result if we only
changed the package name. Therefore, with automotive-only, we generate
'stock' kernel-automotive packages while keeping the ability to also
generate the automotive variant of the stock kernel if that would ever
be needed.

Signed-off-by: Scott Weaver <scwea...@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
@@ -908,7 +908,7 @@ BuildRequires: redhat-sb-certs >= 9.4-0.1
 Source0: linux-%{tarfile_release}.tar.xz
 
 Source1: Makefile.rhelver
-Source2: kernel.changelog
+Source2: %{package_name}.changelog
 
 Source10: redhatsecurebootca5.cer
 Source13: redhatsecureboot501.cer
@@ -961,11 +961,8 @@ Source22: filtermods.py
 %define modsign_cmd %{SOURCE21}
 
 %if 0%{?include_rhel}
-Source23: x509.genkey.rhel
-
 Source24: %{name}-aarch64-rhel.config
 Source25: %{name}-aarch64-debug-rhel.config
-
 Source27: %{name}-ppc64le-rhel.config
 Source28: %{name}-ppc64le-debug-rhel.config
 Source29: %{name}-s390x-rhel.config
@@ -973,14 +970,15 @@ Source30: %{name}-s390x-debug-rhel.config
 Source31: %{name}-s390x-zfcpdump-rhel.config
 Source32: %{name}-x86_64-rhel.config
 Source33: %{name}-x86_64-debug-rhel.config
-
-Source34: def_variants.yaml.rhel
-
-Source41: x509.genkey.centos
 # ARM64 64K page-size kernel config
 Source42: %{name}-aarch64-64k-rhel.config
 Source43: %{name}-aarch64-64k-debug-rhel.config
+%endif
 
+%if %{include_rhel} || %{include_automotive}
+Source23: x509.genkey.rhel
+Source34: def_variants.yaml.rhel
+Source41: x509.genkey.centos
 %endif
 
 %if 0%{?include_fedora}
@@ -1084,12 +1082,18 @@ Source487: %{name}-riscv64-rt-debug-fedora.config
 %endif
 
 %if %{include_automotive}
-# automotive config files
+%if %{with_automotiveonly}
+Source488: %{name}-aarch64-rhel.config
+Source489: %{name}-aarch64-debug-rhel.config
+Source490: %{name}-x86_64-rhel.config
+Source491: %{name}-x86_64-debug-rhel.config
+%else
 Source488: %{name}-aarch64-automotive-rhel.config
 Source489: %{name}-aarch64-automotive-debug-rhel.config
 Source490: %{name}-x86_64-automotive-rhel.config
 Source491: %{name}-x86_64-automotive-debug-rhel.config
 %endif
+%endif
 
 
 # Sources for kernel-tools
@@ -1764,8 +1768,13 @@ on kernel bugs, as some of these options impact 
performance noticably.
 
 %if %{with_debug} && %{with_automotive}
 %define variant_summary The Linux Automotive kernel compiled with extra 
debugging enabled
+%if %{with_automotiveonly}
+%kernel_variant_package debug
+%description debug-core
+%else
 %kernel_variant_package automotive-debug
 %description automotive-debug-core
+%endif
 The kernel package contains the Linux kernel (vmlinuz), the core of any
 Linux operating system.  The kernel handles the basic functions
 of the operating system:  memory allocation, process allocation, device
@@ -1778,8 +1787,13 @@ on kernel bugs, as some of these options impact 
performance noticably.
 
 %if %{with_automotive_base}
 %define variant_summary The Linux kernel compiled with PREEMPT_RT enabled
+%if %{with_automotiveonly}
+%kernel_variant_package
+%description core
+%else
 %kernel_variant_package automotive
 %description automotive-core
+%endif
 This package includes a version of the Linux kernel compiled with the
 PREEMPT_RT real-time preemption support, targeted for Automotive platforms
 %endif
@@ -3017,8 +3031,12 @@ BuildKernel %make_target %kernel_image %{_use_vdso} 
rt-64k-debug
 %endif
 
 %if %{with_automotive}
+%if %{with_automotiveonly}
+BuildKernel %make_target %kernel_image %{_use_vdso} debug
+%else
 BuildKernel %make_target %kernel_image %{_use_vdso} automotive-debug
 %endif
+%endif
 
 %if %{with_arm64_16k}
 BuildKernel %make_target %kernel_image %{_use_vdso} 16k-debug
@@ -3054,8 +3072,12 @@ BuildKernel %make_target %kernel_image %{_use_vdso} 
rt-64k
 %endif
 
 %if %{with_automotive_base}
+%if %{with_automotiveonly}
+BuildKernel %make_target %kernel_image %{_use_vdso}
+%else
 BuildKernel %make_target %kernel_image %{_use_vdso} automotive
 %endif
+%endif
 
 %if %{with_up_base}
 BuildKernel %make_target %kernel_image %{_use_vdso}
@@ -3882,9 +3904,14 @@ fi\
 %endif
 
 %if %{with_automotive_base}
+%if %{with_automotiveonly}
+%kernel_variant_preun
+%kernel_variant_post
+%else
 %kernel_variant_preun -v automotive
 %kernel_variant_post -v automotive -r kernel
 %endif
+%endif
 
 %if %{with_realtime} && %{with_debug}
 %kernel_variant_preun -v rt-debug
@@ -3904,9 +3931,14 @@ fi\
 %endif
 
 %if %{with_automotive} && %{with_debug}
+%if %{with_automotiveonly}
+%kernel_variant_preun -v debug
+%kernel_variant_post -v debug
+%else
 %kernel_variant_preun -v automotive-debug
 %kernel_variant_post -v automotive-debug
 %endif
+%endif
 
 ###
 ### file lists
@@ -4225,10 +4257,18 @@ fi\
 %if %{with_realtime}
 %kernel_variant_files %{_use_vdso} %{with_debug} rt-debug
 %endif
+%if %{with_automotiveonly}
+%kernel_variant_files %{_use_vdso} %{with_automotive_base}
+%else
 %kernel_variant_files %{_use_vdso} %{with_automotive_base} automotive
+%endif
 %if %{with_automotive}
+%if %{with_automotiveonly}
+%kernel_variant_files %{_use_vdso} %{with_debug} debug
+%else
 %kernel_variant_files %{_use_vdso} %{with_debug} automotive-debug
 %endif
+%endif
 %if %{with_debug_meta}
 %files debug
 %files debug-core

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3870

-- 
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to