|
| 1 | +# All global changes to build and install should follow this line. |
| 2 | + |
| 3 | +# Disable LTO in userspace packages. |
| 4 | +%global _lto_cflags %{nil} |
| 5 | + |
| 6 | +# The libexec directory is not used by the linker, so the shared object there |
| 7 | +# should not be exported to RPM provides. |
| 8 | +%global __provides_exclude_from ^%{_libexecdir}/kselftests |
| 9 | + |
| 10 | +# Disable the find-provides.ksyms script. |
| 11 | +%global __provided_ksyms_provides %{nil} |
| 12 | + |
| 13 | +# All global wide changes should be above this line otherwise |
| 14 | +# the %%install section will not see them. |
| 15 | +%global __spec_install_pre %{___build_pre} |
| 16 | + |
| 17 | +# Kernel has several large (hundreds of mbytes) rpms, they take ~5 mins |
| 18 | +# to compress by single-threaded xz. Switch to threaded compression, |
| 19 | +# and from level 2 to 3 to keep compressed sizes close to "w2" results. |
| 20 | +# |
| 21 | +# NB: if default compression in /usr/lib/rpm/redhat/macros ever changes, |
| 22 | +# this one might need tweaking (e.g. if default changes to w3.xzdio, |
| 23 | +# change below to w4T.xzdio): |
| 24 | +%global _binary_payload w3T.xzdio |
| 25 | + |
| 26 | +# Define the version of the Linux Kernel Archive tarball. |
| 27 | +%global LKAver 1.0 |
| 28 | + |
| 29 | +# Define the buildid, if required. |
| 30 | +%global buildid 123 |
| 31 | + |
| 32 | +# Determine the sublevel number and set pkg_version. |
| 33 | +%define sublevel %(echo %{LKAver} | %{__awk} -F\. '{ print $3 }') |
| 34 | +%if "%{sublevel}" == "" |
| 35 | +%global pkg_version %{LKAver}.0 |
| 36 | +%else |
| 37 | +%global pkg_version %{LKAver} |
| 38 | +%endif |
| 39 | + |
| 40 | +# Set pkg_release. |
| 41 | +%global pkg_release 1%{?buildid}%{?dist} |
| 42 | + |
| 43 | +# Architectures upon which we can sign the kernel |
| 44 | +# for secure boot authentication. |
| 45 | +%ifarch x86_64 || aarch64 |
| 46 | +%global signkernel 1 |
| 47 | +%else |
| 48 | +%global signkernel 0 |
| 49 | +%endif |
| 50 | + |
| 51 | +# Sign modules on all architectures that build modules. |
| 52 | +%ifarch x86_64 || aarch64 |
| 53 | +%global signmodules 1 |
| 54 | +%else |
| 55 | +%global signmodules 0 |
| 56 | +%endif |
| 57 | + |
| 58 | +# Compress modules on all architectures that build modules. |
| 59 | +%ifarch x86_64 || aarch64 |
| 60 | +%global zipmodules 1 |
| 61 | +%else |
| 62 | +%global zipmodules 0 |
| 63 | +%endif |
| 64 | + |
| 65 | +%if %{zipmodules} |
| 66 | +%global zipsed -e 's/\.ko$/\.ko.xz/' |
| 67 | +# For parallel xz processes. Replace with 1 to go back to single process. |
| 68 | +%global zcpu `nproc --all` |
| 69 | +%endif |
| 70 | + |
| 71 | +# The following build options are enabled by default, but may become disabled |
| 72 | +# by later architecture-specific checks. These can also be disabled by using |
| 73 | +# --without <opt> in the rpmbuild command, or by forcing these values to 0. |
| 74 | +# |
| 75 | +# {{.KernelPackage}} |
| 76 | +%define with_std %{?_without_std: 0} %{?!_without_std: 1} |
| 77 | +# |
| 78 | +# {{.KernelPackage}}-headers |
| 79 | +%define with_headers %{?_without_headers: 0} %{?!_without_headers: 1} |
| 80 | +# |
| 81 | +# {{.KernelPackage}}-doc |
| 82 | +%define with_doc %{?_without_doc: 0} %{?!_without_doc: 1} |
| 83 | +# |
| 84 | +# perf |
| 85 | +%define with_perf %{?_without_perf: 0} %{?!_without_perf: 1} |
| 86 | +# |
| 87 | +# tools |
| 88 | +%define with_tools %{?_without_tools: 0} %{?!_without_tools: 1} |
| 89 | +# |
| 90 | +# bpf tool |
| 91 | +%define with_bpftool %{?_without_bpftool: 0} %{?!_without_bpftool: 1} |
| 92 | +# |
| 93 | +# control whether to install the vdso directories |
| 94 | +%define with_vdso_install %{?_without_vdso_install: 0} %{?!_without_vdso_install: 1} |
| 95 | +# |
| 96 | +# Additional option for toracat-friendly, one-off, {{.KernelPackage}} building. |
| 97 | +# Only build the base {{.KernelPackage}} (--with baseonly): |
| 98 | +%define with_baseonly %{?_with_baseonly: 1} %{?!_with_baseonly: 0} |
| 99 | + |
| 100 | +%global KVERREL %{pkg_version}-%{pkg_release}.%{_target_cpu} |
| 101 | + |
| 102 | +# If requested, only build base {{.KernelPackage}} package. |
| 103 | +%if %{with_baseonly} |
| 104 | +%define with_doc 0 |
| 105 | +%define with_perf 0 |
| 106 | +%define with_tools 0 |
| 107 | +%define with_bpftool 0 |
| 108 | +%define with_vdso_install 0 |
| 109 | +%endif |
| 110 | + |
| 111 | +%ifarch noarch |
| 112 | +%define with_std 0 |
| 113 | +%define with_headers 0 |
| 114 | +%define with_perf 0 |
| 115 | +%define with_tools 0 |
| 116 | +%define with_bpftool 0 |
| 117 | +%define with_vdso_install 0 |
| 118 | +%endif |
| 119 | + |
| 120 | +%ifarch x86_64 || aarch64 |
| 121 | +%define with_doc 0 |
| 122 | +### as of {{.KernelPackage}}-6.5.4, no more perf and bpftool -ay |
| 123 | +%define with_perf 0 |
| 124 | +%define with_bpftool 0 |
| 125 | +%endif |
| 126 | + |
| 127 | +%ifarch x86_64 |
| 128 | +%define asmarch x86 |
| 129 | +%define bldarch x86_64 |
| 130 | +%define hdrarch x86_64 |
| 131 | +%define make_target bzImage |
| 132 | +%define kernel_image arch/x86/boot/bzImage |
| 133 | +%endif |
| 134 | + |
| 135 | +%ifarch aarch64 |
| 136 | +%define asmarch arm64 |
| 137 | +%define bldarch arm64 |
| 138 | +%define hdrarch arm64 |
| 139 | +%define make_target Image.gz |
| 140 | +%define kernel_image arch/arm64/boot/Image.gz |
| 141 | +%endif |
| 142 | + |
| 143 | +%if %{with_vdso_install} |
| 144 | +%define use_vdso 1 |
| 145 | +%define _use_vdso 1 |
| 146 | +%else |
| 147 | +%define _use_vdso 0 |
| 148 | +%endif |
| 149 | + |
| 150 | +# |
| 151 | +# Packages that need to be installed before the kernel is installed, |
| 152 | +# as they will be used by the %%post scripts. |
| 153 | +# |
| 154 | +%define kernel_ml_prereq coreutils, systemd >= 203-2, /usr/bin/kernel-install |
| 155 | +%define initrd_prereq dracut >= 027 |
| 156 | + |
| 157 | +Name: kernel |
| 158 | +Summary: The Linux kernel. (The core of any Linux kernel based operating system.) |
| 159 | +License: GPLv2 and Redistributable, no modification permitted. |
| 160 | +URL: https://www.kernel.org/ |
| 161 | +Version: %{pkg_version} |
| 162 | +Release: %{pkg_release} |
| 163 | +ExclusiveArch: x86_64 aarch64 noarch |
| 164 | +ExclusiveOS: Linux |
| 165 | +Provides: kernel = %{version}-%{release} |
| 166 | +Provides: installonlypkg(kernel) |
| 167 | +Requires: %{name}-core-uname-r = %{KVERREL} |
| 168 | +Requires: %{name}-modules-uname-r = %{KVERREL} |
| 169 | + |
| 170 | +%changelog |
| 171 | +* Tue Feb 22 2024 Mustafa Gezen - 1.0-123 |
| 172 | +- Test changelog |
0 commit comments