make the SPEC file more generic

- Removed versions from file names.
- Add spec files that specify items that vary between kernel versions.
- Move the kernel-ml SPEC file as the file that gets included.
- Make the include file more "generic" such that a kernel can be built
  with only version, package name and source0 specified.
- Do not `exit 1` on finding new options.
- Remove the '-s' that gets passed to the make macro to get "normally
  verbose" build output.
This commit is contained in:
Pratham Patel 2023-11-18 10:43:17 +05:30
parent 439b8e03af
commit 5d13ad5dc4
No known key found for this signature in database
7 changed files with 174 additions and 138 deletions

View File

@ -24,21 +24,16 @@
%global _binary_payload w3T.xzdio
# Define the version of the Linux Kernel Archive tarball.
%global LKAver 6.6.1
%global LKAver %{major_ver}.%{minor_ver}.%{patch_ver}
# Define the buildid, if required.
#global buildid .local
# Determine the sublevel number and set pkg_version.
%define sublevel %(echo %{LKAver} | %{__awk} -F\. '{ print $3 }')
%if "%{sublevel}" == ""
%global pkg_version %{LKAver}.0
%else
%global pkg_version %{LKAver}
%endif
# Set pkg_release.
%global pkg_release 1%{?buildid}%{?dist}
%global pkg_release %{release_v}%{?rc_ver:.rc%{rc_ver}}%{?next_snapshot_date:.next%{next_snapshot_date}}%{?buildid}%{?dist}
# Architectures upon which we can sign the kernel
# for secure boot authentication.
@ -79,13 +74,13 @@
# by later architecture-specific checks. These can also be disabled by using
# --without <opt> in the rpmbuild command, or by forcing these values to 0.
#
# kernel-ml
# kernel-*
%define with_std %{?_without_std: 0} %{?!_without_std: 1}
#
# kernel-ml-headers
# kernel-*-headers
%define with_headers %{?_without_headers: 0} %{?!_without_headers: 1}
#
# kernel-ml-doc
# kernel-*-doc
%define with_doc %{?_without_doc: 0} %{?!_without_doc: 1}
#
# perf
@ -100,13 +95,13 @@
# control whether to install the vdso directories
%define with_vdso_install %{?_without_vdso_install: 0} %{?!_without_vdso_install: 1}
#
# Additional option for toracat-friendly, one-off, kernel-ml building.
# Only build the base kernel-ml (--with baseonly):
# Additional option for toracat-friendly, one-off, kernel-* building.
# Only build the base kernel-* (--with baseonly):
%define with_baseonly %{?_with_baseonly: 1} %{?!_with_baseonly: 0}
%global KVERREL %{pkg_version}-%{pkg_release}.%{_target_cpu}
# If requested, only build base kernel-ml package.
# If requested, only build base kernel-* package.
%if %{with_baseonly}
%define with_doc 0
%define with_perf 0
@ -155,10 +150,7 @@
# Packages that need to be installed before the kernel is installed,
# as they will be used by the %%post scripts.
#
%define kernel_ml_prereq coreutils, systemd >= 203-2, /usr/bin/kernel-install
%define initrd_prereq dracut >= 027
Name: kernel-ml
Summary: The Linux kernel. (The core of any Linux kernel based operating system.)
License: GPLv2 and Redistributable, no modification permitted.
URL: https://www.kernel.org/
@ -172,7 +164,7 @@ Requires: %{name}-core-uname-r = %{KVERREL}
Requires: %{name}-modules-uname-r = %{KVERREL}
#
# List the packages required for the kernel-ml build.
# List the packages required for the kernel-* build.
#
BuildRequires: bash, bc, binutils, bison, bzip2, coreutils, diffutils, dwarves, elfutils-devel
BuildRequires: findutils, flex, gawk, gcc, gcc-c++, gcc-plugin-devel, git-core, glibc-static
@ -223,10 +215,8 @@ BuildConflicts: rhbuildsys(DiskFree) < 500Mb
###
### Sources
###
Source0: https://www.kernel.org/pub/linux/kernel/v6.x/linux-%{LKAver}.tar.xz
Source2: config-%{version}-x86_64
Source4: config-%{version}-aarch64
Source2: config-x86_64
Source4: config-aarch64
Source20: mod-denylist.sh
Source21: mod-sign.sh
@ -244,9 +234,6 @@ Source2000: cpupower.service
Source2001: cpupower.config
Source2002: kvm_stat.logrotate
# Do not package the source tarball.
NoSource: 0
%if %{signkernel}
%define secureboot_ca_0 %{_datadir}/pki/sb-certs/secureboot-ca-%{_arch}.cer
%define secureboot_key_0 %{_datadir}/pki/sb-certs/secureboot-kernel-%{_arch}.cer
@ -258,26 +245,26 @@ NoSource: 0
The %{name} meta package.
#
# This macro does requires, provides, conflicts, obsoletes for a kernel-ml package.
# %%kernel_ml_reqprovconf <subpackage>
# It uses any kernel_ml_<subpackage>_conflicts and kernel_ml_<subpackage>_obsoletes
# This macro does requires, provides, conflicts, obsoletes for a kernel-* package.
# %%reqprovconf <subpackage>
# It uses any <subpackage>_conflicts and <subpackage>_obsoletes
# macros defined above.
#
%define kernel_ml_reqprovconf \
%define reqprovconf \
Provides: %{name} = %{pkg_version}-%{pkg_release}\
Provides: %{name}-%{_target_cpu} = %{pkg_version}-%{pkg_release}%{?1:+%{1}}\
Provides: %{name}-drm-nouveau = 16\
Provides: %{name}-uname-r = %{KVERREL}%{?1:+%{1}}\
Requires(pre): %{kernel_ml_prereq}\
Requires(pre): %{initrd_prereq}\
Requires(pre): coreutils, systemd >= 203-2, /usr/bin/kernel-install\
Requires(pre): dracut >= 027\
Requires(pre): ((linux-firmware >= 20150904-56.git6ebf5d57) if linux-firmware)\
Recommends: linux-firmware\
Requires(preun): systemd >= 200\
Conflicts: xfsprogs < 4.3.0-1\
Conflicts: xorg-x11-drv-vmmouse < 13.0.99\
%{expand:%%{?kernel_ml%{?1:_%{1}}_conflicts:Conflicts: %%{%{name}%{?1:_%{1}}_conflicts}}}\
%{expand:%%{?kernel_ml%{?1:_%{1}}_obsoletes:Obsoletes: %%{%{name}%{?1:_%{1}}_obsoletes}}}\
%{expand:%%{?kernel_ml%{?1:_%{1}}_provides:Provides: %%{%{name}%{?1:_%{1}}_provides}}}\
%{expand:%%{?name%{?1:_%{1}}conflicts:Conflicts: %%{%{name}%{?1:_%{1}}conflicts}}}\
%{expand:%%{?name%{?1:_%{1}}obsoletes:Obsoletes: %%{%{name}%{?1:_%{1}}obsoletes}}}\
%{expand:%%{?name%{?1:_%{1}}provides:Provides: %%{%{name}%{?1:_%{1}}provides}}}\
# We can't let RPM do the dependencies automatically because it'll then pick up\
# a correct but undesirable perl dependency from the module headers which\
# isn't required for the kernel proper to function.\
@ -377,10 +364,10 @@ and simple manipulation of eBPF programs and maps.
%endif
#
# This macro creates a kernel-ml-<subpackage>-devel package.
# %%kernel_ml_devel_package [-m] <subpackage> <pretty-name>
# This macro creates a kernel-*-<subpackage>-devel package.
# %%devel_package [-m] <subpackage> <pretty-name>
#
%define kernel_ml_devel_package(m) \
%define devel_package(m) \
%package %{?1:%{1}-}devel\
Summary: Development package for building %{name} modules to match the %{?2:%{2} }%{name}.\
Provides: %{name}%{?1:-%{1}}-devel-%{_target_cpu} = %{version}-%{release}\
@ -391,7 +378,7 @@ Provides: kernel-devel-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
Provides: kernel-devel-uname-r = %{KVERREL}%{?1:+%{1}}\
Provides: kernel-devel = %{version}-%{release}%{?1:+%{1}}\
Provides: installonlypkg(kernel)\
Provides: installonlypkg(kernel-ml)\
Provides: installonlypkg(%{name})\
AutoReqProv: no\
Requires(pre): findutils\
Requires: findutils\
@ -411,11 +398,11 @@ against the %{?2:%{2} }%{name} package.\
%{nil}
#
# This macro creates an empty kernel-ml-<subpackage>-devel-matched package that
# This macro creates an empty kernel-*-<subpackage>-devel-matched package that
# requires both the core and devel packages locked on the same version.
# %%kernel_ml_devel_matched_package [-m] <subpackage> <pretty-name>
# %%devel_matched_package [-m] <subpackage> <pretty-name>
#
%define kernel_ml_devel_matched_package(m) \
%define devel_matched_package(m) \
%package %{?1:%{1}-}devel-matched\
Summary: Meta package to install matching core and devel packages for a given %{?2:%{2} }%{name}.\
Requires: %{name}%{?1:-%{1}}-devel = %{version}-%{release}\
@ -425,17 +412,17 @@ This meta package is used to install matching core and devel packages for a give
%{nil}
#
# This macro creates a kernel-ml-<subpackage>-modules-extra package.
# %%kernel_ml_modules_extra_package [-m] <subpackage> <pretty-name>
# This macro creates a kernel-*-<subpackage>-modules-extra package.
# %%modules_extra_package [-m] <subpackage> <pretty-name>
#
%define kernel_ml_modules_extra_package(m) \
%define modules_extra_package(m) \
%package %{?1:%{1}-}modules-extra\
Summary: Extra %{name} modules to match the %{?2:%{2} }%{name}.\
Provides: %{name}%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}\
Provides: %{name}%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
Provides: %{name}%{?1:-%{1}}-modules-extra = %{version}-%{release}%{?1:+%{1}}\
Provides: installonlypkg(kernel-module)\
Provides: installonlypkg(kernel-ml-module)\
Provides: installonlypkg(%{name}-module)\
Provides: %{name}%{?1:-%{1}}-modules-extra-uname-r = %{KVERREL}%{?1:+%{1}}\
Requires: %{name}-uname-r = %{KVERREL}%{?1:+%{1}}\
Requires: %{name}%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?1:+%{1}}\
@ -449,17 +436,17 @@ This package provides less commonly used %{name} modules for the %{?2:%{2} }%{na
%{nil}
#
# This macro creates a kernel-ml-<subpackage>-modules package.
# %%kernel_ml_modules_package [-m] <subpackage> <pretty-name>
# This macro creates a kernel-*-<subpackage>-modules package.
# %%modules_package [-m] <subpackage> <pretty-name>
#
%define kernel_ml_modules_package(m) \
%define modules_package(m) \
%package %{?1:%{1}-}modules\
Summary: %{name} modules to match the %{?2:%{2}-}core %{name}.\
Provides: %{name}%{?1:-%{1}}-modules-%{_target_cpu} = %{version}-%{release}\
Provides: %{name}-modules-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
Provides: %{name}-modules = %{version}-%{release}%{?1:+%{1}}\
Provides: installonlypkg(kernel-module)\
Provides: installonlypkg(kernel-ml-module)\
Provides: installonlypkg(%{name}-module)\
Provides: %{name}%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?1:+%{1}}\
Requires: %{name}-uname-r = %{KVERREL}%{?1:+%{1}}\
%if %{-m:1}%{!-m:0}\
@ -472,48 +459,48 @@ This package provides commonly used %{name} modules for the %{?2:%{2}-}core %{na
%{nil}
#
# this macro creates a kernel-ml-<subpackage> meta package.
# %%kernel_ml_meta_package <subpackage>
# this macro creates a kernel-*-<subpackage> meta package.
# %%meta_package <subpackage>
#
%define kernel_ml_meta_package() \
%define meta_package() \
%package %{1}\
Summary: %{name} meta-package for the %{1} ${name}.\
Requires: %{name}-%{1}-core-uname-r = %{KVERREL}+%{1}\
Requires: %{name}-%{1}-modules-uname-r = %{KVERREL}+%{1}\
Provides: installonlypkg(kernel)\
Provides: installonlypkg(kernel-ml)\
Provides: installonlypkg(%{name})\
%description %{1}\
The meta-package for the %{1} %{name}.\
%{nil}
#
# This macro creates a kernel-ml-<subpackage> and its -devel.
# %%define variant_summary The Linux kernel-ml compiled for <configuration>
# %%kernel_ml_variant_package [-n <pretty-name>] [-m] <subpackage>
# This macro creates a kernel-*-<subpackage> and its -devel.
# %%define variant_summary The Linux kernel-* compiled for <configuration>
# %%variant_package [-n <pretty-name>] [-m] <subpackage>
#
%define kernel_ml_variant_package(n:m) \
%define variant_package(n:m) \
%package %{?1:%{1}-}core\
Summary: %{variant_summary}.\
Provides: %{name}-%{?1:%{1}-}core-uname-r = %{KVERREL}%{?1:+%{1}}\
Provides: installonlypkg(kernel)\
Provides: installonlypkg(kernel-ml)\
Provides: installonlypkg(%{name})\
%if %{-m:1}%{!-m:0}\
Requires: %{name}-core-uname-r = %{KVERREL}\
%endif\
%{expand:%%kernel_ml_reqprovconf}\
%{expand:%%reqprovconf}\
%if %{?1:1} %{!?1:0} \
%{expand:%%kernel_ml_meta_package %{?1:%{1}}}\
%{expand:%%meta_package %{?1:%{1}}}\
%endif\
%{expand:%%kernel_ml_devel_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}} %{-m:%{-m}}}\
%{expand:%%kernel_ml_devel_matched_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}} %{-m:%{-m}}}\
%{expand:%%kernel_ml_modules_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}} %{-m:%{-m}}}\
%{expand:%%kernel_ml_modules_extra_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}} %{-m:%{-m}}}\
%{expand:%%devel_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}} %{-m:%{-m}}}\
%{expand:%%devel_matched_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}} %{-m:%{-m}}}\
%{expand:%%modules_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}} %{-m:%{-m}}}\
%{expand:%%modules_extra_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}} %{-m:%{-m}}}\
%{nil}
# And, finally, the main -core package.
%define variant_summary The Linux kernel.
%kernel_ml_variant_package
%variant_package
%description core
The %{name} package contains the Linux kernel (vmlinuz), the core of any
Linux kernel based operating system. The %{name} package handles the basic
@ -527,7 +514,7 @@ device input and output, etc.
%global _build_id_links none
# Set up our "big" %%{make} macro.
%global make %{__make} -s HOSTCFLAGS="%{?build_cflags}" HOSTLDFLAGS="%{?build_ldflags}"
%global make %{__make} HOSTCFLAGS="%{?build_cflags}" HOSTLDFLAGS="%{?build_ldflags}"
%prep
%ifarch x86_64 || aarch64
@ -539,8 +526,8 @@ exit 1
%endif
%endif
%setup -q -n %{name}-%{version} -c
mv linux-%{LKAver} linux-%{KVERREL}
%setup -q -n %{src_dir} -c
mv %{src_dir} linux-%{KVERREL}
pushd linux-%{KVERREL} > /dev/null
@ -575,11 +562,10 @@ cp -a %{SOURCE4} .
sed -i "s@^EXTRAVERSION.*@EXTRAVERSION = -%{release}.%{_target_cpu}@" Makefile
%ifarch x86_64 || aarch64
cp config-%{version}-%{_target_cpu} .config
%{__make} -s ARCH=%{bldarch} listnewconfig | grep -E '^CONFIG_' > newoptions-el9-%{_target_cpu}.txt || true
cp config-%{_target_cpu} .config
%{__make} ARCH=%{bldarch} listnewconfig | grep -E '^CONFIG_' > newoptions-el9-%{_target_cpu}.txt || true
if [ -s newoptions-el9-%{_target_cpu}.txt ]; then
cat newoptions-el9-%{_target_cpu}.txt
exit 1
fi
rm -f newoptions-el9-%{_target_cpu}.txt
%endif
@ -589,21 +575,21 @@ rm -f newoptions-el9-%{_target_cpu}.txt
openssl x509 -inform der -in %{SOURCE100} -out rheldup3.pem
openssl x509 -inform der -in %{SOURCE101} -out rhelkpatch1.pem
cat rheldup3.pem rhelkpatch1.pem > certs/rhel.pem
for i in config-%{version}-*; do
for i in config-*; do
sed -i 's@CONFIG_SYSTEM_TRUSTED_KEYS="*"@CONFIG_SYSTEM_TRUSTED_KEYS="certs/rhel.pem"@' $i
done
%else
for i in config-%{version}-*; do
for i in config-*; do
sed -i 's@CONFIG_SYSTEM_TRUSTED_KEYS="*"@CONFIG_SYSTEM_TRUSTED_KEYS=""@' $i
done
%endif
# Adjust the FIPS module name for RHEL9.
for i in config-%{version}-*; do
for i in config-*; do
sed -i 's@CONFIG_CRYPTO_FIPS_NAME=.*@CONFIG_CRYPTO_FIPS_NAME="Red Hat Enterprise Linux 9 - Kernel Cryptographic API"@' $i
done
%{__make} -s distclean
%{__make} distclean
popd > /dev/null
@ -611,9 +597,9 @@ popd > /dev/null
pushd linux-%{KVERREL} > /dev/null
%ifarch x86_64 || aarch64
cp config-%{version}-%{_target_cpu} .config
cp config-%{_target_cpu} .config
%{__make} -s ARCH=%{bldarch} oldconfig
%{__make} ARCH=%{bldarch} oldconfig
%if %{signkernel} || %{signmodules}
cp %{SOURCE23} certs/
@ -641,7 +627,7 @@ RPM_VMLINUX_H=vmlinux.h
%endif
%global perf_make \
%{__make} -s -C tools/perf NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 LIBTRACEEVENT_DYNAMIC=1 %{?perf_build_extra_opts} prefix=%{_prefix} PYTHON=%{__python3}
%{__make} -C tools/perf NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 LIBTRACEEVENT_DYNAMIC=1 %{?perf_build_extra_opts} prefix=%{_prefix} PYTHON=%{__python3}
# Make sure that check-headers.sh is executable.
chmod +x tools/perf/check-headers.sh
@ -654,43 +640,43 @@ chmod +x tools/perf/check-headers.sh
chmod +x tools/power/cpupower/utils/version-gen.sh
pushd tools/power/cpupower > /dev/null
%{__make} -s %{?_smp_mflags} CPUFREQ_BENCH=false DEBUG=false
%{__make} %{?_smp_mflags} CPUFREQ_BENCH=false DEBUG=false
popd > /dev/null
%ifarch x86_64
pushd tools/power/cpupower/debug/x86_64 > /dev/null
%{__make} -s %{?_smp_mflags} centrino-decode powernow-k8-decode
%{__make} %{?_smp_mflags} centrino-decode powernow-k8-decode
popd > /dev/null
pushd tools/power/x86/x86_energy_perf_policy > /dev/null
%{__make} -s %{?_smp_mflags}
%{__make} %{?_smp_mflags}
popd > /dev/null
pushd tools/power/x86/turbostat > /dev/null
%{__make} -s %{?_smp_mflags}
%{__make} %{?_smp_mflags}
popd > /dev/null
pushd tools/power/x86/intel-speed-select > /dev/null
%{__make} -s %{?_smp_mflags}
%{__make} %{?_smp_mflags}
popd > /dev/null
%endif
pushd tools/thermal/tmon > /dev/null
%{__make} -s %{?_smp_mflags}
%{__make} %{?_smp_mflags}
popd > /dev/null
pushd tools/iio > /dev/null
%{__make} -s %{?_smp_mflags}
%{__make} %{?_smp_mflags}
popd > /dev/null
pushd tools/gpio > /dev/null
%{__make} -s %{?_smp_mflags}
%{__make} %{?_smp_mflags}
popd > /dev/null
### BCAT
%if 0
pushd tools/vm > /dev/null
%{__make} -s %{?_smp_mflags} slabinfo page_owner_sort
%{__make} %{?_smp_mflags} slabinfo page_owner_sort
popd > /dev/null
%endif
### BCAT
@ -698,7 +684,7 @@ popd > /dev/null
%if %{with_bpftool}
%global bpftool_make \
%{__make} -s EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=$RPM_BUILD_ROOT VMLINUX_H="${RPM_VMLINUX_H}"
%{__make} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=$RPM_BUILD_ROOT VMLINUX_H="${RPM_VMLINUX_H}"
pushd tools/bpf/bpftool > /dev/null
%{bpftool_make}
@ -852,7 +838,7 @@ cp -a scripts $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build
rm -fr $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build/scripts/tracing
rm -f $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build/scripts/spdxcheck.py
# Files for 'make scripts' to succeed with kernel-ml-devel.
# Files for 'make scripts' to succeed with kernel-*-devel.
mkdir -p $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build/security/selinux/include
cp -a --parents security/selinux/include/classmap.h $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build
cp -a --parents security/selinux/include/initial_sid_to_string.h $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build
@ -860,7 +846,7 @@ mkdir -p $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build/tools/include/tools
cp -a --parents tools/include/tools/be_byteshift.h $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build
cp -a --parents tools/include/tools/le_byteshift.h $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build
# Files for 'make prepare' to succeed with kernel-ml-devel.
# Files for 'make prepare' to succeed with kernel-*-devel.
cp -a --parents tools/include/linux/compiler* $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build
cp -a --parents tools/include/linux/types.h $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build
cp -a --parents tools/build/Build.include $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build
@ -919,7 +905,7 @@ cp -a --parents arch/arm/include/asm/opcodes.h $RPM_BUILD_ROOT/lib/modules/%{KVE
cp -a include $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build/include
%ifarch x86_64
# Files required for 'make prepare' to succeed with kernel-ml-devel.
# Files required for 'make prepare' to succeed with kernel-*-devel.
cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build/
cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build/
cp -a --parents arch/x86/tools/relocs_32.c $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build/
@ -1000,11 +986,11 @@ remove_depmod_files()
remove_depmod_files
# Identify modules in the kernel-ml-modules-extras package
# Identify modules in the kernel-*-modules-extras package
%{SOURCE20} $RPM_BUILD_ROOT lib/modules/%{KVERREL} %{SOURCE26}
#
# Generate the kernel-ml-core and kernel-ml-modules file lists.
# Generate the kernel-*-core and kernel-*-modules file lists.
#
# Make a copy of the System.map file for depmod to use.
@ -1017,11 +1003,11 @@ pushd $RPM_BUILD_ROOT > /dev/null
mkdir restore
cp -r lib/modules/%{KVERREL}/* restore/
# Don't include anything going into kernel-ml-modules-extra in the file lists.
# Don't include anything going into kernel-*-modules-extra in the file lists.
xargs rm -fr < mod-extra.list
# Find all the module files and filter them out into the core and modules lists.
# This actually removes anything going into kernel-ml-modules from the directory.
# This actually removes anything going into kernel-*-modules from the directory.
find lib/modules/%{KVERREL}/kernel -name *.ko -type f | sort -n > modules.list
cp $RPM_SOURCE_DIR/filter-*.sh .
./filter-modules.sh modules.list %{_target_cpu}
@ -1044,7 +1030,7 @@ remove_depmod_files
### BCAT
# Go back and find all of the various directories in the tree.
# We use this for the directory lists in kernel-ml-core.
# We use this for the directory lists in kernel-*-core.
find lib/modules/%{KVERREL}/kernel -mindepth 1 -type d | sort -n > module-dirs.list
# Cleanup.
@ -1073,15 +1059,15 @@ mv $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build $RPM_BUILD_ROOT/usr/src/kernels/
# This is going to create a broken link during the build but we don't use
# it after this point. We need the link to actually point to something
# for when the kernel-ml-devel package is installed.
# for when the kernel-*-devel package is installed.
ln -sf /usr/src/kernels/%{KVERREL} $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/build
# Move the generated vmlinux.h file into the kernel-ml-devel directory structure.
# Move the generated vmlinux.h file into the kernel-*-devel directory structure.
if [ -f tools/bpf/bpftool/vmlinux.h ]; then
mv tools/bpf/bpftool/vmlinux.h $RPM_BUILD_ROOT/usr/src/kernels/%{KVERREL}/
fi
# Purge the kernel-ml-devel tree of leftover junk.
# Purge the kernel-*-devel tree of leftover junk.
find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -type f -delete
# Red Hat UEFI Secure Boot CA certificate, which can be used to authenticate the kernel.
@ -1098,12 +1084,12 @@ cp certs/signing_key.x509 certs/signing_key.x509.sign
%endif
# We have to do the headers install before the tools install because the
# kernel-ml headers_install will remove any header files in /usr/include that
# kernel-* headers_install will remove any header files in /usr/include that
# it doesn't install itself.
%if %{with_headers}
# Install kernel-ml headers
%{__make} -s ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
# Install kernel-* headers
%{__make} ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
find $RPM_BUILD_ROOT/usr/include \
\( -name .install -o -name .check -o \
@ -1137,7 +1123,7 @@ rm -fr $RPM_BUILD_ROOT%{_libdir}/traceevent
%endif
%if %{with_tools}
%{__make} -s -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
%{__make} -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
rm -f $RPM_BUILD_ROOT%{_libdir}/*.{a,la}
@ -1159,35 +1145,35 @@ install -m644 %{SOURCE2001} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/cpupower
%ifarch x86_64
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
pushd tools/power/x86/x86_energy_perf_policy > /dev/null
%{__make} -s %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
%{__make} %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
popd > /dev/null
pushd tools/power/x86/turbostat > /dev/null
%{__make} -s %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
%{__make} %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
popd > /dev/null
pushd tools/power/x86/intel-speed-select > /dev/null
%{__make} -s %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
%{__make} %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
popd > /dev/null
%endif
pushd tools/thermal/tmon > /dev/null
%{__make} -s %{?_smp_mflags} INSTALL_ROOT=$RPM_BUILD_ROOT install
%{__make} %{?_smp_mflags} INSTALL_ROOT=$RPM_BUILD_ROOT install
popd > /dev/null
pushd tools/iio > /dev/null
%{__make} -s %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
%{__make} %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
popd > /dev/null
pushd tools/gpio > /dev/null
%{__make} -s %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
%{__make} %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
popd > /dev/null
install -m644 -D %{SOURCE2002} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/kvm_stat
pushd tools/kvm/kvm_stat > /dev/null
%{__make} -s INSTALL_ROOT=$RPM_BUILD_ROOT install-tools
%{__make} -s INSTALL_ROOT=$RPM_BUILD_ROOT install-man
%{__make} INSTALL_ROOT=$RPM_BUILD_ROOT install-tools
%{__make} INSTALL_ROOT=$RPM_BUILD_ROOT install-man
install -m644 -D kvm_stat.service $RPM_BUILD_ROOT%{_unitdir}/kvm_stat.service
popd > /dev/null
@ -1238,13 +1224,13 @@ popd > /dev/null
%endif
#
# This macro defines a %%post script for a kernel-ml*-devel package.
# %%kernel_ml_devel_post [<subpackage>]
# This macro defines a %%post script for a kernel-**-devel package.
# %%devel_post [<subpackage>]
# Note we don't run hardlink if ostree is in use, as ostree is
# a far more sophisticated hardlink implementation.
# https://github.com/projectatomic/rpm-ostree/commit/58a79056a889be8814aa51f507b2c7a4dccee526
#
%define kernel_ml_devel_post() \
%define devel_post() \
%{expand:%%post %{?1:%{1}-}devel}\
if [ -f /etc/sysconfig/kernel ]\
then\
@ -1260,11 +1246,11 @@ fi\
%{nil}
#
# This macro defines a %%post script for a kernel-ml*-modules-extra package.
# This macro defines a %%post script for a kernel-**-modules-extra package.
# It also defines a %%postun script that does the same thing.
# %%kernel_ml_modules_extra_post [<subpackage>]
# %%modules_extra_post [<subpackage>]
#
%define kernel_ml_modules_extra_post() \
%define modules_extra_post() \
%{expand:%%post %{?1:%{1}-}modules-extra}\
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
%{nil}\
@ -1273,11 +1259,11 @@ fi\
%{nil}
#
# This macro defines a %%post script for a kernel-ml*-modules package.
# This macro defines a %%post script for a kernel-**-modules package.
# It also defines a %%postun script that does the same thing.
# %%kernel_ml_modules_post [<subpackage>]
# %%modules_post [<subpackage>]
#
%define kernel_ml_modules_post() \
%define modules_post() \
%{expand:%%post %{?1:%{1}-}modules}\
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
%{nil}\
@ -1285,11 +1271,11 @@ fi\
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
%{nil}
# This macro defines a %%posttrans script for a kernel-ml package.
# %%kernel_ml_variant_posttrans [<subpackage>]
# This macro defines a %%posttrans script for a kernel-* package.
# %%variant_posttrans [<subpackage>]
# More text can follow to go at the end of this variant's %%post.
#
%define kernel_ml_variant_posttrans() \
%define variant_posttrans() \
%{expand:%%posttrans %{?1:%{1}-}core}\
if [ -x %{_sbindir}/weak-modules ]\
then\
@ -1299,15 +1285,15 @@ fi\
%{nil}
#
# This macro defines a %%post script for a kernel-ml package and its devel package.
# %%kernel_ml_variant_post [-v <subpackage>] [-r <replace>]
# This macro defines a %%post script for a kernel-* package and its devel package.
# %%variant_post [-v <subpackage>] [-r <replace>]
# More text can follow to go at the end of this variant's %%post.
#
%define kernel_ml_variant_post(v:r:) \
%{expand:%%kernel_ml_devel_post %{?-v*}}\
%{expand:%%kernel_ml_modules_post %{?-v*}}\
%{expand:%%kernel_ml_modules_extra_post %{?-v*}}\
%{expand:%%kernel_ml_variant_posttrans %{?-v*}}\
%define variant_post(v:r:) \
%{expand:%%devel_post %{?-v*}}\
%{expand:%%modules_post %{?-v*}}\
%{expand:%%modules_extra_post %{?-v*}}\
%{expand:%%variant_posttrans %{?-v*}}\
%{expand:%%post %{?-v*:%{-v*}-}core}\
%{-r:\
if [ `uname -i` == "x86_64" ] &&\
@ -1317,10 +1303,10 @@ fi}\
%{nil}
#
# This macro defines a %%preun script for a kernel-ml package.
# %%kernel_ml_variant_preun <subpackage>
# This macro defines a %%preun script for a kernel-* package.
# %%variant_preun <subpackage>
#
%define kernel_ml_variant_preun() \
%define variant_preun() \
%{expand:%%preun %{?1:%{1}-}core}\
/bin/kernel-install remove %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\
if [ -x %{_sbindir}/weak-modules ]\
@ -1329,8 +1315,8 @@ then\
fi\
%{nil}
%kernel_ml_variant_preun
%kernel_ml_variant_post -r kernel-smp
%variant_preun
%variant_post -r kernel-smp
if [ -x /sbin/ldconfig ]
then
@ -1438,11 +1424,11 @@ fi
%endif
#
# This macro defines the %%files sections for a kernel-ml package
# This macro defines the %%files sections for a kernel-* package
# and its devel package.
# %%kernel_ml_variant_files [-k vmlinux] <use_vdso> <condition> <subpackage>
# %%variant_files [-k vmlinux] <use_vdso> <condition> <subpackage>
#
%define kernel_ml_variant_files(k:) \
%define variant_files(k:) \
%if %{2}\
%{expand:%%files -f %{name}-%{?3:%{3}-}core.list %{?1:-f %{name}-%{?3:%{3}-}ldsoconf.list} %{?3:%{3}-}core}\
%{!?_licensedir:%global license %%doc}\
@ -1488,7 +1474,7 @@ fi
%endif\
%{nil}
%kernel_ml_variant_files %{_use_vdso} %{with_std}
%variant_files %{_use_vdso} %{with_std}
%changelog
* Wed Nov 08 2023 Akemi Yagi <toracat@elrepo.org> - 6.6.1-1

12
kernel-lts.spec Normal file
View File

@ -0,0 +1,12 @@
%global major_ver 6
%global minor_ver 1
%global patch_ver 62
%global release_v 0
Name: kernel-lts
%global src_dir linux-%{major_ver}.%{minor_ver}.%{patch_ver}
Source0: https://cdn.kernel.org/pub/linux/kernel/v%{major_ver}.x/linux-%{major_ver}.%{minor_ver}.%{patch_ver}.tar.xz
Source1: kernel-common.inc
%include %{SOURCE1}

13
kernel-mainline.spec Normal file
View File

@ -0,0 +1,13 @@
%global major_ver 6
%global minor_ver 7
%global patch_ver 0
%global rc_ver 1
%global release_v 0
Name: kernel-mainline
%global src_dir linux-%{major_ver}.%{minor_ver}-rc%{rc_ver}
Source0: https://git.kernel.org/torvalds/t/linux-%{major_ver}.%{minor_ver}-rc%{rc_ver}.tar.gz
Source1: kernel-common.inc
%include %{SOURCE1}

13
kernel-next.spec Normal file
View File

@ -0,0 +1,13 @@
%global major_ver 6
%global minor_ver 7
%global patch_ver 0
%global next_snapshot_date 20231117
%global release_v 0
Name: kernel-next
%global src_dir linux-next-next-%{next_snapshot_date}
Source0: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/snapshot/linux-next-next-%{next_snapshot_date}.tar.gz
Source1: kernel-common.inc
%include %{SOURCE1}

12
kernel-stable.spec Normal file
View File

@ -0,0 +1,12 @@
%global major_ver 6
%global minor_ver 6
%global patch_ver 1
%global release_v 0
Name: kernel-stable
%global src_dir linux-%{major_ver}.%{minor_ver}.%{patch_ver}
Source0: https://cdn.kernel.org/pub/linux/kernel/v%{major_ver}.x/linux-%{major_ver}.%{minor_ver}.%{patch_ver}.tar.xz
Source1: kernel-common.inc
%include %{SOURCE1}