Justin Vreeland 794d92
# We have to override the new %%install behavior because, well... the kernel is special.
Justin Vreeland 794d92
%global __spec_install_pre %{___build_pre}
Justin Vreeland 794d92
Justin Vreeland 794d92
# this should go away soon
Justin Vreeland 794d92
%define _legacy_common_support 1
Justin Vreeland 794d92
Justin Vreeland 794d92
# At the time of this writing (2019-03), RHEL8 packages use w2.xzdio
Justin Vreeland 794d92
# compression for rpms (xz, level 2).
Justin Vreeland 794d92
# Kernel has several large (hundreds of mbytes) rpms, they take ~5 mins
Justin Vreeland 794d92
# to compress by single-threaded xz. Switch to threaded compression,
Justin Vreeland 794d92
# and from level 2 to 3 to keep compressed sizes close to "w2" results.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# NB: if default compression in /usr/lib/rpm/redhat/macros ever changes,
Justin Vreeland 794d92
# this one might need tweaking (e.g. if default changes to w3.xzdio,
Justin Vreeland 794d92
# change below to w4T.xzdio):
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This is disabled on i686 as it triggers oom errors
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifnarch i686
Justin Vreeland 794d92
%define _binary_payload w3T.xzdio
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
Summary: The Linux kernel
Justin Vreeland 794d92
Justin Vreeland 794d92
# For a kernel released for public testing, released_kernel should be 1.
Justin Vreeland 794d92
# For internal testing builds during development, it should be 0.
Justin Vreeland 794d92
# For rawhide and/or a kernel built from an rc or git snapshot,
Justin Vreeland 794d92
# released_kernel should be 0.
Justin Vreeland 794d92
# For a stable, released kernel, released_kernel should be 1.
Justin Vreeland 794d92
%global released_kernel 1
Justin Vreeland 794d92
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
%define secure_boot_arch x86_64
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define secure_boot_arch x86_64 aarch64 s390x ppc64le
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# Signing for secure boot authentication
Justin Vreeland 794d92
%ifarch %{secure_boot_arch}
Justin Vreeland 794d92
%global signkernel 1
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%global signkernel 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# Sign modules on all arches
Justin Vreeland 794d92
%global signmodules 1
Justin Vreeland 794d92
Justin Vreeland 794d92
# Compress modules only for architectures that build modules
Justin Vreeland 794d92
%ifarch noarch
Justin Vreeland 794d92
%global zipmodules 0
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%global zipmodules 1
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{zipmodules}
Justin Vreeland 794d92
%global zipsed -e 's/\.ko$/\.ko.xz/'
Justin Vreeland 794d92
# for parallel xz processes, replace with 1 to go back to single process
Justin Vreeland 794d92
%global zcpu `nproc --all`
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# define buildid .local
Justin Vreeland 794d92
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
%define primary_target fedora
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
# check for 'hyperscale'/'facebook'/'twitter' here
Justin Vreeland 794d92
%define primary_target centos-sig-hyperscale
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# baserelease defines which build revision of this kernel version we're
Justin Vreeland 794d92
# building.  We used to call this fedora_build, but the magical name
Justin Vreeland 794d92
# baserelease is matched by the rpmdev-bumpspec tool, which you should use.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# We used to have some extra magic weirdness to bump this automatically,
Justin Vreeland 794d92
# but now we don't.  Just use: rpmdev-bumpspec -c 'comment for changelog'
Justin Vreeland 794d92
# When changing base_sublevel below or going from rc to a final kernel,
Justin Vreeland 794d92
# reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec).
Justin Vreeland 794d92
# scripts/rebase.sh should be made to do that for you, actually.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# NOTE: baserelease must be > 0 or bad things will happen if you switch
Justin Vreeland 794d92
#       to a released kernel (released version will be < rc version)
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# For non-released -rc kernels, this will be appended after the rcX and
Justin Vreeland 794d92
# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%global baserelease 200
Justin Vreeland 794d92
%global fedora_build %{baserelease}
Justin Vreeland 794d92
Justin Vreeland 794d92
# base_sublevel is the kernel version we're starting with and patching
Justin Vreeland 794d92
# on top of -- for example, 3.1-rc7-git1 starts with a 3.0 base,
Justin Vreeland 794d92
# which yields a base_sublevel of 0.
Justin Vreeland 794d92
%define base_sublevel 10
Justin Vreeland 794d92
Justin Vreeland 794d92
## If this is a released kernel ##
Justin Vreeland 794d92
%if 0%{?released_kernel}
Justin Vreeland 794d92
Justin Vreeland 794d92
# Do we have a -stable update to apply?
Justin Vreeland 794d92
%define stable_update 31
Justin Vreeland 794d92
# Set rpm version accordingly
Justin Vreeland 794d92
%if 0%{?stable_update}
Justin Vreeland 794d92
%define stablerev %{stable_update}
Justin Vreeland 794d92
%define stable_base %{stable_update}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%define rpmversion 5.%{base_sublevel}.%{stable_update}
Justin Vreeland 794d92
Justin Vreeland 794d92
## The not-released-kernel case ##
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
# The next upstream release sublevel (base_sublevel+1)
Justin Vreeland 794d92
%define upstream_sublevel %(echo $((%{base_sublevel} + 1)))
Justin Vreeland 794d92
# The rc snapshot level
Justin Vreeland 794d92
%global rcrev 0
Justin Vreeland 794d92
# The git snapshot level
Justin Vreeland 794d92
%define gitrev 0
Justin Vreeland 794d92
# Set rpm version accordingly
Justin Vreeland 794d92
%define rpmversion 5.%{upstream_sublevel}.0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
# Nb: The above rcrev and gitrev values automagically define Patch00 and Patch01 below.
Justin Vreeland 794d92
Justin Vreeland 794d92
# What parts do we want to build?  We must build at least one kernel.
Justin Vreeland 794d92
# These are the kernels that are built IF the architecture allows it.
Justin Vreeland 794d92
# All should default to 1 (enabled) and be flipped to 0 (disabled)
Justin Vreeland 794d92
# by later arch-specific checks.
Justin Vreeland 794d92
Justin Vreeland 794d92
# The following build options are enabled by default.
Justin Vreeland 794d92
# Use either --without <opt> in your rpmbuild command or force values
Justin Vreeland 794d92
# to 0 in here to disable them.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# standard kernel
Justin Vreeland 794d92
%define with_up        %{?_without_up:        0} %{?!_without_up:        1}
Justin Vreeland 794d92
# kernel PAE (only valid for ARM (lpae))
Justin Vreeland 794d92
%define with_pae       %{?_without_pae:       0} %{?!_without_pae:       1}
Justin Vreeland 794d92
# kernel-debug
Justin Vreeland 794d92
%define with_debug     %{?_without_debug:     0} %{?!_without_debug:     1}
Justin Vreeland 794d92
# kernel-doc
Justin Vreeland 794d92
%define with_doc       %{?_without_doc:       0} %{?!_without_doc:       1}
Justin Vreeland 794d92
# kernel-headers
Justin Vreeland 794d92
%define with_headers   %{?_without_headers:   0} %{?!_without_headers:   1}
Justin Vreeland 794d92
%define with_cross_headers   %{?_without_cross_headers:   0} %{?!_without_cross_headers:   1}
Justin Vreeland 794d92
# perf
Justin Vreeland 794d92
%define with_perf      %{?_without_perf:      0} %{?!_without_perf:      1}
Justin Vreeland 794d92
# tools
Justin Vreeland 794d92
%define with_tools     %{?_without_tools:     0} %{?!_without_tools:     1}
Justin Vreeland 794d92
# bpf tool
Justin Vreeland 794d92
%define with_bpftool   %{?_without_bpftool:   0} %{?!_without_bpftool:   1}
Justin Vreeland 794d92
# kernel-debuginfo
Justin Vreeland 794d92
%define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1}
Justin Vreeland 794d92
# Want to build a the vsdo directories installed
Justin Vreeland 794d92
%define with_vdso_install %{?_without_vdso_install: 0} %{?!_without_vdso_install: 1}
Justin Vreeland 794d92
# kernel-zfcpdump (s390 specific kernel for zfcpdump)
Justin Vreeland 794d92
%define with_zfcpdump  %{?_without_zfcpdump:  0} %{?!_without_zfcpdump:  1}
Justin Vreeland 794d92
# kernel-abi-whitelists
Justin Vreeland 735474
%define with_kernel_abi_whitelists %{?_without_kernel_abi_whitelists: 0} %{?!_without_kernel_abi_whitelists: 0}
Justin Vreeland 794d92
# internal samples and selftests
Justin Vreeland 794d92
%define with_selftests %{?_without_selftests: 0} %{?!_without_selftests: 1}
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# Additional options for user-friendly one-off kernel building:
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# Only build the base kernel (--with baseonly):
Justin Vreeland 794d92
%define with_baseonly  %{?_with_baseonly:     1} %{?!_with_baseonly:     0}
Justin Vreeland 794d92
# Only build the pae kernel (--with paeonly):
Justin Vreeland 794d92
%define with_paeonly   %{?_with_paeonly:      1} %{?!_with_paeonly:      0}
Justin Vreeland 794d92
# Only build the debug kernel (--with dbgonly):
Justin Vreeland 794d92
%define with_dbgonly   %{?_with_dbgonly:      1} %{?!_with_dbgonly:      0}
Justin Vreeland 794d92
# Control whether we perform a compat. check against published ABI.
Justin Vreeland 735474
%define with_kabichk   %{?_without_kabichk:   0} %{?!_without_kabichk:   0}
Justin Vreeland 794d92
# Temporarily disable kabi checks until RC.
Justin Vreeland 794d92
%define with_kabichk 0
Justin Vreeland 794d92
# Control whether we perform a compat. check against DUP ABI.
Justin Vreeland 794d92
%define with_kabidupchk %{?_with_kabidupchk:  1} %{?!_with_kabidupchk:   0}
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# Control whether to run an extensive DWARF based kABI check.
Justin Vreeland 794d92
# Note that this option needs to have baseline setup in SOURCE300.
Justin Vreeland 794d92
%define with_kabidwchk %{?_without_kabidwchk: 0} %{?!_without_kabidwchk: 1}
Justin Vreeland 794d92
%define with_kabidw_base %{?_with_kabidw_base: 1} %{?!_with_kabidw_base: 0}
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# should we do C=1 builds with sparse
Justin Vreeland 794d92
%define with_sparse    %{?_with_sparse:       1} %{?!_with_sparse:       0}
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# Cross compile requested?
Justin Vreeland 794d92
%define with_cross    %{?_with_cross:         1} %{?!_with_cross:        0}
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# build a release kernel on rawhide
Justin Vreeland 794d92
%define with_release   %{?_with_release:      1} %{?!_with_release:      0}
Justin Vreeland 794d92
Justin Vreeland 794d92
# verbose build, i.e. no silent rules and V=1
Justin Vreeland 794d92
%define with_verbose %{?_with_verbose:        1} %{?!_with_verbose:      0}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# check for mismatched config options
Justin Vreeland 794d92
%define with_configchecks %{?_without_configchecks:        0} %{?!_without_configchecks:        1}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# gcov support
Justin Vreeland 794d92
%define with_gcov %{?_with_gcov:1}%{?!_with_gcov:0}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# ipa_clone support
Justin Vreeland 794d92
%define with_ipaclones %{?_without_ipaclones: 0} %{?!_without_ipaclones: 1}
Justin Vreeland 794d92
Justin Vreeland 794d92
# Want to build a vanilla kernel build without any non-upstream patches?
Justin Vreeland 794d92
%define with_vanilla %{?_with_vanilla: 1} %{?!_with_vanilla: 0}
Justin Vreeland 794d92
Justin Vreeland 794d92
# Set debugbuildsenabled to 1 for production (build separate debug kernels)
Justin Vreeland 794d92
#  and 0 for rawhide (all kernels are debug kernels).
Justin Vreeland 794d92
# See also 'make debug' and 'make release'.
Justin Vreeland 794d92
%define debugbuildsenabled 1
Justin Vreeland 794d92
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
# Kernel headers are being split out into a separate package
Justin Vreeland 794d92
%define with_headers 0
Justin Vreeland 794d92
%define with_cross_headers 0
Justin Vreeland 794d92
# no selftests for now
Justin Vreeland 794d92
%define with_selftests 0
Justin Vreeland 794d92
# no ipa_clone for now
Justin Vreeland 794d92
%define with_ipaclones 0
Justin Vreeland 794d92
# no whitelist
Justin Vreeland 794d92
%define with_kernel_abi_whitelists 0
Justin Vreeland 794d92
# Fedora builds these separately
Justin Vreeland 794d92
%define with_perf 0
Justin Vreeland 794d92
%define with_tools 0
Justin Vreeland 794d92
%define with_bpftool 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_verbose}
Justin Vreeland 794d92
%define make_opts V=1
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define make_opts -s
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# pkg_release is what we'll fill in for the rpm Release: field
Justin Vreeland 794d92
%if 0%{?released_kernel}
Justin Vreeland 794d92
Justin Vreeland 794d92
%define pkg_release %{fedora_build}%{?buildid}%{?dist}
Justin Vreeland 794d92
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
Justin Vreeland 794d92
# non-released_kernel
Justin Vreeland 794d92
%if 0%{?rcrev}
Justin Vreeland 794d92
%define rctag .rc%rcrev
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define rctag .rc0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%if 0%{?gitrev}
Justin Vreeland 794d92
%define gittag .git%gitrev
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define gittag .git0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%define pkg_release 0%{?rctag}%{?gittag}.%{fedora_build}%{?buildid}%{?dist}
Justin Vreeland 794d92
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# The kernel tarball/base version
Justin Vreeland 794d92
%define kversion 5.%{base_sublevel}
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
# turn off debug kernel and kabichk for gcov builds
Justin Vreeland 794d92
%if %{with_gcov}
Justin Vreeland 794d92
%define with_debug 0
Justin Vreeland 794d92
%define with_kabichk 0
Justin Vreeland 794d92
%define with_kabidupchk 0
Justin Vreeland 794d92
%define with_kabidwchk 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# turn off kABI DWARF-based check if we're generating the base dataset
Justin Vreeland 794d92
%if %{with_kabidw_base}
Justin Vreeland 794d92
%define with_kabidwchk 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# kpatch_kcflags are extra compiler flags applied to base kernel
Justin Vreeland 794d92
# -fdump-ipa-clones is enabled only for base kernels on selected arches
Justin Vreeland 794d92
%if %{with_ipaclones}
Justin Vreeland 794d92
%ifarch x86_64 ppc64le
Justin Vreeland 794d92
%define kpatch_kcflags -fdump-ipa-clones
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define with_ipaclones 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%define make_target bzImage
Justin Vreeland 794d92
%define image_install_path boot
Justin Vreeland 794d92
Justin Vreeland 794d92
%define KVERREL %{version}-%{release}.%{_target_cpu}
Justin Vreeland 794d92
%define KVERREL_RE %(echo %KVERREL | sed 's/+/[+]/g')
Justin Vreeland 794d92
%define hdrarch %_target_cpu
Justin Vreeland 794d92
%define asmarch %_target_cpu
Justin Vreeland 794d92
Justin Vreeland 794d92
%if 0%{!?nopatches:1}
Justin Vreeland 794d92
%define nopatches 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_vanilla}
Justin Vreeland 794d92
%define nopatches 1
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{nopatches}
Justin Vreeland 794d92
%define variant -vanilla
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if !%{debugbuildsenabled}
Justin Vreeland 794d92
%define with_debug 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if !%{with_debuginfo}
Justin Vreeland 794d92
%define _enable_debug_packages 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%define debuginfodir /usr/lib/debug
Justin Vreeland 794d92
# Needed because we override almost everything involving build-ids
Justin Vreeland 794d92
# and debuginfo generation. Currently we rely on the old alldebug setting.
Justin Vreeland 794d92
%global _build_id_links alldebug
Justin Vreeland 794d92
Justin Vreeland 794d92
# kernel PAE is only built on ARMv7
Justin Vreeland 794d92
%ifnarch armv7hl
Justin Vreeland 794d92
%define with_pae 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# if requested, only build base kernel
Justin Vreeland 794d92
%if %{with_baseonly}
Justin Vreeland 794d92
%define with_pae 0
Justin Vreeland 794d92
%define with_debug 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# if requested, only build pae kernel
Justin Vreeland 794d92
%if %{with_paeonly}
Justin Vreeland 794d92
%define with_up 0
Justin Vreeland 794d92
%define with_debug 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# if requested, only build debug kernel
Justin Vreeland 794d92
%if %{with_dbgonly}
Justin Vreeland 794d92
%if %{debugbuildsenabled}
Justin Vreeland 794d92
%define with_up 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%define with_pae 0
Justin Vreeland 794d92
%define with_tools 0
Justin Vreeland 794d92
%define with_perf 0
Justin Vreeland 794d92
%define with_bpftool 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# turn off kABI DUP check and DWARF-based check if kABI check is disabled
Justin Vreeland 794d92
%if !%{with_kabichk}
Justin Vreeland 794d92
%define with_kabidupchk 0
Justin Vreeland 794d92
%define with_kabidwchk 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_vdso_install}
Justin Vreeland 794d92
%define use_vdso 1
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifnarch noarch
Justin Vreeland 794d92
%define with_kernel_abi_whitelists 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# Overrides for generic default options
Justin Vreeland 794d92
Justin Vreeland 794d92
# only package docs noarch
Justin Vreeland 794d92
%ifnarch noarch
Justin Vreeland 794d92
%define with_doc 0
Justin Vreeland 794d92
%define doc_build_fail true
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
# don't do debug builds on anything but i686 and x86_64
Justin Vreeland 794d92
%ifnarch i686 x86_64
Justin Vreeland 794d92
%define with_debug 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# don't build noarch kernels or headers (duh)
Justin Vreeland 794d92
%ifarch noarch
Justin Vreeland 794d92
%define with_up 0
Justin Vreeland 794d92
%define with_headers 0
Justin Vreeland 794d92
%define with_cross_headers 0
Justin Vreeland 794d92
%define with_tools 0
Justin Vreeland 794d92
%define with_perf 0
Justin Vreeland 794d92
%define with_bpftool 0
Justin Vreeland 794d92
%define with_selftests 0
Justin Vreeland 794d92
%define with_debug 0
Justin Vreeland 794d92
%define all_arch_configs kernel-%{version}-*.config
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# sparse blows up on ppc
Justin Vreeland 794d92
%ifnarch ppc64le
Justin Vreeland 794d92
%define with_sparse 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# zfcpdump mechanism is s390 only
Justin Vreeland 794d92
%ifnarch s390x
Justin Vreeland 794d92
%define with_zfcpdump 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
# This is not for Fedora
Justin Vreeland 794d92
%define with_zfcpdump 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# Per-arch tweaks
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifarch i686
Justin Vreeland 794d92
%define asmarch x86
Justin Vreeland 794d92
%define hdrarch i386
Justin Vreeland 794d92
%define all_arch_configs kernel-%{version}-i?86*.config
Justin Vreeland 794d92
%define kernel_image arch/x86/boot/bzImage
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifarch x86_64
Justin Vreeland 794d92
%define asmarch x86
Justin Vreeland 794d92
%define all_arch_configs kernel-%{version}-x86_64*.config
Justin Vreeland 794d92
%define kernel_image arch/x86/boot/bzImage
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifarch ppc64le
Justin Vreeland 794d92
%define asmarch powerpc
Justin Vreeland 794d92
%define hdrarch powerpc
Justin Vreeland 794d92
%define make_target vmlinux
Justin Vreeland 794d92
%define kernel_image vmlinux
Justin Vreeland 794d92
%define kernel_image_elf 1
Justin Vreeland 794d92
%define all_arch_configs kernel-%{version}-ppc64le*.config
Justin Vreeland 794d92
%define kcflags -O3
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifarch s390x
Justin Vreeland 794d92
%define asmarch s390
Justin Vreeland 794d92
%define hdrarch s390
Justin Vreeland 794d92
%define all_arch_configs kernel-%{version}-s390x.config
Justin Vreeland 794d92
%define kernel_image arch/s390/boot/bzImage
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifarch %{arm}
Justin Vreeland 794d92
%define all_arch_configs kernel-%{version}-arm*.config
Justin Vreeland 794d92
%define skip_nonpae_vdso 1
Justin Vreeland 794d92
%define asmarch arm
Justin Vreeland 794d92
%define hdrarch arm
Justin Vreeland 794d92
%define make_target bzImage
Justin Vreeland 794d92
%define kernel_image arch/arm/boot/zImage
Justin Vreeland 794d92
# http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/091404.html
Justin Vreeland 794d92
%define kernel_mflags KALLSYMS_EXTRA_PASS=1
Justin Vreeland 794d92
# we only build headers/perf/tools on the base arm arches
Justin Vreeland 794d92
# just like we used to only build them on i386 for x86
Justin Vreeland 794d92
%ifnarch armv7hl
Justin Vreeland 794d92
%define with_headers 0
Justin Vreeland 794d92
%define with_cross_headers 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
# These currently don't compile on armv7
Justin Vreeland 794d92
%define with_selftests 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifarch aarch64
Justin Vreeland 794d92
%define all_arch_configs kernel-%{version}-aarch64*.config
Justin Vreeland 794d92
%define asmarch arm64
Justin Vreeland 794d92
%define hdrarch arm64
Justin Vreeland 794d92
%define make_target Image.gz
Justin Vreeland 794d92
%define kernel_image arch/arm64/boot/Image.gz
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# Should make listnewconfig fail if there's config options
Justin Vreeland 794d92
# printed out?
Justin Vreeland 794d92
%if %{nopatches}
Justin Vreeland 794d92
%define with_configchecks 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# To temporarily exclude an architecture from being built, add it to
Justin Vreeland 794d92
# %%nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we
Justin Vreeland 794d92
# don't build kernel-headers then the new build system will no longer let
Justin Vreeland 794d92
# us use the previous build of that package -- it'll just be completely AWOL.
Justin Vreeland 794d92
# Which is a BadThing(tm).
Justin Vreeland 794d92
Justin Vreeland 794d92
# We only build kernel-headers on the following...
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
%define nobuildarches i386
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define nobuildarches i386 i686
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifarch %nobuildarches
Justin Vreeland 794d92
%define with_up 0
Justin Vreeland 794d92
%define with_debug 0
Justin Vreeland 794d92
%define with_debuginfo 0
Justin Vreeland 794d92
%define with_perf 0
Justin Vreeland 794d92
%define with_tools 0
Justin Vreeland 794d92
%define with_bpftool 0
Justin Vreeland 794d92
%define with_selftests 0
Justin Vreeland 794d92
%define with_pae 0
Justin Vreeland 794d92
%define _enable_debug_packages 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# Architectures we build tools/cpupower on
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
%define cpupowerarchs %{ix86} x86_64 ppc64le %{arm} aarch64
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define cpupowerarchs i686 x86_64 ppc64le aarch64
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{use_vdso}
Justin Vreeland 794d92
Justin Vreeland 794d92
%if 0%{?skip_nonpae_vdso}
Justin Vreeland 794d92
%define _use_vdso 0
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define _use_vdso 1
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define _use_vdso 0
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# Packages that need to be installed before the kernel is, because the %%post
Justin Vreeland 794d92
# scripts use them.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_prereq  coreutils, systemd >= 203-2, /usr/bin/kernel-install
Justin Vreeland 794d92
%define initrd_prereq  dracut >= 027
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
Name: kernel%{?variant}
Justin Vreeland 794d92
License: GPLv2 and Redistributable, no modification permitted
Justin Vreeland 794d92
URL: https://www.kernel.org/
Justin Vreeland 794d92
Version: %{rpmversion}
Justin Vreeland 794d92
Release: %{pkg_release}
Justin Vreeland 794d92
# DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD.
Justin Vreeland 794d92
# SET %%nobuildarches (ABOVE) INSTEAD
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
ExclusiveArch: x86_64 s390x %{arm} aarch64 ppc64le
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
ExclusiveArch: noarch i386 i686 x86_64 s390x %{arm} aarch64 ppc64le
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
ExclusiveOS: Linux
Justin Vreeland 794d92
%ifnarch %{nobuildarches}
Justin Vreeland 794d92
Requires: kernel-core-uname-r = %{KVERREL}%{?variant}
Justin Vreeland 794d92
Requires: kernel-modules-uname-r = %{KVERREL}%{?variant}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# List the packages used during the kernel build
Justin Vreeland 794d92
#
Justin Vreeland 794d92
BuildRequires: kmod, patch, bash, tar, git-core
Justin Vreeland 794d92
BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk
Justin Vreeland 794d92
BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc, bison, flex
Justin Vreeland 794d92
BuildRequires: net-tools, hostname, bc, elfutils-devel
Justin Vreeland 794d92
BuildRequires: dwarves
Justin Vreeland 794d92
# Used to mangle unversioned shebangs to be Python 3
Justin Vreeland 794d92
BuildRequires: python3-devel
Justin Vreeland 794d92
%if %{with_headers}
Justin Vreeland 794d92
BuildRequires: rsync
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%if %{with_doc}
Justin Vreeland 794d92
BuildRequires: xmlto, asciidoc, python3-sphinx
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%if %{with_sparse}
Justin Vreeland 794d92
BuildRequires: sparse
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%if %{with_perf}
Justin Vreeland 794d92
BuildRequires: zlib-devel binutils-devel newt-devel perl(ExtUtils::Embed) bison flex xz-devel
Justin Vreeland 794d92
BuildRequires: audit-libs-devel
Justin Vreeland 794d92
BuildRequires: java-devel
Justin Vreeland 794d92
%ifnarch %{arm} s390x
Justin Vreeland 794d92
BuildRequires: numactl-devel
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%if %{with_tools}
Justin Vreeland 794d92
BuildRequires: gettext ncurses-devel
Justin Vreeland 794d92
%ifnarch s390x
Justin Vreeland 794d92
BuildRequires: pciutils-devel
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%if %{with_bpftool}
Justin Vreeland 794d92
BuildRequires: python3-docutils
Justin Vreeland 794d92
BuildRequires: zlib-devel binutils-devel
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%if %{with_selftests}
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
BuildRequires: clang llvm
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
BuildRequires: llvm-toolset
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%ifnarch %{arm}
Justin Vreeland 794d92
BuildRequires: numactl-devel
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
BuildRequires: libcap-devel libcap-ng-devel rsync
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
BuildConflicts: rhbuildsys(DiskFree) < 500Mb
Justin Vreeland 794d92
%if %{with_debuginfo}
Justin Vreeland 794d92
BuildRequires: rpm-build, elfutils
Justin Vreeland 794d92
BuildConflicts: rpm < 4.13.0.1-19
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
BuildConflicts: dwarves < 1.13
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
# Most of these should be enabled after more investigation
Justin Vreeland 794d92
%undefine _include_minidebuginfo
Justin Vreeland 794d92
%undefine _find_debuginfo_dwz_opts
Justin Vreeland 794d92
%undefine _unique_build_ids
Justin Vreeland 794d92
%undefine _unique_debug_names
Justin Vreeland 794d92
%undefine _unique_debug_srcs
Justin Vreeland 794d92
%undefine _debugsource_packages
Justin Vreeland 794d92
%undefine _debuginfo_subpackages
Justin Vreeland 794d92
%global _find_debuginfo_opts -r
Justin Vreeland 794d92
%global _missing_build_ids_terminate_build 1
Justin Vreeland 794d92
%global _no_recompute_build_ids 1
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%if %{with_kabidwchk} || %{with_kabidw_base}
Justin Vreeland 794d92
BuildRequires: kabi-dw
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{signkernel}%{signmodules}
Justin Vreeland 794d92
BuildRequires: openssl openssl-devel
Justin Vreeland 794d92
%if %{signkernel}
Justin Vreeland 794d92
%ifarch x86_64 aarch64
Justin Vreeland 794d92
BuildRequires: nss-tools
Justin Vreeland 794d92
BuildRequires: pesign >= 0.10-4
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_cross}
Justin Vreeland 794d92
BuildRequires: binutils-%{_build_arch}-linux-gnu, gcc-%{_build_arch}-linux-gnu
Justin Vreeland 794d92
%define cross_opts CROSS_COMPILE=%{_build_arch}-linux-gnu-
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# These below are required to build man pages
Justin Vreeland 794d92
%if %{with_perf}
Justin Vreeland 794d92
BuildRequires: xmlto
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%if %{with_perf} || %{with_tools}
Justin Vreeland 794d92
BuildRequires: asciidoc
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
Source0: https://www.kernel.org/pub/linux/kernel/v5.x/linux-%{kversion}.tar.xz
Justin Vreeland 794d92
Justin Vreeland 794d92
# Name of the packaged file containing signing key
Justin Vreeland 794d92
%ifarch ppc64le
Justin Vreeland 794d92
%define signing_key_filename kernel-signing-ppc.cer
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%ifarch s390x
Justin Vreeland 794d92
%define signing_key_filename kernel-signing-s390.cer
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
Source10: x509.genkey.rhel
Justin Vreeland 794d92
Source11: x509.genkey.fedora
Justin Vreeland 794d92
%if %{?released_kernel}
Justin Vreeland 794d92
Justin Vreeland 794d92
Source12: redhatsecurebootca5.cer
Justin Vreeland 794d92
Source13: redhatsecurebootca1.cer
Justin Vreeland 794d92
Source14: redhatsecureboot501.cer
Justin Vreeland 794d92
Source15: redhatsecureboot301.cer
Justin Vreeland 794d92
Source16: secureboot_s390.cer
Justin Vreeland 794d92
Source17: secureboot_ppc.cer
Justin Vreeland 794d92
Justin Vreeland 794d92
%define secureboot_ca_1 %{SOURCE12}
Justin Vreeland 794d92
%define secureboot_ca_0 %{SOURCE13}
Justin Vreeland 794d92
%ifarch x86_64 aarch64
Justin Vreeland 794d92
%define secureboot_key_1 %{SOURCE14}
Justin Vreeland 794d92
%define pesign_name_1 redhatsecureboot501
Justin Vreeland 794d92
%define secureboot_key_0 %{SOURCE15}
Justin Vreeland 794d92
%define pesign_name_0 redhatsecureboot301
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%ifarch s390x
Justin Vreeland 794d92
%define secureboot_key_0 %{SOURCE16}
Justin Vreeland 794d92
%define pesign_name_0 redhatsecureboot302
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%ifarch ppc64le
Justin Vreeland 794d92
%define secureboot_key_0 %{SOURCE17}
Justin Vreeland 794d92
%define pesign_name_0 redhatsecureboot303
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# released_kernel
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
Justin Vreeland 794d92
Source12: redhatsecurebootca4.cer
Justin Vreeland 794d92
Source13: redhatsecurebootca2.cer
Justin Vreeland 794d92
Source14: redhatsecureboot401.cer
Justin Vreeland 794d92
Source15: redhatsecureboot003.cer
Justin Vreeland 794d92
Justin Vreeland 794d92
%define secureboot_ca_1 %{SOURCE12}
Justin Vreeland 794d92
%define secureboot_ca_0 %{SOURCE13}
Justin Vreeland 794d92
%define secureboot_key_1 %{SOURCE14}
Justin Vreeland 794d92
%define pesign_name_1 redhatsecureboot401
Justin Vreeland 794d92
%define secureboot_key_0 %{SOURCE15}
Justin Vreeland 794d92
%define pesign_name_0 redhatsecureboot003
Justin Vreeland 794d92
Justin Vreeland 794d92
# released_kernel
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
Source22: mod-extra.list.rhel
Justin Vreeland 794d92
Source23: mod-extra.list.fedora
Justin Vreeland 794d92
Source24: mod-extra.sh
Justin Vreeland 794d92
Source18: mod-sign.sh
Justin Vreeland 794d92
Source19: mod-extra-blacklist.sh
Justin Vreeland 794d92
Source79: parallel_xz.sh
Justin Vreeland 794d92
Justin Vreeland 794d92
Source80: filter-x86_64.sh.fedora
Justin Vreeland 794d92
Source81: filter-armv7hl.sh.fedora
Justin Vreeland 794d92
Source82: filter-i686.sh.fedora
Justin Vreeland 794d92
Source83: filter-aarch64.sh.fedora
Justin Vreeland 794d92
Source86: filter-ppc64le.sh.fedora
Justin Vreeland 794d92
Source87: filter-s390x.sh.fedora
Justin Vreeland 794d92
Source89: filter-modules.sh.fedora
Justin Vreeland 794d92
Justin Vreeland 794d92
Source90: filter-x86_64.sh.rhel
Justin Vreeland 794d92
Source91: filter-armv7hl.sh.rhel
Justin Vreeland 794d92
Source92: filter-i686.sh.rhel
Justin Vreeland 794d92
Source93: filter-aarch64.sh.rhel
Justin Vreeland 794d92
Source96: filter-ppc64le.sh.rhel
Justin Vreeland 794d92
Source97: filter-s390x.sh.rhel
Justin Vreeland 794d92
Source99: filter-modules.sh.rhel
Justin Vreeland 794d92
%define modsign_cmd %{SOURCE18}
Justin Vreeland 794d92
Justin Vreeland 794d92
Source20: kernel-aarch64-rhel.config
Justin Vreeland 794d92
Source21: kernel-aarch64-debug-rhel.config
Justin Vreeland 794d92
Source30: kernel-ppc64le-rhel.config
Justin Vreeland 794d92
Source31: kernel-ppc64le-debug-rhel.config
Justin Vreeland 794d92
Source32: kernel-s390x-rhel.config
Justin Vreeland 794d92
Source33: kernel-s390x-debug-rhel.config
Justin Vreeland 794d92
Source34: kernel-s390x-zfcpdump-rhel.config
Justin Vreeland 794d92
Source35: kernel-x86_64-rhel.config
Justin Vreeland 794d92
Source36: kernel-x86_64-debug-rhel.config
Justin Vreeland 794d92
Justin Vreeland 794d92
Source37: kernel-aarch64-fedora.config
Justin Vreeland 794d92
Source38: kernel-aarch64-debug-fedora.config
Justin Vreeland 794d92
Source39: kernel-armv7hl-fedora.config
Justin Vreeland 794d92
Source40: kernel-armv7hl-debug-fedora.config
Justin Vreeland 794d92
Source41: kernel-armv7hl-lpae-fedora.config
Justin Vreeland 794d92
Source42: kernel-armv7hl-lpae-debug-fedora.config
Justin Vreeland 794d92
Source43: kernel-i686-fedora.config
Justin Vreeland 794d92
Source44: kernel-i686-debug-fedora.config
Justin Vreeland 794d92
Source45: kernel-ppc64le-fedora.config
Justin Vreeland 794d92
Source46: kernel-ppc64le-debug-fedora.config
Justin Vreeland 794d92
Source47: kernel-s390x-fedora.config
Justin Vreeland 794d92
Source48: kernel-s390x-debug-fedora.config
Justin Vreeland 794d92
Source49: kernel-x86_64-fedora.config
Justin Vreeland 794d92
Source50: kernel-x86_64-debug-fedora.config
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
Source51: generate_all_configs.sh
Justin Vreeland 794d92
Justin Vreeland 794d92
Source52: process_configs.sh
Justin Vreeland 794d92
Source53: generate_bls_conf.sh
Justin Vreeland 794d92
Source56: update_scripts.sh
Justin Vreeland 794d92
Justin Vreeland 794d92
Source54: mod-internal.list
Justin Vreeland 794d92
Source55: merge.pl
Justin Vreeland 794d92
Justin Vreeland 794d92
Source200: check-kabi
Justin Vreeland 794d92
Justin Vreeland 794d92
Source201: Module.kabi_aarch64
Justin Vreeland 794d92
Source202: Module.kabi_ppc64le
Justin Vreeland 794d92
Source203: Module.kabi_s390x
Justin Vreeland 794d92
Source204: Module.kabi_x86_64
Justin Vreeland 794d92
Justin Vreeland 794d92
Source210: Module.kabi_dup_aarch64
Justin Vreeland 794d92
Source211: Module.kabi_dup_ppc64le
Justin Vreeland 794d92
Source212: Module.kabi_dup_s390x
Justin Vreeland 794d92
Source213: Module.kabi_dup_x86_64
Justin Vreeland 794d92
Justin Vreeland 735474
#Source300: kernel-abi-whitelists-%{rpmversion}-%{distro_build}.tar.bz2
Justin Vreeland 735474
#Source301: kernel-kabi-dw-%{rpmversion}-%{distro_build}.tar.bz2
Justin Vreeland 794d92
Justin Vreeland 794d92
# Sources for kernel-tools
Justin Vreeland 794d92
Source2000: cpupower.service
Justin Vreeland 794d92
Source2001: cpupower.config
Justin Vreeland 794d92
Justin Vreeland 794d92
# CentOS SIG HyperScale config(s)
Justin Vreeland 794d92
Source3001: kernel-x86_64-centos-sig-hyperscale.config
Justin Vreeland 794d92
Source3002: kernel-x86_64-debug-centos-sig-hyperscale.config
Justin Vreeland 794d92
Justin Vreeland 794d92
Source3003: filter-aarch64.sh.centos-sig-hyperscale
Justin Vreeland 794d92
Source3004: filter-armv7hl.sh.centos-sig-hyperscale
Justin Vreeland 794d92
Source3005: filter-i686.sh.centos-sig-hyperscale
Justin Vreeland 794d92
Source3006: filter-modules.sh.centos-sig-hyperscale
Justin Vreeland 794d92
Source3007: filter-ppc64le.sh.centos-sig-hyperscale
Justin Vreeland 794d92
Source3008: filter-s390x.sh.centos-sig-hyperscale
Justin Vreeland 794d92
Source3009: filter-x86_64.sh.centos-sig-hyperscale
Justin Vreeland 794d92
Source3010: mod-extra.list.centos-sig-hyperscale
Justin Vreeland 794d92
Source3011: x509.genkey.centos-sig-hyperscale
Justin Vreeland 794d92
Justin Vreeland 794d92
## Patches needed for building this package
Justin Vreeland 794d92
Justin Vreeland 794d92
# Patch1: patch-%{rpmversion}-redhat.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# empty final patch to facilitate testing of kernel patches
Justin Vreeland 794d92
# Patch999999: linux-kernel-test.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# This file is intentionally left empty in the stock kernel. Its a nicety
Justin Vreeland 794d92
# added for those wanting to do custom rebuilds with altered config opts.
Justin Vreeland 794d92
Source1000: kernel-local
Justin Vreeland 794d92
Justin Vreeland 794d92
# Here should be only the patches up to the upstream canonical Linus tree.
Justin Vreeland 794d92
Justin Vreeland 794d92
# For a stable release kernel
Justin Vreeland 794d92
%if 0%{?stable_update}
Justin Vreeland 794d92
%if 0%{?stable_base}
Justin Vreeland 794d92
%define    stable_patch_00  patch-5.%{base_sublevel}.%{stable_base}.xz
Justin Vreeland 794d92
Source5000: %{stable_patch_00}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# non-released_kernel case
Justin Vreeland 794d92
# These are automagically defined by the rcrev and gitrev values set up
Justin Vreeland 794d92
# near the top of this spec file.
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%if 0%{?rcrev}
Justin Vreeland 794d92
Source5000: patch-5.%{upstream_sublevel}-rc%{rcrev}.xz
Justin Vreeland 794d92
%if 0%{?gitrev}
Justin Vreeland 794d92
Source5001: patch-5.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}.xz
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
# pre-{base_sublevel+1}-rc1 case
Justin Vreeland 794d92
%if 0%{?gitrev}
Justin Vreeland 794d92
Source5000: patch-5.%{base_sublevel}-git%{gitrev}.xz
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
## Patches needed for building this package
Justin Vreeland 794d92
Justin Vreeland 794d92
## compile fixes
Justin Vreeland 794d92
Justin Vreeland 794d92
%if !%{nopatches}
Justin Vreeland 794d92
Justin Vreeland 794d92
Patch6: 0001-ACPI-APEI-arm64-Ignore-broken-HPE-moonshot-APEI-supp.patch
Justin Vreeland 794d92
Patch8: 0001-ACPI-irq-Workaround-firmware-issue-on-X-Gene-based-m.patch
Justin Vreeland 794d92
Patch9: 0001-aarch64-acpi-scan-Fix-regression-related-to-X-Gene-U.patch
Justin Vreeland 794d92
Patch11: 0001-kdump-round-up-the-total-memory-size-to-128M-for-cra.patch
Justin Vreeland 794d92
Patch12: 0001-kdump-add-support-for-crashkernel-auto.patch
Justin Vreeland 794d92
Patch15: 0001-kdump-fix-a-grammar-issue-in-a-kernel-message.patch
Justin Vreeland 794d92
Patch19: 0001-Vulcan-AHCI-PCI-bar-fix-for-Broadcom-Vulcan-early-si.patch
Justin Vreeland 794d92
Patch20: 0001-ahci-thunderx2-Fix-for-errata-that-affects-stop-engi.patch
Justin Vreeland 794d92
Patch24: 0001-scsi-smartpqi-add-inspur-advantech-ids.patch
Justin Vreeland 794d92
Patch26: 0001-ipmi-do-not-configure-ipmi-for-HPE-m400.patch
Justin Vreeland 794d92
Patch28: 0001-iommu-arm-smmu-workaround-DMA-mode-issues.patch
Justin Vreeland 794d92
Patch29: 0001-arm-aarch64-Drop-the-EXPERT-setting-from-ARM64_FORCE.patch
Justin Vreeland 794d92
Patch31: 0001-Add-efi_status_to_str-and-rework-efi_status_to_err.patch
Justin Vreeland 794d92
Patch32: 0001-Make-get_cert_list-use-efi_status_to_str-to-print-er.patch
Justin Vreeland 794d92
Patch33: 0001-security-lockdown-expose-a-hook-to-lock-the-kernel-d.patch
Justin Vreeland 794d92
Patch34: 0001-efi-Add-an-EFI_SECURE_BOOT-flag-to-indicate-secure-b.patch
Justin Vreeland 794d92
Patch35: 0001-efi-Lock-down-the-kernel-if-booted-in-secure-boot-mo.patch
Justin Vreeland 794d92
Patch36: 0001-s390-Lock-down-the-kernel-when-the-IPL-secure-flag-i.patch
Justin Vreeland 794d92
Patch37: 0001-Add-option-of-13-for-FORCE_MAX_ZONEORDER.patch
Justin Vreeland 794d92
Patch58: 0001-arm-make-CONFIG_HIGHPTE-optional-without-CONFIG_EXPE.patch
Justin Vreeland 794d92
Patch59: 0001-ARM-tegra-usb-no-reset.patch
Justin Vreeland 794d92
Patch61: 0001-Input-rmi4-remove-the-need-for-artificial-IRQ-in-cas.patch
Justin Vreeland 794d92
Patch62: 0001-Drop-that-for-now.patch
Justin Vreeland 794d92
Patch63: 0001-KEYS-Make-use-of-platform-keyring-for-module-signatu.patch
Justin Vreeland 794d92
Patch64: 0001-mm-kmemleak-skip-late_init-if-not-skip-disable.patch
Justin Vreeland 794d92
Patch65: 0001-ARM-fix-__get_user_check-in-case-uaccess_-calls-are-.patch
Justin Vreeland 794d92
Patch66: 0001-dt-bindings-panel-add-binding-for-Xingbangda-XBD599-.patch
Justin Vreeland 794d92
Patch67: 0001-drm-panel-add-Xingbangda-XBD599-panel.patch
Justin Vreeland 794d92
Patch68: 0001-drm-sun4i-sun6i_mipi_dsi-fix-horizontal-timing-calcu.patch
Justin Vreeland 794d92
Patch72: 0001-Work-around-for-gcc-bug-https-gcc.gnu.org-bugzilla-s.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# https://patchwork.kernel.org/patch/11796255/
Justin Vreeland 794d92
Patch100: arm64-dts-rockchip-disable-USB-type-c-DisplayPort.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# Tegra fixes
Justin Vreeland 794d92
Patch101: 0001-PCI-Add-MCFG-quirks-for-Tegra194-host-controllers.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# A patch to fix some undocumented things broke a bunch of Allwinner networks due to wrong assumptions
Justin Vreeland 794d92
Patch102: 0001-update-phy-on-pine64-a64-devices.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# OMAP Pandaboard fix
Justin Vreeland 794d92
Patch103: arm-pandaboard-fix-add-bluetooth.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# Fix for USB on some newer RPi4 / firmware combinations
Justin Vreeland 794d92
Patch104: 0001-brcm-rpi4-fix-usb-numeration.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# RPi-4 and wifi issues
Justin Vreeland 794d92
Patch105: arm-dts-rpi-4-disable-wifi-frequencies.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# fix python shebangs
Justin Vreeland 794d92
Patch106: switch-some-more-scripts-explicitly-to-python-3.patch
Justin Vreeland 794d92
# fix bad config options
Justin Vreeland 794d92
Patch107: fix-config-option.patch
Justin Vreeland 794d92
Justin Vreeland 794d92
# END OF PATCH DEFINITIONS
Justin Vreeland 794d92
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
%description
Justin Vreeland 794d92
The kernel meta package
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro does requires, provides, conflicts, obsoletes for a kernel package.
Justin Vreeland 794d92
#	%%kernel_reqprovconf <subpackage>
Justin Vreeland 794d92
# It uses any kernel_<subpackage>_conflicts and kernel_<subpackage>_obsoletes
Justin Vreeland 794d92
# macros defined above.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_reqprovconf \
Justin Vreeland 794d92
Provides: kernel = %{rpmversion}-%{pkg_release}\
Justin Vreeland 794d92
Provides: kernel-%{_target_cpu} = %{rpmversion}-%{pkg_release}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: kernel-drm-nouveau = 16\
Justin Vreeland 794d92
Provides: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
Requires(pre): %{kernel_prereq}\
Justin Vreeland 794d92
Requires(pre): %{initrd_prereq}\
Justin Vreeland 794d92
Requires(pre): linux-firmware >= 20150904-56.git6ebf5d57\
Justin Vreeland 794d92
Requires(preun): systemd >= 200\
Justin Vreeland 794d92
Conflicts: xfsprogs < 4.3.0-1\
Justin Vreeland 794d92
Conflicts: xorg-x11-drv-vmmouse < 13.0.99\
Justin Vreeland 794d92
%{expand:%%{?kernel%{?1:_%{1}}_conflicts:Conflicts: %%{kernel%{?1:_%{1}}_conflicts}}}\
Justin Vreeland 794d92
%{expand:%%{?kernel%{?1:_%{1}}_obsoletes:Obsoletes: %%{kernel%{?1:_%{1}}_obsoletes}}}\
Justin Vreeland 794d92
%{expand:%%{?kernel%{?1:_%{1}}_provides:Provides: %%{kernel%{?1:_%{1}}_provides}}}\
Justin Vreeland 794d92
# We can't let RPM do the dependencies automatic because it'll then pick up\
Justin Vreeland 794d92
# a correct but undesirable perl dependency from the module headers which\
Justin Vreeland 794d92
# isn't required for the kernel proper to function\
Justin Vreeland 794d92
AutoReq: no\
Justin Vreeland 794d92
AutoProv: yes\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
%package doc
Justin Vreeland 794d92
Summary: Various documentation bits found in the kernel source
Justin Vreeland 794d92
Group: Documentation
Justin Vreeland 794d92
%description doc
Justin Vreeland 794d92
This package contains documentation files from the kernel
Justin Vreeland 794d92
source. Various bits of information about the Linux kernel and the
Justin Vreeland 794d92
device drivers shipped with it are documented in these files.
Justin Vreeland 794d92
Justin Vreeland 794d92
You'll want to install this package if you need a reference to the
Justin Vreeland 794d92
options that can be passed to Linux kernel modules at load time.
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
%package headers
Justin Vreeland 794d92
Summary: Header files for the Linux kernel for use by glibc
Justin Vreeland 794d92
Obsoletes: glibc-kernheaders < 3.0-46
Justin Vreeland 794d92
Provides: glibc-kernheaders = 3.0-46
Justin Vreeland 794d92
%if "0%{?variant}"
Justin Vreeland 794d92
Obsoletes: kernel-headers < %{rpmversion}-%{pkg_release}
Justin Vreeland 794d92
Provides: kernel-headers = %{rpmversion}-%{pkg_release}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%description headers
Justin Vreeland 794d92
Kernel-headers includes the C header files that specify the interface
Justin Vreeland 794d92
between the Linux kernel and userspace libraries and programs.  The
Justin Vreeland 794d92
header files define structures and constants that are needed for
Justin Vreeland 794d92
building most standard programs and are also needed for rebuilding the
Justin Vreeland 794d92
glibc package.
Justin Vreeland 794d92
Justin Vreeland 794d92
%package cross-headers
Justin Vreeland 794d92
Summary: Header files for the Linux kernel for use by cross-glibc
Justin Vreeland 794d92
%description cross-headers
Justin Vreeland 794d92
Kernel-cross-headers includes the C header files that specify the interface
Justin Vreeland 794d92
between the Linux kernel and userspace libraries and programs.  The
Justin Vreeland 794d92
header files define structures and constants that are needed for
Justin Vreeland 794d92
building most standard programs and are also needed for rebuilding the
Justin Vreeland 794d92
cross-glibc package.
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
%package debuginfo-common-%{_target_cpu}
Justin Vreeland 794d92
Summary: Kernel source files used by %{name}-debuginfo packages
Justin Vreeland 794d92
Provides: installonlypkg(kernel)
Justin Vreeland 794d92
%description debuginfo-common-%{_target_cpu}
Justin Vreeland 794d92
This package is required by %{name}-debuginfo subpackages.
Justin Vreeland 794d92
It provides the kernel source files common to all builds.
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_perf}
Justin Vreeland 794d92
%package -n perf
Justin Vreeland 794d92
Summary: Performance monitoring for the Linux kernel
Justin Vreeland 794d92
License: GPLv2
Justin Vreeland 794d92
%description -n perf
Justin Vreeland 794d92
This package contains the perf tool, which enables performance monitoring
Justin Vreeland 794d92
of the Linux kernel.
Justin Vreeland 794d92
Justin Vreeland 794d92
%package -n perf-debuginfo
Justin Vreeland 794d92
Summary: Debug information for package perf
Justin Vreeland 794d92
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
Justin Vreeland 794d92
AutoReqProv: no
Justin Vreeland 794d92
%description -n perf-debuginfo
Justin Vreeland 794d92
This package provides debug information for the perf package.
Justin Vreeland 794d92
Justin Vreeland 794d92
# Note that this pattern only works right to match the .build-id
Justin Vreeland 794d92
# symlinks because of the trailing nonmatching alternation and
Justin Vreeland 794d92
# the leading .*, because of find-debuginfo.sh's buggy handling
Justin Vreeland 794d92
# of matching the pattern against the symlinks file.
Justin Vreeland 794d92
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|.*%%{_libdir}/traceevent/plugins/.*|.*%%{_libdir}/libperf-jvmti.so(\.debug)?|XXX' -o perf-debuginfo.list}
Justin Vreeland 794d92
Justin Vreeland 794d92
%package -n python3-perf
Justin Vreeland 794d92
Summary: Python bindings for apps which will manipulate perf events
Justin Vreeland 794d92
%description -n python3-perf
Justin Vreeland 794d92
The python3-perf package contains a module that permits applications
Justin Vreeland 794d92
written in the Python programming language to use the interface
Justin Vreeland 794d92
to manipulate perf events.
Justin Vreeland 794d92
Justin Vreeland 794d92
%package -n python3-perf-debuginfo
Justin Vreeland 794d92
Summary: Debug information for package perf python bindings
Justin Vreeland 794d92
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
Justin Vreeland 794d92
AutoReqProv: no
Justin Vreeland 794d92
%description -n python3-perf-debuginfo
Justin Vreeland 794d92
This package provides debug information for the perf python bindings.
Justin Vreeland 794d92
Justin Vreeland 794d92
# the python_sitearch macro should already be defined from above
Justin Vreeland 794d92
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{python3_sitearch}/perf.*so(\.debug)?|XXX' -o python3-perf-debuginfo.list}
Justin Vreeland 794d92
Justin Vreeland 794d92
# with_perf
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_tools}
Justin Vreeland 794d92
%package -n kernel-tools
Justin Vreeland 794d92
Summary: Assortment of tools for the Linux kernel
Justin Vreeland 794d92
License: GPLv2
Justin Vreeland 794d92
%ifarch %{cpupowerarchs}
Justin Vreeland 794d92
Provides:  cpupowerutils = 1:009-0.6.p1
Justin Vreeland 794d92
Obsoletes: cpupowerutils < 1:009-0.6.p1
Justin Vreeland 794d92
Provides:  cpufreq-utils = 1:009-0.6.p1
Justin Vreeland 794d92
Provides:  cpufrequtils = 1:009-0.6.p1
Justin Vreeland 794d92
Obsoletes: cpufreq-utils < 1:009-0.6.p1
Justin Vreeland 794d92
Obsoletes: cpufrequtils < 1:009-0.6.p1
Justin Vreeland 794d92
Obsoletes: cpuspeed < 1:1.5-16
Justin Vreeland 794d92
Requires: kernel-tools-libs = %{version}-%{release}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%define __requires_exclude ^%{_bindir}/python
Justin Vreeland 794d92
%description -n kernel-tools
Justin Vreeland 794d92
This package contains the tools/ directory from the kernel source
Justin Vreeland 794d92
and the supporting documentation.
Justin Vreeland 794d92
Justin Vreeland 794d92
%package -n kernel-tools-libs
Justin Vreeland 794d92
Summary: Libraries for the kernels-tools
Justin Vreeland 794d92
License: GPLv2
Justin Vreeland 794d92
%description -n kernel-tools-libs
Justin Vreeland 794d92
This package contains the libraries built from the tools/ directory
Justin Vreeland 794d92
from the kernel source.
Justin Vreeland 794d92
Justin Vreeland 794d92
%package -n kernel-tools-libs-devel
Justin Vreeland 794d92
Summary: Assortment of tools for the Linux kernel
Justin Vreeland 794d92
License: GPLv2
Justin Vreeland 794d92
Requires: kernel-tools = %{version}-%{release}
Justin Vreeland 794d92
%ifarch %{cpupowerarchs}
Justin Vreeland 794d92
Provides:  cpupowerutils-devel = 1:009-0.6.p1
Justin Vreeland 794d92
Obsoletes: cpupowerutils-devel < 1:009-0.6.p1
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Requires: kernel-tools-libs = %{version}-%{release}
Justin Vreeland 794d92
Provides: kernel-tools-devel
Justin Vreeland 794d92
%description -n kernel-tools-libs-devel
Justin Vreeland 794d92
This package contains the development files for the tools/ directory from
Justin Vreeland 794d92
the kernel source.
Justin Vreeland 794d92
Justin Vreeland 794d92
%package -n kernel-tools-debuginfo
Justin Vreeland 794d92
Summary: Debug information for package kernel-tools
Justin Vreeland 794d92
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
Justin Vreeland 794d92
AutoReqProv: no
Justin Vreeland 794d92
%description -n kernel-tools-debuginfo
Justin Vreeland 794d92
This package provides debug information for package kernel-tools.
Justin Vreeland 794d92
Justin Vreeland 794d92
# Note that this pattern only works right to match the .build-id
Justin Vreeland 794d92
# symlinks because of the trailing nonmatching alternation and
Justin Vreeland 794d92
# the leading .*, because of find-debuginfo.sh's buggy handling
Justin Vreeland 794d92
# of matching the pattern against the symlinks file.
Justin Vreeland 794d92
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_bindir}/centrino-decode(\.debug)?|.*%%{_bindir}/powernow-k8-decode(\.debug)?|.*%%{_bindir}/cpupower(\.debug)?|.*%%{_libdir}/libcpupower.*|.*%%{_bindir}/turbostat(\.debug)?|.*%%{_bindir}/x86_energy_perf_policy(\.debug)?|.*%%{_bindir}/tmon(\.debug)?|.*%%{_bindir}/lsgpio(\.debug)?|.*%%{_bindir}/gpio-hammer(\.debug)?|.*%%{_bindir}/gpio-event-mon(\.debug)?|.*%%{_bindir}/iio_event_monitor(\.debug)?|.*%%{_bindir}/iio_generic_buffer(\.debug)?|.*%%{_bindir}/lsiio(\.debug)?|XXX' -o kernel-tools-debuginfo.list}
Justin Vreeland 794d92
Justin Vreeland 794d92
# with_tools
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_bpftool}
Justin Vreeland 794d92
Justin Vreeland 794d92
%package -n bpftool
Justin Vreeland 794d92
Summary: Inspection and simple manipulation of eBPF programs and maps
Justin Vreeland 794d92
License: GPLv2
Justin Vreeland 794d92
%description -n bpftool
Justin Vreeland 794d92
This package contains the bpftool, which allows inspection and simple
Justin Vreeland 794d92
manipulation of eBPF programs and maps.
Justin Vreeland 794d92
Justin Vreeland 794d92
%package -n bpftool-debuginfo
Justin Vreeland 794d92
Summary: Debug information for package bpftool
Justin Vreeland 794d92
Group: Development/Debug
Justin Vreeland 794d92
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
Justin Vreeland 794d92
AutoReqProv: no
Justin Vreeland 794d92
%description -n bpftool-debuginfo
Justin Vreeland 794d92
This package provides debug information for the bpftool package.
Justin Vreeland 794d92
Justin Vreeland 794d92
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_sbindir}/bpftool(\.debug)?|XXX' -o bpftool-debuginfo.list}
Justin Vreeland 794d92
Justin Vreeland 794d92
# with_bpftool
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_selftests}
Justin Vreeland 794d92
Justin Vreeland 794d92
%package selftests-internal
Justin Vreeland 794d92
Summary: Kernel samples and selftests
Justin Vreeland 794d92
License: GPLv2
Justin Vreeland 794d92
Requires: binutils, bpftool, iproute-tc, nmap-ncat
Justin Vreeland 794d92
Requires: kernel-modules-internal = %{version}-%{release}
Justin Vreeland 794d92
%description selftests-internal
Justin Vreeland 794d92
Kernel sample programs and selftests.
Justin Vreeland 794d92
Justin Vreeland 794d92
# Note that this pattern only works right to match the .build-id
Justin Vreeland 794d92
# symlinks because of the trailing nonmatching alternation and
Justin Vreeland 794d92
# the leading .*, because of find-debuginfo.sh's buggy handling
Justin Vreeland 794d92
# of matching the pattern against the symlinks file.
Justin Vreeland 794d92
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_libexecdir}/(ksamples|kselftests)/.*|XXX' -o selftests-debuginfo.list}
Justin Vreeland 794d92
Justin Vreeland 794d92
# with_selftests
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_gcov}
Justin Vreeland 794d92
%package gcov
Justin Vreeland 794d92
Summary: gcov graph and source files for coverage data collection.
Justin Vreeland 794d92
%description gcov
Justin Vreeland 794d92
kernel-gcov includes the gcov graph and source files for gcov coverage collection.
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%package -n kernel-abi-whitelists
Justin Vreeland 794d92
Summary: The Red Hat Enterprise Linux kernel ABI symbol whitelists
Justin Vreeland 794d92
AutoReqProv: no
Justin Vreeland 794d92
%description -n kernel-abi-whitelists
Justin Vreeland 794d92
The kABI package contains information pertaining to the Red Hat Enterprise
Justin Vreeland 794d92
Linux kernel ABI, including lists of kernel symbols that are needed by
Justin Vreeland 794d92
external Linux kernel modules, and a yum plugin to aid enforcement.
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_kabidw_base}
Justin Vreeland 794d92
%package kabidw-base
Justin Vreeland 794d92
Summary: The baseline dataset for kABI verification using DWARF data
Justin Vreeland 794d92
Group: System Environment/Kernel
Justin Vreeland 794d92
AutoReqProv: no
Justin Vreeland 794d92
%description kabidw-base
Justin Vreeland 794d92
The kabidw-base package contains data describing the current ABI of the Red Hat
Justin Vreeland 794d92
Enterprise Linux kernel, suitable for the kabi-dw tool.
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro creates a kernel-<subpackage>-debuginfo package.
Justin Vreeland 794d92
#	%%kernel_debuginfo_package <subpackage>
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# Explanation of the find_debuginfo_opts: We build multiple kernels (debug
Justin Vreeland 794d92
# pae etc.) so the regex filters those kernels appropriately. We also
Justin Vreeland 794d92
# have to package several binaries as part of kernel-devel but getting
Justin Vreeland 794d92
# unique build-ids is tricky for these userspace binaries. We don't really
Justin Vreeland 794d92
# care about debugging those so we just filter those out and remove it.
Justin Vreeland 794d92
%define kernel_debuginfo_package() \
Justin Vreeland 794d92
%package %{?1:%{1}-}debuginfo\
Justin Vreeland 794d92
Summary: Debug information for package %{name}%{?1:-%{1}}\
Justin Vreeland 794d92
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}\
Justin Vreeland 794d92
Provides: %{name}%{?1:-%{1}}-debuginfo-%{_target_cpu} = %{version}-%{release}\
Justin Vreeland 794d92
Provides: installonlypkg(kernel)\
Justin Vreeland 794d92
AutoReqProv: no\
Justin Vreeland 794d92
%description %{?1:%{1}-}debuginfo\
Justin Vreeland 794d92
This package provides debug information for package %{name}%{?1:-%{1}}.\
Justin Vreeland 794d92
This is required to use SystemTap with %{name}%{?1:-%{1}}-%{KVERREL}.\
Justin Vreeland 794d92
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*\/usr\/src\/kernels/.*|XXX' -o ignored-debuginfo.list -p '/.*/%%{KVERREL_RE}%{?1:[+]%{1}}/.*|/.*%%{KVERREL_RE}%{?1:\+%{1}}(\.debug)?' -o debuginfo%{?1}.list}\
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro creates a kernel-<subpackage>-devel package.
Justin Vreeland 794d92
#	%%kernel_devel_package <subpackage> <pretty-name>
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_devel_package() \
Justin Vreeland 794d92
%package %{?1:%{1}-}devel\
Justin Vreeland 794d92
Summary: Development package for building kernel modules to match the %{?2:%{2} }kernel\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-devel-%{_target_cpu} = %{version}-%{release}\
Justin Vreeland 794d92
Provides: kernel-devel-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: kernel-devel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: installonlypkg(kernel)\
Justin Vreeland 794d92
AutoReqProv: no\
Justin Vreeland 794d92
Requires(pre): findutils\
Justin Vreeland 794d92
Requires: findutils\
Justin Vreeland 794d92
Requires: perl-interpreter\
Justin Vreeland 794d92
%description %{?1:%{1}-}devel\
Justin Vreeland 794d92
This package provides kernel headers and makefiles sufficient to build modules\
Justin Vreeland 794d92
against the %{?2:%{2} }kernel package.\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# kernel-<variant>-ipaclones-internal package
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_ipaclones_package() \
Justin Vreeland 794d92
%package %{?1:%{1}-}ipaclones-internal\
Justin Vreeland 794d92
Summary: *.ipa-clones files generated by -fdump-ipa-clones for kernel%{?1:-%{1}}\
Justin Vreeland 794d92
Group: System Environment/Kernel\
Justin Vreeland 794d92
AutoReqProv: no\
Justin Vreeland 794d92
%description %{?1:%{1}-}ipaclones-internal\
Justin Vreeland 794d92
This package provides *.ipa-clones files.\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro creates a kernel-<subpackage>-modules-internal package.
Justin Vreeland 794d92
#	%%kernel_modules_internal_package <subpackage> <pretty-name>
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_modules_internal_package() \
Justin Vreeland 794d92
%package %{?1:%{1}-}modules-internal\
Justin Vreeland 794d92
Summary: Extra kernel modules to match the %{?2:%{2} }kernel\
Justin Vreeland 794d92
Group: System Environment/Kernel\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-internal-%{_target_cpu} = %{version}-%{release}\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-internal-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-internal = %{version}-%{release}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: installonlypkg(kernel-module)\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-internal-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
AutoReq: no\
Justin Vreeland 794d92
AutoProv: yes\
Justin Vreeland 794d92
%description %{?1:%{1}-}modules-internal\
Justin Vreeland 794d92
This package provides kernel modules for the %{?2:%{2} }kernel package for Red Hat internal usage.\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro creates a kernel-<subpackage>-modules-extra package.
Justin Vreeland 794d92
#	%%kernel_modules_extra_package <subpackage> <pretty-name>
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_modules_extra_package() \
Justin Vreeland 794d92
%package %{?1:%{1}-}modules-extra\
Justin Vreeland 794d92
Summary: Extra kernel modules to match the %{?2:%{2} }kernel\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-extra = %{version}-%{release}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: installonlypkg(kernel-module)\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-extra-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
AutoReq: no\
Justin Vreeland 794d92
AutoProv: yes\
Justin Vreeland 794d92
%description %{?1:%{1}-}modules-extra\
Justin Vreeland 794d92
This package provides less commonly used kernel modules for the %{?2:%{2} }kernel package.\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro creates a kernel-<subpackage>-modules package.
Justin Vreeland 794d92
#	%%kernel_modules_package <subpackage> <pretty-name>
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_modules_package() \
Justin Vreeland 794d92
%package %{?1:%{1}-}modules\
Justin Vreeland 794d92
Summary: kernel modules to match the %{?2:%{2}-}core kernel\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-%{_target_cpu} = %{version}-%{release}\
Justin Vreeland 794d92
Provides: kernel-modules-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: kernel-modules = %{version}-%{release}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: installonlypkg(kernel-module)\
Justin Vreeland 794d92
Provides: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
Recommends: alsa-sof-firmware\
Justin Vreeland 794d92
AutoReq: no\
Justin Vreeland 794d92
AutoProv: yes\
Justin Vreeland 794d92
%description %{?1:%{1}-}modules\
Justin Vreeland 794d92
This package provides commonly used kernel modules for the %{?2:%{2}-}core kernel package.\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# this macro creates a kernel-<subpackage> meta package.
Justin Vreeland 794d92
#	%%kernel_meta_package <subpackage>
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_meta_package() \
Justin Vreeland 794d92
%package %{1}\
Justin Vreeland 794d92
summary: kernel meta-package for the %{1} kernel\
Justin Vreeland 794d92
Requires: kernel-%{1}-core-uname-r = %{KVERREL}%{?variant}+%{1}\
Justin Vreeland 794d92
Requires: kernel-%{1}-modules-uname-r = %{KVERREL}%{?variant}+%{1}\
Justin Vreeland 794d92
Provides: installonlypkg(kernel)\
Justin Vreeland 794d92
%description %{1}\
Justin Vreeland 794d92
The meta-package for the %{1} kernel\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro creates a kernel-<subpackage> and its -devel and -debuginfo too.
Justin Vreeland 794d92
#	%%define variant_summary The Linux kernel compiled for <configuration>
Justin Vreeland 794d92
#	%%kernel_variant_package [-n <pretty-name>] <subpackage>
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_variant_package(n:) \
Justin Vreeland 794d92
%package %{?1:%{1}-}core\
Justin Vreeland 794d92
Summary: %{variant_summary}\
Justin Vreeland 794d92
Provides: kernel-%{?1:%{1}-}core-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
Justin Vreeland 794d92
Provides: installonlypkg(kernel)\
Justin Vreeland 794d92
%ifarch ppc64le\
Justin Vreeland 794d92
Obsoletes: kernel-bootwrapper\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%{expand:%%kernel_reqprovconf}\
Justin Vreeland 794d92
%if %{?1:1} %{!?1:0} \
Justin Vreeland 794d92
%{expand:%%kernel_meta_package %{?1:%{1}}}\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%{expand:%%kernel_devel_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
Justin Vreeland 794d92
%{expand:%%kernel_modules_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
Justin Vreeland 794d92
%{expand:%%kernel_modules_extra_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
Justin Vreeland 794d92
%{expand:%%kernel_modules_internal_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
Justin Vreeland 794d92
%{expand:%%kernel_debuginfo_package %{?1:%{1}}}\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
# Now, each variant package.
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_pae}
Justin Vreeland 794d92
%define variant_summary The Linux kernel compiled for Cortex-A15
Justin Vreeland 794d92
%kernel_variant_package lpae
Justin Vreeland 794d92
%description lpae-core
Justin Vreeland 794d92
This package includes a version of the Linux kernel with support for
Justin Vreeland 794d92
Cortex-A15 devices with LPAE and HW virtualisation support
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_zfcpdump}
Justin Vreeland 794d92
%define variant_summary The Linux kernel compiled for zfcpdump usage
Justin Vreeland 794d92
%kernel_variant_package zfcpdump
Justin Vreeland 794d92
%description zfcpdump-core
Justin Vreeland 794d92
The kernel package contains the Linux kernel (vmlinuz) for use by the
Justin Vreeland 794d92
zfcpdump infrastructure.
Justin Vreeland 794d92
# with_zfcpdump
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%define variant_summary The Linux kernel compiled with extra debugging enabled
Justin Vreeland 794d92
%kernel_variant_package debug
Justin Vreeland 794d92
%description debug-core
Justin Vreeland 794d92
The kernel package contains the Linux kernel (vmlinuz), the core of any
Justin Vreeland 794d92
Linux operating system.  The kernel handles the basic functions
Justin Vreeland 794d92
of the operating system:  memory allocation, process allocation, device
Justin Vreeland 794d92
input and output, etc.
Justin Vreeland 794d92
Justin Vreeland 794d92
This variant of the kernel has numerous debugging options enabled.
Justin Vreeland 794d92
It should only be installed when trying to gather additional information
Justin Vreeland 794d92
on kernel bugs, as some of these options impact performance noticably.
Justin Vreeland 794d92
Justin Vreeland 794d92
# And finally the main -core package
Justin Vreeland 794d92
Justin Vreeland 794d92
%define variant_summary The Linux kernel
Justin Vreeland 794d92
%kernel_variant_package
Justin Vreeland 794d92
%description core
Justin Vreeland 794d92
The kernel package contains the Linux kernel (vmlinuz), the core of any
Justin Vreeland 794d92
Linux operating system.  The kernel handles the basic functions
Justin Vreeland 794d92
of the operating system: memory allocation, process allocation, device
Justin Vreeland 794d92
input and output, etc.
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_ipaclones}
Justin Vreeland 794d92
%kernel_ipaclones_package
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%prep
Justin Vreeland 794d92
# do a few sanity-checks for --with *only builds
Justin Vreeland 794d92
%if %{with_baseonly}
Justin Vreeland 794d92
%if !%{with_up}%{with_pae}
Justin Vreeland 794d92
echo "Cannot build --with baseonly, up build is disabled"
Justin Vreeland 794d92
exit 1
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if "%{baserelease}" == "0"
Justin Vreeland 794d92
echo "baserelease must be greater than zero"
Justin Vreeland 794d92
exit 1
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# more sanity checking; do it quietly
Justin Vreeland 794d92
if [ "%{patches}" != "%%{patches}" ] ; then
Justin Vreeland 794d92
  for patch in %{patches} ; do
Justin Vreeland 794d92
    if [ ! -f $patch ] ; then
Justin Vreeland 794d92
      echo "ERROR: Patch  ${patch##/*/}  listed in specfile but is missing"
Justin Vreeland 794d92
      exit 1
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
  done
Justin Vreeland 794d92
fi 2>/dev/null
Justin Vreeland 794d92
Justin Vreeland 794d92
patch_command='patch -p1 -F1 -s'
Justin Vreeland 794d92
ApplyPatch()
Justin Vreeland 794d92
{
Justin Vreeland 794d92
  local patch=$1
Justin Vreeland 794d92
  shift
Justin Vreeland 794d92
  if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
Justin Vreeland 794d92
    exit 1
Justin Vreeland 794d92
  fi
Justin Vreeland 794d92
  if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME%%%%%{?variant}}.spec ; then
Justin Vreeland 794d92
    if [ "${patch:0:8}" != "patch-5." ] ; then
Justin Vreeland 794d92
      echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
Justin Vreeland 794d92
      exit 1
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
  fi 2>/dev/null
Justin Vreeland 794d92
  case "$patch" in
Justin Vreeland 794d92
  *.bz2) bunzip2 < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
Justin Vreeland 794d92
  *.gz)  gunzip  < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
Justin Vreeland 794d92
  *.xz)  unxz    < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
Justin Vreeland 794d92
  *) $patch_command ${1+"$@"} < "$RPM_SOURCE_DIR/$patch" ;;
Justin Vreeland 794d92
  esac
Justin Vreeland 794d92
}
Justin Vreeland 794d92
Justin Vreeland 794d92
# don't apply patch if it's empty
Justin Vreeland 794d92
ApplyOptionalPatch()
Justin Vreeland 794d92
{
Justin Vreeland 794d92
  local patch=$1
Justin Vreeland 794d92
  shift
Justin Vreeland 794d92
  if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
Justin Vreeland 794d92
    exit 1
Justin Vreeland 794d92
  fi
Justin Vreeland 794d92
  local C=$(wc -l $RPM_SOURCE_DIR/$patch | awk '{print $1}')
Justin Vreeland 794d92
  if [ "$C" -gt 9 ]; then
Justin Vreeland 794d92
    ApplyPatch $patch ${1+"$@"}
Justin Vreeland 794d92
  fi
Justin Vreeland 794d92
}
Justin Vreeland 794d92
Justin Vreeland 794d92
# First we unpack the kernel tarball.
Justin Vreeland 794d92
# If this isn't the first make prep, we use links to the existing clean tarball
Justin Vreeland 794d92
# which speeds things up quite a bit.
Justin Vreeland 794d92
Justin Vreeland 794d92
# Update to latest upstream.
Justin Vreeland 794d92
%if 0%{?released_kernel}
Justin Vreeland 794d92
%define vanillaversion 5.%{base_sublevel}
Justin Vreeland 794d92
# non-released_kernel case
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%if 0%{?rcrev}
Justin Vreeland 794d92
%define vanillaversion 5.%{upstream_sublevel}-rc%{rcrev}
Justin Vreeland 794d92
%if 0%{?gitrev}
Justin Vreeland 794d92
%define vanillaversion 5.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
# pre-{base_sublevel+1}-rc1 case
Justin Vreeland 794d92
%if 0%{?gitrev}
Justin Vreeland 794d92
%define vanillaversion 5.%{base_sublevel}-git%{gitrev}
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%define vanillaversion 5.%{base_sublevel}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# %%{vanillaversion} : the full version name, e.g. 2.6.35-rc6-git3
Justin Vreeland 794d92
# %%{kversion}       : the base version, e.g. 2.6.34
Justin Vreeland 794d92
Justin Vreeland 794d92
# Use kernel-%%{kversion}%%{?dist} as the top-level directory name
Justin Vreeland 794d92
# so we can prep different trees within a single git directory.
Justin Vreeland 794d92
Justin Vreeland 794d92
# Build a list of the other top-level kernel tree directories.
Justin Vreeland 794d92
# This will be used to hardlink identical vanilla subdirs.
Justin Vreeland 794d92
sharedirs=$(find "$PWD" -maxdepth 1 -type d -name 'kernel-5.*' \
Justin Vreeland 794d92
            | grep -x -v "$PWD"/kernel-%{kversion}%{?dist}) ||:
Justin Vreeland 794d92
Justin Vreeland 794d92
# Delete all old stale trees.
Justin Vreeland 794d92
if [ -d kernel-%{kversion}%{?dist} ]; then
Justin Vreeland 794d92
  cd kernel-%{kversion}%{?dist}
Justin Vreeland 794d92
  for i in linux-*
Justin Vreeland 794d92
  do
Justin Vreeland 794d92
     if [ -d $i ]; then
Justin Vreeland 794d92
       # Just in case we ctrl-c'd a prep already
Justin Vreeland 794d92
       rm -rf deleteme.%{_target_cpu}
Justin Vreeland 794d92
       # Move away the stale away, and delete in background.
Justin Vreeland 794d92
       mv $i deleteme-$i
Justin Vreeland 794d92
       rm -rf deleteme* &
Justin Vreeland 794d92
     fi
Justin Vreeland 794d92
  done
Justin Vreeland 794d92
  cd ..
Justin Vreeland 794d92
fi
Justin Vreeland 794d92
Justin Vreeland 794d92
# Generate new tree
Justin Vreeland 794d92
if [ ! -d kernel-%{kversion}%{?dist}/vanilla-%{vanillaversion} ]; then
Justin Vreeland 794d92
Justin Vreeland 794d92
  if [ -d kernel-%{kversion}%{?dist}/vanilla-%{kversion} ]; then
Justin Vreeland 794d92
Justin Vreeland 794d92
    # The base vanilla version already exists.
Justin Vreeland 794d92
    cd kernel-%{kversion}%{?dist}
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Any vanilla-* directories other than the base one are stale.
Justin Vreeland 794d92
    for dir in vanilla-*; do
Justin Vreeland 794d92
      [ "$dir" = vanilla-%{kversion} ] || rm -rf $dir &
Justin Vreeland 794d92
    done
Justin Vreeland 794d92
Justin Vreeland 794d92
  else
Justin Vreeland 794d92
Justin Vreeland 794d92
    rm -f pax_global_header
Justin Vreeland 794d92
    # Look for an identical base vanilla dir that can be hardlinked.
Justin Vreeland 794d92
    for sharedir in $sharedirs ; do
Justin Vreeland 794d92
      if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{kversion} ]] ; then
Justin Vreeland 794d92
        break
Justin Vreeland 794d92
      fi
Justin Vreeland 794d92
    done
Justin Vreeland 794d92
    if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{kversion} ]] ; then
Justin Vreeland 794d92
%setup -q -n kernel-%{kversion}%{?dist} -c -T
Justin Vreeland 794d92
      cp -al $sharedir/vanilla-%{kversion} .
Justin Vreeland 794d92
    else
Justin Vreeland 794d92
%setup -q -n kernel-%{kversion}%{?dist} -c
Justin Vreeland 794d92
      mv linux-%{kversion} vanilla-%{kversion}
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
  fi
Justin Vreeland 794d92
Justin Vreeland 794d92
%if "%{kversion}" != "%{vanillaversion}"
Justin Vreeland 794d92
Justin Vreeland 794d92
  for sharedir in $sharedirs ; do
Justin Vreeland 794d92
    if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{vanillaversion} ]] ; then
Justin Vreeland 794d92
      break
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
  done
Justin Vreeland 794d92
  if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{vanillaversion} ]] ; then
Justin Vreeland 794d92
Justin Vreeland 794d92
    cp -al $sharedir/vanilla-%{vanillaversion} .
Justin Vreeland 794d92
Justin Vreeland 794d92
  else
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Need to apply patches to the base vanilla version.
Justin Vreeland 794d92
    cp -al vanilla-%{kversion} vanilla-%{vanillaversion}
Justin Vreeland 794d92
    cd vanilla-%{vanillaversion}
Justin Vreeland 794d92
Justin Vreeland 794d92
cp %{SOURCE12} .
Justin Vreeland 794d92
Justin Vreeland 794d92
# Update vanilla to the latest upstream.
Justin Vreeland 794d92
# (non-released_kernel case only)
Justin Vreeland 794d92
%if 0%{?rcrev}
Justin Vreeland 794d92
    xzcat %{SOURCE5000} | patch -p1 -F1 -s
Justin Vreeland 794d92
%if 0%{?gitrev}
Justin Vreeland 794d92
    xzcat %{SOURCE5001} | patch -p1 -F1 -s
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
# pre-{base_sublevel+1}-rc1 case
Justin Vreeland 794d92
%if 0%{?gitrev}
Justin Vreeland 794d92
    xzcat %{SOURCE5000} | patch -p1 -F1 -s
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
    git init
Justin Vreeland 794d92
    git config user.email "kernel-team@fedoraproject.org"
Justin Vreeland 794d92
    git config user.name "Fedora Kernel Team"
Justin Vreeland 794d92
    git config gc.auto 0
Justin Vreeland 794d92
    git add .
Justin Vreeland 794d92
    git commit -a -q -m "baseline"
Justin Vreeland 794d92
Justin Vreeland 794d92
    cd ..
Justin Vreeland 794d92
Justin Vreeland 794d92
  fi
Justin Vreeland 794d92
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
else
Justin Vreeland 794d92
Justin Vreeland 794d92
  # We already have all vanilla dirs, just change to the top-level directory.
Justin Vreeland 794d92
  cd kernel-%{kversion}%{?dist}
Justin Vreeland 794d92
Justin Vreeland 794d92
fi
Justin Vreeland 794d92
Justin Vreeland 794d92
# Now build the fedora kernel tree.
Justin Vreeland 794d92
cp -al vanilla-%{vanillaversion} linux-%{KVERREL}
Justin Vreeland 794d92
Justin Vreeland 794d92
cd linux-%{KVERREL}
Justin Vreeland 794d92
if [ ! -d .git ]; then
Justin Vreeland 794d92
    git init
Justin Vreeland 794d92
    git config user.email "kernel-team@fedoraproject.org"
Justin Vreeland 794d92
    git config user.name "Fedora Kernel Team"
Justin Vreeland 794d92
    git config gc.auto 0
Justin Vreeland 794d92
    git add .
Justin Vreeland 794d92
    git commit -a -q -m "baseline"
Justin Vreeland 794d92
fi
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
# released_kernel with possible stable updates
Justin Vreeland 794d92
%if 0%{?stable_base}
Justin Vreeland 794d92
# This is special because the kernel spec is hell and nothing is consistent
Justin Vreeland 794d92
xzcat %{SOURCE5000} | patch -p1 -F1 -s
Justin Vreeland 794d92
git commit -a -m "Stable update"
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# Note: Even in the "nopatches" path some patches (build tweaks and compile
Justin Vreeland 794d92
# fixes) will always get applied; see patch defition above for details
Justin Vreeland 794d92
Justin Vreeland 794d92
git am %{patches}
Justin Vreeland 794d92
Justin Vreeland 794d92
# END OF PATCH APPLICATIONS
Justin Vreeland 794d92
Justin Vreeland 794d92
# Any further pre-build tree manipulations happen here.
Justin Vreeland 794d92
Justin Vreeland 794d92
chmod +x scripts/checkpatch.pl
Justin Vreeland 794d92
mv COPYING COPYING-%{version}-%{release}
Justin Vreeland 794d92
Justin Vreeland 794d92
# This Prevents scripts/setlocalversion from mucking with our version numbers.
Justin Vreeland 794d92
touch .scmversion
Justin Vreeland 794d92
Justin Vreeland 794d92
# Mangle /usr/bin/python shebangs to /usr/bin/python3
Justin Vreeland 794d92
# Mangle all Python shebangs to be Python 3 explicitly
Justin Vreeland 794d92
# -p preserves timestamps
Justin Vreeland 794d92
# -n prevents creating ~backup files
Justin Vreeland 794d92
# -i specifies the interpreter for the shebang
Justin Vreeland 794d92
# This fixes errors such as
Justin Vreeland 794d92
# *** ERROR: ambiguous python shebang in /usr/bin/kvm_stat: #!/usr/bin/python. Change it to python3 (or python2) explicitly.
Justin Vreeland 794d92
# We patch all sources below for which we got a report/error.
Justin Vreeland 794d92
pathfix.py -i "%{__python3} %{py3_shbang_opts}" -p -n \
Justin Vreeland 794d92
	tools/kvm/kvm_stat/kvm_stat \
Justin Vreeland 794d92
	scripts/show_delta \
Justin Vreeland 794d92
	scripts/diffconfig \
Justin Vreeland 794d92
	scripts/bloat-o-meter \
Justin Vreeland 794d92
	scripts/jobserver-exec \
Justin Vreeland 794d92
	tools/perf/tests/attr.py \
Justin Vreeland 794d92
	tools/perf/scripts/python/stat-cpi.py \
Justin Vreeland 794d92
	tools/perf/scripts/python/sched-migration.py \
Justin Vreeland 794d92
	Documentation \
Justin Vreeland 794d92
	scripts/clang-tools/ \
Justin Vreeland 794d92
	tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py
Justin Vreeland 794d92
Justin Vreeland 794d92
# only deal with configs if we are going to build for the arch
Justin Vreeland 794d92
%ifnarch %nobuildarches
Justin Vreeland 794d92
Justin Vreeland 794d92
if [ -L configs ]; then
Justin Vreeland 794d92
	rm -f configs
Justin Vreeland 794d92
fi
Justin Vreeland 794d92
# Deal with configs stuff
Justin Vreeland 794d92
mkdir configs
Justin Vreeland 794d92
cd configs
Justin Vreeland 794d92
Justin Vreeland 794d92
# Drop some necessary files from the source dir into the buildroot
Justin Vreeland 794d92
cp $RPM_SOURCE_DIR/kernel-*.config .
Justin Vreeland 794d92
rm *aarch* *s390x* *ppc*
Justin Vreeland 794d92
cp %{SOURCE1000} .
Justin Vreeland 794d92
cp %{SOURCE55} .
Justin Vreeland 794d92
cp %{SOURCE51} .
Justin Vreeland 794d92
cp %{SOURCE3001} .
Justin Vreeland 794d92
cp %{SOURCE3002} .
Justin Vreeland 794d92
VERSION=%{version} ./generate_all_configs.sh %{primary_target} %{debugbuildsenabled}
Justin Vreeland 794d92
Justin Vreeland 794d92
# hyperscale isn't going to use this
Justin Vreeland 794d92
# Merge in any user-provided local config option changes
Justin Vreeland 794d92
# %ifnarch %nobuildarches
Justin Vreeland 794d92
# for i in %{all_arch_configs}
Justin Vreeland 794d92
# do
Justin Vreeland 794d92
#   mv $i $i.tmp
Justin Vreeland 794d92
#   ./merge.pl %{SOURCE1000} $i.tmp > $i
Justin Vreeland 794d92
#   rm $i.tmp
Justin Vreeland 794d92
# done
Justin Vreeland 794d92
# %endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if !%{debugbuildsenabled}
Justin Vreeland 794d92
rm -f kernel-%{version}-*debug.config
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# enable GCOV kernel config options if gcov is on
Justin Vreeland 794d92
%if %{with_gcov}
Justin Vreeland 794d92
for i in *.config
Justin Vreeland 794d92
do
Justin Vreeland 794d92
  sed -i 's/# CONFIG_GCOV_KERNEL is not set/CONFIG_GCOV_KERNEL=y\nCONFIG_GCOV_PROFILE_ALL=y\n/' $i
Justin Vreeland 794d92
done
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
cp %{SOURCE52} .
Justin Vreeland 794d92
OPTS=""
Justin Vreeland 794d92
%if %{with_configchecks}
Justin Vreeland 794d92
	OPTS="$OPTS -w -n -c"
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
./process_configs.sh $OPTS kernel %{rpmversion}
Justin Vreeland 794d92
Justin Vreeland 794d92
cp %{SOURCE56} .
Justin Vreeland 794d92
RPM_SOURCE_DIR=$RPM_SOURCE_DIR ./update_scripts.sh %{primary_target}
Justin Vreeland 794d92
Justin Vreeland 794d92
# end of kernel config
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
cd ..
Justin Vreeland 794d92
# # End of Configs stuff
Justin Vreeland 794d92
Justin Vreeland 794d92
# get rid of unwanted files resulting from patch fuzz
Justin Vreeland 794d92
find . \( -name "*.orig" -o -name "*~" \) -delete >/dev/null
Justin Vreeland 794d92
Justin Vreeland 794d92
# remove unnecessary SCM files
Justin Vreeland 794d92
find . -name .gitignore -delete >/dev/null
Justin Vreeland 794d92
Justin Vreeland 794d92
cd ..
Justin Vreeland 794d92
Justin Vreeland 794d92
###
Justin Vreeland 794d92
### build
Justin Vreeland 794d92
###
Justin Vreeland 794d92
%build
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_sparse}
Justin Vreeland 794d92
%define sparse_mflags	C=1
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
cp_vmlinux()
Justin Vreeland 794d92
{
Justin Vreeland 794d92
  eu-strip --remove-comment -o "$2" "$1"
Justin Vreeland 794d92
}
Justin Vreeland 794d92
Justin Vreeland 794d92
# These are for host programs that get built as part of the kernel and
Justin Vreeland 794d92
# are required to be packaged in kernel-devel for building external modules.
Justin Vreeland 794d92
# Since they are userspace binaries, they are required to pickup the hardening
Justin Vreeland 794d92
# flags defined in the macros. The --build-id=uuid is a trick to get around
Justin Vreeland 794d92
# debuginfo limitations: Typically, find-debuginfo.sh will update the build
Justin Vreeland 794d92
# id of all binaries to allow for parllel debuginfo installs. The kernel
Justin Vreeland 794d92
# can't use this because it breaks debuginfo for the vDSO so we have to
Justin Vreeland 794d92
# use a special mechanism for kernel and modules to be unique. Unfortunately,
Justin Vreeland 794d92
# we still have userspace binaries which need unique debuginfo and because
Justin Vreeland 794d92
# they come from the kernel package, we can't just use find-debuginfo.sh to
Justin Vreeland 794d92
# rewrite only those binaries. The easiest option right now is just to have
Justin Vreeland 794d92
# the build id be a uuid for the host programs.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# Note we need to disable these flags for cross builds because the flags
Justin Vreeland 794d92
# from redhat-rpm-config assume that host == target so target arch
Justin Vreeland 794d92
# flags cause issues with the host compiler.
Justin Vreeland 794d92
%if !%{with_cross}
Justin Vreeland 794d92
%define build_hostcflags  %{?build_cflags}
Justin Vreeland 794d92
%define build_hostldflags %{?build_ldflags}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%define make make %{?cross_opts} %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}"
Justin Vreeland 794d92
Justin Vreeland 794d92
BuildKernel() {
Justin Vreeland 794d92
    MakeTarget=$1
Justin Vreeland 794d92
    KernelImage=$2
Justin Vreeland 794d92
    Flavour=$4
Justin Vreeland 794d92
    DoVDSO=$3
Justin Vreeland 794d92
    Flav=${Flavour:++${Flavour}}
Justin Vreeland 794d92
    InstallName=${5:-vmlinuz}
Justin Vreeland 794d92
Justin Vreeland 794d92
    DoModules=1
Justin Vreeland 794d92
    if [ "$Flavour" = "zfcpdump" ]; then
Justin Vreeland 794d92
	    DoModules=0
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Pick the right config file for the kernel we're building
Justin Vreeland 794d92
    Config=kernel-%{version}-%{_target_cpu}${Flavour:+-${Flavour}}.config
Justin Vreeland 794d92
    DevelDir=/usr/src/kernels/%{KVERREL}${Flav}
Justin Vreeland 794d92
Justin Vreeland 794d92
    # When the bootable image is just the ELF kernel, strip it.
Justin Vreeland 794d92
    # We already copy the unstripped file into the debuginfo package.
Justin Vreeland 794d92
    if [ "$KernelImage" = vmlinux ]; then
Justin Vreeland 794d92
      CopyKernel=cp_vmlinux
Justin Vreeland 794d92
    else
Justin Vreeland 794d92
      CopyKernel=cp
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    KernelVer=%{version}-%{release}.%{_target_cpu}${Flav}
Justin Vreeland 794d92
    echo BUILDING A KERNEL FOR ${Flavour} %{_target_cpu}...
Justin Vreeland 794d92
Justin Vreeland 794d92
    %if 0%{?stable_update}
Justin Vreeland 794d92
    # make sure SUBLEVEL is incremented on a stable release.  Sigh 3.x.
Justin Vreeland 794d92
    perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{?stablerev}/" Makefile
Justin Vreeland 794d92
    %endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    # make sure EXTRAVERSION says what we want it to say
Justin Vreeland 794d92
    perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.%{_target_cpu}${Flav}/" Makefile
Justin Vreeland 794d92
Justin Vreeland 794d92
    # if pre-rc1 devel kernel, must fix up PATCHLEVEL for our versioning scheme
Justin Vreeland 794d92
    %if !0%{?rcrev}
Justin Vreeland 794d92
    %if 0%{?gitrev}
Justin Vreeland 794d92
    perl -p -i -e 's/^PATCHLEVEL.*/PATCHLEVEL = %{upstream_sublevel}/' Makefile
Justin Vreeland 794d92
    %endif
Justin Vreeland 794d92
    %endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    # and now to start the build process
Justin Vreeland 794d92
Justin Vreeland 794d92
    %{make} %{?_smp_mflags} mrproper
Justin Vreeland 794d92
    cp configs/$Config .config
Justin Vreeland 794d92
Justin Vreeland 794d92
    %if %{signkernel}%{signmodules}
Justin Vreeland 794d92
    cp $RPM_SOURCE_DIR/x509.genkey certs/.
Justin Vreeland 794d92
    %endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    Arch=`head -1 .config | cut -b 3-`
Justin Vreeland 794d92
    echo USING ARCH=$Arch
Justin Vreeland 794d92
Justin Vreeland 794d92
    KCFLAGS="%{?kcflags}"
Justin Vreeland 794d92
Justin Vreeland 794d92
    # add kpatch flags for base kernel
Justin Vreeland 794d92
    if [ "$Flavour" == "" ]; then
Justin Vreeland 794d92
        KCFLAGS="$KCFLAGS %{?kpatch_kcflags}"
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    %{make} ARCH=$Arch olddefconfig >/dev/null
Justin Vreeland 794d92
Justin Vreeland 794d92
    # This ensures build-ids are unique to allow parallel debuginfo
Justin Vreeland 794d92
    perl -p -i -e "s/^CONFIG_BUILD_SALT.*/CONFIG_BUILD_SALT=\"%{KVERREL}\"/" .config
Justin Vreeland 794d92
    %{make} ARCH=$Arch KCFLAGS="$KCFLAGS" WITH_GCOV="%{?with_gcov}" %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags}
Justin Vreeland 794d92
    if [ $DoModules -eq 1 ]; then
Justin Vreeland 794d92
	%{make} ARCH=$Arch KCFLAGS="$KCFLAGS" WITH_GCOV="%{?with_gcov}" %{?_smp_mflags} modules %{?sparse_mflags} || exit 1
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/%{image_install_path}
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
Justin Vreeland 794d92
%if %{with_debuginfo}
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/%{image_install_path}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifarch %{arm} aarch64
Justin Vreeland 794d92
    %{make} ARCH=$Arch dtbs INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer
Justin Vreeland 794d92
    %{make} ARCH=$Arch dtbs_install INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer
Justin Vreeland 794d92
    cp -r $RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/dtb
Justin Vreeland 794d92
    find arch/$Arch/boot/dts -name '*.dtb' -type f -delete
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Start installing the results
Justin Vreeland 794d92
    install -m 644 .config $RPM_BUILD_ROOT/boot/config-$KernelVer
Justin Vreeland 794d92
    install -m 644 .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/config
Justin Vreeland 794d92
    install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-$KernelVer
Justin Vreeland 794d92
    install -m 644 System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/System.map
Justin Vreeland 794d92
Justin Vreeland 794d92
    # We estimate the size of the initramfs because rpm needs to take this size
Justin Vreeland 794d92
    # into consideration when performing disk space calculations. (See bz #530778)
Justin Vreeland 794d92
    dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initramfs-$KernelVer.img bs=1M count=20
Justin Vreeland 794d92
Justin Vreeland 794d92
    if [ -f arch/$Arch/boot/zImage.stub ]; then
Justin Vreeland 794d92
      cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/%{image_install_path}/zImage.stub-$KernelVer || :
Justin Vreeland 794d92
      cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/lib/modules/$KernelVer/zImage.stub-$KernelVer || :
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    %if %{signkernel}
Justin Vreeland 794d92
    if [ "$KernelImage" = vmlinux ]; then
Justin Vreeland 794d92
        # We can't strip and sign $KernelImage in place, because
Justin Vreeland 794d92
        # we need to preserve original vmlinux for debuginfo.
Justin Vreeland 794d92
        # Use a copy for signing.
Justin Vreeland 794d92
        $CopyKernel $KernelImage $KernelImage.tosign
Justin Vreeland 794d92
        KernelImage=$KernelImage.tosign
Justin Vreeland 794d92
        CopyKernel=cp
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Sign the image if we're using EFI
Justin Vreeland 794d92
    # aarch64 kernels are gziped EFI images
Justin Vreeland 794d92
    KernelExtension=${KernelImage##*.}
Justin Vreeland 794d92
    if [ "$KernelExtension" == "gz" ]; then
Justin Vreeland 794d92
        SignImage=${KernelImage%.*}
Justin Vreeland 794d92
    else
Justin Vreeland 794d92
        SignImage=$KernelImage
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    %ifarch x86_64 aarch64
Justin Vreeland 794d92
    %pesign -s -i $SignImage -o vmlinuz.tmp -a %{secureboot_ca_0} -c %{secureboot_key_0} -n %{pesign_name_0}
Justin Vreeland 794d92
    %pesign -s -i vmlinuz.tmp -o vmlinuz.signed -a %{secureboot_ca_1} -c %{secureboot_key_1} -n %{pesign_name_1}
Justin Vreeland 794d92
    rm vmlinuz.tmp
Justin Vreeland 794d92
    %endif
Justin Vreeland 794d92
    %ifarch s390x ppc64le
Justin Vreeland 794d92
    if [ -x /usr/bin/rpm-sign ]; then
Justin Vreeland 794d92
	rpm-sign --key "%{pesign_name_0}" --lkmsign $SignImage --output vmlinuz.signed
Justin Vreeland 794d92
    elif [ $DoModules -eq 1 ]; then
Justin Vreeland 794d92
	chmod +x scripts/sign-file
Justin Vreeland 794d92
	./scripts/sign-file -p sha256 certs/signing_key.pem certs/signing_key.x509 $SignImage vmlinuz.signed
Justin Vreeland 794d92
    else
Justin Vreeland 794d92
	mv $SignImage vmlinuz.signed
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    %endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    if [ ! -s vmlinuz.signed ]; then
Justin Vreeland 794d92
        echo "pesigning failed"
Justin Vreeland 794d92
        exit 1
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    mv vmlinuz.signed $SignImage
Justin Vreeland 794d92
    if [ "$KernelExtension" == "gz" ]; then
Justin Vreeland 794d92
        gzip -f9 $SignImage
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    # signkernel
Justin Vreeland 794d92
    %endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    $CopyKernel $KernelImage \
Justin Vreeland 794d92
                $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
Justin Vreeland 794d92
    chmod 755 $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
Justin Vreeland 794d92
    cp $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/$InstallName
Justin Vreeland 794d92
Justin Vreeland 794d92
    # hmac sign the kernel for FIPS
Justin Vreeland 794d92
    echo "Creating hmac file: $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac"
Justin Vreeland 794d92
    ls -l $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
Justin Vreeland 794d92
    sha512hmac $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer | sed -e "s,$RPM_BUILD_ROOT,," > $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac;
Justin Vreeland 794d92
    cp $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac $RPM_BUILD_ROOT/lib/modules/$KernelVer/.vmlinuz.hmac
Justin Vreeland 794d92
Justin Vreeland 794d92
    if [ $DoModules -eq 1 ]; then
Justin Vreeland 794d92
	# Override $(mod-fw) because we don't want it to install any firmware
Justin Vreeland 794d92
	# we'll get it from the linux-firmware package and we don't want conflicts
Justin Vreeland 794d92
	%{make} %{?_smp_mflags} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT %{?_smp_mflags} modules_install KERNELRELEASE=$KernelVer mod-fw=
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_gcov}
Justin Vreeland 794d92
    # install gcov-needed files to $BUILDROOT/$BUILD/...:
Justin Vreeland 794d92
    #   gcov_info->filename is absolute path
Justin Vreeland 794d92
    #   gcno references to sources can use absolute paths (e.g. in out-of-tree builds)
Justin Vreeland 794d92
    #   sysfs symlink targets (set up at compile time) use absolute paths to BUILD dir
Justin Vreeland 794d92
    find . \( -name '*.gcno' -o -name '*.[chS]' \) -exec install -D '{}' "$RPM_BUILD_ROOT/$(pwd)/{}" \;
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    # add an a noop %%defattr statement 'cause rpm doesn't like empty file list files
Justin Vreeland 794d92
    echo '%%defattr(-,-,-)' > ../kernel${Flavour:+-${Flavour}}-ldsoconf.list
Justin Vreeland 794d92
    if [ $DoVDSO -ne 0 ]; then
Justin Vreeland 794d92
        %{make} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer
Justin Vreeland 794d92
        if [ -s ldconfig-kernel.conf ]; then
Justin Vreeland 794d92
             install -D -m 444 ldconfig-kernel.conf \
Justin Vreeland 794d92
                $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf
Justin Vreeland 794d92
	     echo /etc/ld.so.conf.d/kernel-$KernelVer.conf >> ../kernel${Flavour:+-${Flavour}}-ldsoconf.list
Justin Vreeland 794d92
        fi
Justin Vreeland 794d92
Justin Vreeland 794d92
        rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/vdso/.build-id
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    # And save the headers/makefiles etc for building modules against
Justin Vreeland 794d92
    #
Justin Vreeland 794d92
    # This all looks scary, but the end result is supposed to be:
Justin Vreeland 794d92
    # * all arch relevant include/ files
Justin Vreeland 794d92
    # * all Makefile/Kconfig files
Justin Vreeland 794d92
    # * all script/ files
Justin Vreeland 794d92
Justin Vreeland 794d92
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/source
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    (cd $RPM_BUILD_ROOT/lib/modules/$KernelVer ; ln -s build source)
Justin Vreeland 794d92
    # dirs for additional modules per module-init-tools, kbuild/modules.txt
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/extra
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/internal
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/updates
Justin Vreeland 794d92
%if 0%{!?fedora:1}
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/weak-updates
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
    # CONFIG_KERNEL_HEADER_TEST generates some extra files in the process of
Justin Vreeland 794d92
    # testing so just delete
Justin Vreeland 794d92
    find . -name *.h.s -delete
Justin Vreeland 794d92
    # first copy everything
Justin Vreeland 794d92
    cp --parents `find  -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    cp Module.symvers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    cp System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    if [ -s Module.markers ]; then
Justin Vreeland 794d92
      cp Module.markers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    # create the kABI metadata for use in packaging
Justin Vreeland 794d92
    # NOTENOTE: the name symvers is used by the rpm backend
Justin Vreeland 794d92
    # NOTENOTE: to discover and run the /usr/lib/rpm/fileattrs/kabi.attr
Justin Vreeland 794d92
    # NOTENOTE: script which dynamically adds exported kernel symbol
Justin Vreeland 794d92
    # NOTENOTE: checksums to the rpm metadata provides list.
Justin Vreeland 794d92
    # NOTENOTE: if you change the symvers name, update the backend too
Justin Vreeland 794d92
    echo "**** GENERATING kernel ABI metadata ****"
Justin Vreeland 794d92
    gzip -c9 < Module.symvers > $RPM_BUILD_ROOT/boot/symvers-$KernelVer.gz
Justin Vreeland 794d92
    cp $RPM_BUILD_ROOT/boot/symvers-$KernelVer.gz $RPM_BUILD_ROOT/lib/modules/$KernelVer/symvers.gz
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_kabichk}
Justin Vreeland 794d92
    echo "**** kABI checking is enabled in kernel SPEC file. ****"
Justin Vreeland 794d92
    chmod 0755 $RPM_SOURCE_DIR/check-kabi
Justin Vreeland 794d92
    if [ -e $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu}$Flavour ]; then
Justin Vreeland 794d92
        cp $RPM_SOURCE_DIR/Module.kabi_%{_target_cpu}$Flavour $RPM_BUILD_ROOT/Module.kabi
Justin Vreeland 794d92
        $RPM_SOURCE_DIR/check-kabi -k $RPM_BUILD_ROOT/Module.kabi -s Module.symvers || exit 1
Justin Vreeland 794d92
        # for now, don't keep it around.
Justin Vreeland 794d92
        rm $RPM_BUILD_ROOT/Module.kabi
Justin Vreeland 794d92
    else
Justin Vreeland 794d92
        echo "**** NOTE: Cannot find reference Module.kabi file. ****"
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_kabidupchk}
Justin Vreeland 794d92
    echo "**** kABI DUP checking is enabled in kernel SPEC file. ****"
Justin Vreeland 794d92
    if [ -e $RPM_SOURCE_DIR/Module.kabi_dup_%{_target_cpu}$Flavour ]; then
Justin Vreeland 794d92
        cp $RPM_SOURCE_DIR/Module.kabi_dup_%{_target_cpu}$Flavour $RPM_BUILD_ROOT/Module.kabi
Justin Vreeland 794d92
        $RPM_SOURCE_DIR/check-kabi -k $RPM_BUILD_ROOT/Module.kabi -s Module.symvers || exit 1
Justin Vreeland 794d92
        # for now, don't keep it around.
Justin Vreeland 794d92
        rm $RPM_BUILD_ROOT/Module.kabi
Justin Vreeland 794d92
    else
Justin Vreeland 794d92
        echo "**** NOTE: Cannot find DUP reference Module.kabi file. ****"
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_kabidw_base}
Justin Vreeland 794d92
    # Don't build kabi base for debug kernels
Justin Vreeland 794d92
    if [ "$Flavour" != "kdump" -a "$Flavour" != "debug" ]; then
Justin Vreeland 794d92
        mkdir -p $RPM_BUILD_ROOT/kabi-dwarf
Justin Vreeland 794d92
        tar xjvf %{SOURCE301} -C $RPM_BUILD_ROOT/kabi-dwarf
Justin Vreeland 794d92
Justin Vreeland 794d92
        mkdir -p $RPM_BUILD_ROOT/kabi-dwarf/whitelists
Justin Vreeland 794d92
        tar xjvf %{SOURCE300} -C $RPM_BUILD_ROOT/kabi-dwarf/whitelists
Justin Vreeland 794d92
Justin Vreeland 794d92
        echo "**** GENERATING DWARF-based kABI baseline dataset ****"
Justin Vreeland 794d92
        chmod 0755 $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh
Justin Vreeland 794d92
        $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh generate \
Justin Vreeland 794d92
            "$RPM_BUILD_ROOT/kabi-dwarf/whitelists/kabi-current/kabi_whitelist_%{_target_cpu}" \
Justin Vreeland 794d92
            "$(pwd)" \
Justin Vreeland 794d92
            "$RPM_BUILD_ROOT/kabidw-base/%{_target_cpu}${Flavour:+.${Flavour}}" || :
Justin Vreeland 794d92
Justin Vreeland 794d92
        rm -rf $RPM_BUILD_ROOT/kabi-dwarf
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_kabidwchk}
Justin Vreeland 794d92
    if [ "$Flavour" != "kdump" ]; then
Justin Vreeland 794d92
        mkdir -p $RPM_BUILD_ROOT/kabi-dwarf
Justin Vreeland 794d92
        tar xjvf %{SOURCE301} -C $RPM_BUILD_ROOT/kabi-dwarf
Justin Vreeland 794d92
        if [ -d "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}" ]; then
Justin Vreeland 794d92
            mkdir -p $RPM_BUILD_ROOT/kabi-dwarf/whitelists
Justin Vreeland 794d92
            tar xjvf %{SOURCE300} -C $RPM_BUILD_ROOT/kabi-dwarf/whitelists
Justin Vreeland 794d92
Justin Vreeland 794d92
            echo "**** GENERATING DWARF-based kABI dataset ****"
Justin Vreeland 794d92
            chmod 0755 $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh
Justin Vreeland 794d92
            $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh generate \
Justin Vreeland 794d92
                "$RPM_BUILD_ROOT/kabi-dwarf/whitelists/kabi-current/kabi_whitelist_%{_target_cpu}" \
Justin Vreeland 794d92
                "$(pwd)" \
Justin Vreeland 794d92
                "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}.tmp" || :
Justin Vreeland 794d92
Justin Vreeland 794d92
            echo "**** kABI DWARF-based comparison report ****"
Justin Vreeland 794d92
            $RPM_BUILD_ROOT/kabi-dwarf/run_kabi-dw.sh compare \
Justin Vreeland 794d92
                "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}" \
Justin Vreeland 794d92
                "$RPM_BUILD_ROOT/kabi-dwarf/base/%{_target_cpu}${Flavour:+.${Flavour}}.tmp" || :
Justin Vreeland 794d92
            echo "**** End of kABI DWARF-based comparison report ****"
Justin Vreeland 794d92
        else
Justin Vreeland 794d92
            echo "**** Baseline dataset for kABI DWARF-BASED comparison report not found ****"
Justin Vreeland 794d92
        fi
Justin Vreeland 794d92
Justin Vreeland 794d92
        rm -rf $RPM_BUILD_ROOT/kabi-dwarf
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    # then drop all but the needed Makefiles/Kconfig files
Justin Vreeland 794d92
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts
Justin Vreeland 794d92
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
Justin Vreeland 794d92
    cp .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    cp -a scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/tracing
Justin Vreeland 794d92
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/spdxcheck.py
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Files for 'make scripts' to succeed with kernel-devel.
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/security/selinux/include
Justin Vreeland 794d92
    cp -a --parents security/selinux/include/classmap.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    cp -a --parents security/selinux/include/initial_sid_to_string.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/tools/include/tools
Justin Vreeland 794d92
    cp -a --parents tools/include/tools/be_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
    cp -a --parents tools/include/tools/le_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
Justin Vreeland 794d92
    if [ -f tools/objtool/objtool ]; then
Justin Vreeland 794d92
      cp -a tools/objtool/objtool $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/tools/objtool/ || :
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    if [ -d arch/$Arch/scripts ]; then
Justin Vreeland 794d92
      cp -a arch/$Arch/scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch} || :
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    if [ -f arch/$Arch/*lds ]; then
Justin Vreeland 794d92
      cp -a arch/$Arch/*lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch}/ || :
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    if [ -f arch/%{asmarch}/kernel/module.lds ]; then
Justin Vreeland 794d92
      cp -a --parents arch/%{asmarch}/kernel/module.lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*.o
Justin Vreeland 794d92
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o
Justin Vreeland 794d92
%ifarch ppc64le
Justin Vreeland 794d92
    cp -a --parents arch/powerpc/lib/crtsavres.[So] $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
    if [ -d arch/%{asmarch}/include ]; then
Justin Vreeland 794d92
      cp -a --parents arch/%{asmarch}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
%ifarch aarch64
Justin Vreeland 794d92
    # arch/arm64/include/asm/xen references arch/arm
Justin Vreeland 794d92
    cp -a --parents arch/arm/include/asm/xen $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    # arch/arm64/include/asm/opcodes.h references arch/arm
Justin Vreeland 794d92
    cp -a --parents arch/arm/include/asm/opcodes.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
    # include the machine specific headers for ARM variants, if available.
Justin Vreeland 794d92
%ifarch %{arm}
Justin Vreeland 794d92
    if [ -d arch/%{asmarch}/mach-${Flavour}/include ]; then
Justin Vreeland 794d92
      cp -a --parents arch/%{asmarch}/mach-${Flavour}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    # include a few files for 'make prepare'
Justin Vreeland 794d92
    cp -a --parents arch/arm/tools/gen-mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/arm/tools/mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
    cp -a include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
Justin Vreeland 794d92
%ifarch i686 x86_64
Justin Vreeland 794d92
    # files for 'make prepare' to succeed with kernel-devel
Justin Vreeland 794d92
    cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/entry/syscalls/syscalltbl.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/entry/syscalls/syscallhdr.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/tools/relocs_32.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/tools/relocs_64.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/tools/relocs.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/tools/relocs_common.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/tools/relocs.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents tools/include/tools/le_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/purgatory/purgatory.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/purgatory/stack.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/purgatory/setup-x86_64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/purgatory/entry64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/boot/string.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/boot/string.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
    cp -a --parents arch/x86/boot/ctype.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
    # Make sure the Makefile and version.h have a matching timestamp so that
Justin Vreeland 794d92
    # external modules can be built
Justin Vreeland 794d92
    touch -r $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Makefile $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/generated/uapi/linux/version.h
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
Justin Vreeland 794d92
    cp $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/.config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/config/auto.conf
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_debuginfo}
Justin Vreeland 794d92
    eu-readelf -n vmlinux | grep "Build ID" | awk '{print $NF}' > vmlinux.id
Justin Vreeland 794d92
    cp vmlinux.id $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/vmlinux.id
Justin Vreeland 794d92
Justin Vreeland 794d92
    #
Justin Vreeland 794d92
    # save the vmlinux file for kernel debugging into the kernel-debuginfo rpm
Justin Vreeland 794d92
    #
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
Justin Vreeland 794d92
    cp vmlinux $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name "*.ko" -type f >modnames
Justin Vreeland 794d92
Justin Vreeland 794d92
    # mark modules executable so that strip-to-file can strip them
Justin Vreeland 794d92
    xargs --no-run-if-empty chmod u+x < modnames
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Generate a list of modules for block and networking.
Justin Vreeland 794d92
Justin Vreeland 794d92
    grep -F /drivers/ modnames | xargs --no-run-if-empty nm -upA |
Justin Vreeland 794d92
    sed -n 's,^.*/\([^/]*\.ko\):  *U \(.*\)$,\1 \2,p' > drivers.undef
Justin Vreeland 794d92
Justin Vreeland 794d92
    collect_modules_list()
Justin Vreeland 794d92
    {
Justin Vreeland 794d92
      sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef |
Justin Vreeland 794d92
        LC_ALL=C sort -u > $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
Justin Vreeland 794d92
      if [ ! -z "$3" ]; then
Justin Vreeland 794d92
        sed -r -e "/^($3)\$/d" -i $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
Justin Vreeland 794d92
      fi
Justin Vreeland 794d92
    }
Justin Vreeland 794d92
Justin Vreeland 794d92
    collect_modules_list networking \
Justin Vreeland 794d92
      'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt(l_|2x00)(pci|usb)_probe|register_netdevice'
Justin Vreeland 794d92
    collect_modules_list block \
Justin Vreeland 794d92
      'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_alloc_queue|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler|blk_queue_physical_block_size' 'pktcdvd.ko|dm-mod.ko'
Justin Vreeland 794d92
    collect_modules_list drm \
Justin Vreeland 794d92
      'drm_open|drm_init'
Justin Vreeland 794d92
    collect_modules_list modesetting \
Justin Vreeland 794d92
      'drm_crtc_init'
Justin Vreeland 794d92
Justin Vreeland 794d92
    # detect missing or incorrect license tags
Justin Vreeland 794d92
    ( find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name '*.ko' | xargs /sbin/modinfo -l | \
Justin Vreeland 794d92
        grep -E -v 'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' ) && exit 1
Justin Vreeland 794d92
Justin Vreeland 794d92
    # remove files that will be auto generated by depmod at rpm -i time
Justin Vreeland 794d92
    pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/
Justin Vreeland 794d92
        rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep}
Justin Vreeland 794d92
    popd
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Call the modules-extra script to move things around
Justin Vreeland 794d92
    %{SOURCE24} $RPM_BUILD_ROOT/lib/modules/$KernelVer $RPM_SOURCE_DIR/mod-extra.list
Justin Vreeland 794d92
    # Blacklist net autoloadable modules in modules-extra
Justin Vreeland 794d92
    %{SOURCE19} $RPM_BUILD_ROOT lib/modules/$KernelVer
Justin Vreeland 794d92
    # Call the modules-extra script for internal modules
Justin Vreeland 794d92
    %{SOURCE24} $RPM_BUILD_ROOT/lib/modules/$KernelVer %{SOURCE54} internal
Justin Vreeland 794d92
Justin Vreeland 794d92
    #
Justin Vreeland 794d92
    # Generate the kernel-core and kernel-modules files lists
Justin Vreeland 794d92
    #
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Copy the System.map file for depmod to use, and create a backup of the
Justin Vreeland 794d92
    # full module tree so we can restore it after we're done filtering
Justin Vreeland 794d92
    cp System.map $RPM_BUILD_ROOT/.
Justin Vreeland 794d92
    pushd $RPM_BUILD_ROOT
Justin Vreeland 794d92
    mkdir restore
Justin Vreeland 794d92
    cp -r lib/modules/$KernelVer/* restore/.
Justin Vreeland 794d92
Justin Vreeland 794d92
    # don't include anything going into k-m-e and k-m-i in the file lists
Justin Vreeland 794d92
    rm -rf lib/modules/$KernelVer/{extra,internal}
Justin Vreeland 794d92
Justin Vreeland 794d92
    if [ $DoModules -eq 1 ]; then
Justin Vreeland 794d92
	# Find all the module files and filter them out into the core and
Justin Vreeland 794d92
	# modules lists.  This actually removes anything going into -modules
Justin Vreeland 794d92
	# from the dir.
Justin Vreeland 794d92
	find lib/modules/$KernelVer/kernel -name *.ko | sort -n > modules.list
Justin Vreeland 794d92
	cp $RPM_SOURCE_DIR/filter-*.sh .
Justin Vreeland 794d92
	./filter-modules.sh modules.list %{_target_cpu}
Justin Vreeland 794d92
	rm filter-*.sh
Justin Vreeland 794d92
Justin Vreeland 794d92
	# Run depmod on the resulting module tree and make sure it isn't broken
Justin Vreeland 794d92
	depmod -b . -aeF ./System.map $KernelVer &> depmod.out
Justin Vreeland 794d92
	if [ -s depmod.out ]; then
Justin Vreeland 794d92
	    echo "Depmod failure"
Justin Vreeland 794d92
	    cat depmod.out
Justin Vreeland 794d92
	    exit 1
Justin Vreeland 794d92
	else
Justin Vreeland 794d92
	    rm depmod.out
Justin Vreeland 794d92
	fi
Justin Vreeland 794d92
    else
Justin Vreeland 794d92
	# Ensure important files/directories exist to let the packaging succeed
Justin Vreeland 794d92
	echo '%%defattr(-,-,-)' > modules.list
Justin Vreeland 794d92
	echo '%%defattr(-,-,-)' > k-d.list
Justin Vreeland 794d92
	mkdir -p lib/modules/$KernelVer/kernel
Justin Vreeland 794d92
	# Add files usually created by make modules, needed to prevent errors
Justin Vreeland 794d92
	# thrown by depmod during package installation
Justin Vreeland 794d92
	touch lib/modules/$KernelVer/modules.order
Justin Vreeland 794d92
	touch lib/modules/$KernelVer/modules.builtin
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
Justin Vreeland 794d92
    # remove files that will be auto generated by depmod at rpm -i time
Justin Vreeland 794d92
    pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/
Justin Vreeland 794d92
        rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep}
Justin Vreeland 794d92
    popd
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Go back and find all of the various directories in the tree.  We use this
Justin Vreeland 794d92
    # for the dir lists in kernel-core
Justin Vreeland 794d92
    find lib/modules/$KernelVer/kernel -mindepth 1 -type d | sort -n > module-dirs.list
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Cleanup
Justin Vreeland 794d92
    rm System.map
Justin Vreeland 794d92
    cp -r restore/* lib/modules/$KernelVer/.
Justin Vreeland 794d92
    rm -rf restore
Justin Vreeland 794d92
    popd
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Make sure the files lists start with absolute paths or rpmbuild fails.
Justin Vreeland 794d92
    # Also add in the dir entries
Justin Vreeland 794d92
    sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/k-d.list > ../kernel${Flavour:+-${Flavour}}-modules.list
Justin Vreeland 794d92
    sed -e 's/^lib*/%dir \/lib/' %{?zipsed} $RPM_BUILD_ROOT/module-dirs.list > ../kernel${Flavour:+-${Flavour}}-core.list
Justin Vreeland 794d92
    sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/modules.list >> ../kernel${Flavour:+-${Flavour}}-core.list
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Cleanup
Justin Vreeland 794d92
    rm -f $RPM_BUILD_ROOT/k-d.list
Justin Vreeland 794d92
    rm -f $RPM_BUILD_ROOT/modules.list
Justin Vreeland 794d92
    rm -f $RPM_BUILD_ROOT/module-dirs.list
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{signmodules}
Justin Vreeland 794d92
    if [ $DoModules -eq 1 ]; then
Justin Vreeland 794d92
	# Save the signing keys so we can sign the modules in __modsign_install_post
Justin Vreeland 794d92
	cp certs/signing_key.pem certs/signing_key.pem.sign${Flav}
Justin Vreeland 794d92
	cp certs/signing_key.x509 certs/signing_key.x509.sign${Flav}
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Move the devel headers out of the root file system
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT/usr/src/kernels
Justin Vreeland 794d92
    mv $RPM_BUILD_ROOT/lib/modules/$KernelVer/build $RPM_BUILD_ROOT/$DevelDir
Justin Vreeland 794d92
Justin Vreeland 794d92
    # This is going to create a broken link during the build, but we don't use
Justin Vreeland 794d92
    # it after this point.  We need the link to actually point to something
Justin Vreeland 794d92
    # when kernel-devel is installed, and a relative link doesn't work across
Justin Vreeland 794d92
    # the F17 UsrMove feature.
Justin Vreeland 794d92
    ln -sf $DevelDir $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
Justin Vreeland 794d92
Justin Vreeland 794d92
    # prune junk from kernel-devel
Justin Vreeland 794d92
    find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -delete
Justin Vreeland 794d92
Justin Vreeland 794d92
    # build a BLS config for this kernel
Justin Vreeland 794d92
    %{SOURCE53} "$KernelVer" "$RPM_BUILD_ROOT" "%{?variant}"
Justin Vreeland 794d92
Justin Vreeland 794d92
    # Red Hat UEFI Secure Boot CA cert, which can be used to authenticate the kernel
Justin Vreeland 794d92
    mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer
Justin Vreeland 794d92
    %ifarch x86_64 aarch64
Justin Vreeland 794d92
       install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca-20200609.cer
Justin Vreeland 794d92
       install -m 0644 %{secureboot_ca_1} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca-20140212.cer
Justin Vreeland 794d92
       ln -s kernel-signing-ca-20200609.cer $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer
Justin Vreeland 794d92
    %else
Justin Vreeland 794d92
       install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer
Justin Vreeland 794d92
    %endif
Justin Vreeland 794d92
    %ifarch s390x ppc64le
Justin Vreeland 794d92
    if [ $DoModules -eq 1 ]; then
Justin Vreeland 794d92
	if [ -x /usr/bin/rpm-sign ]; then
Justin Vreeland 794d92
	    install -m 0644 %{secureboot_key_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename}
Justin Vreeland 794d92
	else
Justin Vreeland 794d92
	    install -m 0644 certs/signing_key.x509.sign${Flav} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer
Justin Vreeland 794d92
	    openssl x509 -in certs/signing_key.pem.sign${Flav} -outform der -out $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename}
Justin Vreeland 794d92
	    chmod 0644 $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/%{signing_key_filename}
Justin Vreeland 794d92
	fi
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    %endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_ipaclones}
Justin Vreeland 794d92
    MAXPROCS=$(echo %{?_smp_mflags} | sed -n 's/-j\s*\([0-9]\+\)/\1/p')
Justin Vreeland 794d92
    if [ -z "$MAXPROCS" ]; then
Justin Vreeland 794d92
        MAXPROCS=1
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
    if [ "$Flavour" == "" ]; then
Justin Vreeland 794d92
        mkdir -p $RPM_BUILD_ROOT/$DevelDir-ipaclones
Justin Vreeland 794d92
        find . -name '*.ipa-clones' | xargs -i{} -r -n 1 -P $MAXPROCS install -m 644 -D "{}" "$RPM_BUILD_ROOT/$DevelDir-ipaclones/{}"
Justin Vreeland 794d92
    fi
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
}
Justin Vreeland 794d92
Justin Vreeland 794d92
###
Justin Vreeland 794d92
# DO it...
Justin Vreeland 794d92
###
Justin Vreeland 794d92
Justin Vreeland 794d92
# prepare directories
Justin Vreeland 794d92
rm -rf $RPM_BUILD_ROOT
Justin Vreeland 794d92
mkdir -p $RPM_BUILD_ROOT/boot
Justin Vreeland 794d92
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}
Justin Vreeland 794d92
Justin Vreeland 794d92
cd linux-%{KVERREL}
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_debug}
Justin Vreeland 794d92
BuildKernel %make_target %kernel_image %{_use_vdso} debug
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_zfcpdump}
Justin Vreeland 794d92
BuildKernel %make_target %kernel_image %{_use_vdso} zfcpdump
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_pae}
Justin Vreeland 794d92
BuildKernel %make_target %kernel_image %{use_vdso} lpae
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_up}
Justin Vreeland 794d92
BuildKernel %make_target %kernel_image %{_use_vdso}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%global perf_make \
Justin Vreeland 794d92
  make -s EXTRA_CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/perf V=1 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 prefix=%{_prefix} PYTHON=%{__python3}
Justin Vreeland 794d92
%if %{with_perf}
Justin Vreeland 794d92
# perf
Justin Vreeland 794d92
# make sure check-headers.sh is executable
Justin Vreeland 794d92
chmod +x tools/perf/check-headers.sh
Justin Vreeland 794d92
%{perf_make} DESTDIR=$RPM_BUILD_ROOT all
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%global tools_make \
Justin Vreeland 794d92
  %{make} CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" V=1
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_tools}
Justin Vreeland 794d92
%ifarch %{cpupowerarchs}
Justin Vreeland 794d92
# cpupower
Justin Vreeland 794d92
# make sure version-gen.sh is executable.
Justin Vreeland 794d92
chmod +x tools/power/cpupower/utils/version-gen.sh
Justin Vreeland 794d92
%{tools_make} %{?_smp_mflags} -C tools/power/cpupower CPUFREQ_BENCH=false
Justin Vreeland 794d92
%ifarch x86_64
Justin Vreeland 794d92
    pushd tools/power/cpupower/debug/x86_64
Justin Vreeland 794d92
    %{tools_make} %{?_smp_mflags} centrino-decode powernow-k8-decode
Justin Vreeland 794d92
    popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%ifarch x86_64
Justin Vreeland 794d92
   pushd tools/power/x86/x86_energy_perf_policy/
Justin Vreeland 794d92
   %{tools_make}
Justin Vreeland 794d92
   popd
Justin Vreeland 794d92
   pushd tools/power/x86/turbostat
Justin Vreeland 794d92
   %{tools_make}
Justin Vreeland 794d92
   popd
Justin Vreeland 794d92
   pushd tools/power/x86/intel-speed-select
Justin Vreeland 794d92
   %{make}
Justin Vreeland 794d92
   popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
pushd tools/thermal/tmon/
Justin Vreeland 794d92
%{tools_make}
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
pushd tools/iio/
Justin Vreeland 794d92
%{make}
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
pushd tools/gpio/
Justin Vreeland 794d92
%{make}
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%global bpftool_make \
Justin Vreeland 794d92
  make EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=$RPM_BUILD_ROOT V=1
Justin Vreeland 794d92
%if %{with_bpftool}
Justin Vreeland 794d92
pushd tools/bpf/bpftool
Justin Vreeland 794d92
%{bpftool_make}
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_selftests}
Justin Vreeland 794d92
%{make} -s ARCH=$Arch V=1 samples/bpf/
Justin Vreeland 794d92
pushd tools/testing/selftests
Justin Vreeland 794d92
# We need to install here because we need to call make with ARCH set which
Justin Vreeland 794d92
# doesn't seem possible to do in the install section.
Justin Vreeland 794d92
%{make} -s ARCH=$Arch V=1 TARGETS="bpf livepatch net" INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests install
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_doc}
Justin Vreeland 794d92
# Make the HTML pages.
Justin Vreeland 794d92
make PYTHON=/usr/bin/python3 htmldocs || %{doc_build_fail}
Justin Vreeland 794d92
Justin Vreeland 794d92
# sometimes non-world-readable files sneak into the kernel source tree
Justin Vreeland 794d92
chmod -R a=rX Documentation
Justin Vreeland 794d92
find Documentation -type d | xargs chmod u+w
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# In the modsign case, we do 3 things.  1) We check the "flavour" and hard
Justin Vreeland 794d92
# code the value in the following invocations.  This is somewhat sub-optimal
Justin Vreeland 794d92
# but we're doing this inside of an RPM macro and it isn't as easy as it
Justin Vreeland 794d92
# could be because of that.  2) We restore the .tmp_versions/ directory from
Justin Vreeland 794d92
# the one we saved off in BuildKernel above.  This is to make sure we're
Justin Vreeland 794d92
# signing the modules we actually built/installed in that flavour.  3) We
Justin Vreeland 794d92
# grab the arch and invoke mod-sign.sh command to actually sign the modules.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# We have to do all of those things _after_ find-debuginfo runs, otherwise
Justin Vreeland 794d92
# that will strip the signature off of the modules.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# Don't sign modules for the zfcpdump flavour as it is monolithic.
Justin Vreeland 794d92
Justin Vreeland 794d92
%define __modsign_install_post \
Justin Vreeland 794d92
  if [ "%{signmodules}" -eq "1" ]; then \
Justin Vreeland 794d92
    if [ "%{with_pae}" -ne "0" ]; then \
Justin Vreeland 794d92
       %{modsign_cmd} certs/signing_key.pem.sign+lpae certs/signing_key.x509.sign+lpae $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+lpae/ \
Justin Vreeland 794d92
    fi \
Justin Vreeland 794d92
    if [ "%{with_debug}" -ne "0" ]; then \
Justin Vreeland 794d92
      %{modsign_cmd} certs/signing_key.pem.sign+debug certs/signing_key.x509.sign+debug $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+debug/ \
Justin Vreeland 794d92
    fi \
Justin Vreeland 794d92
    if [ "%{with_up}" -ne "0" ]; then \
Justin Vreeland 794d92
      %{modsign_cmd} certs/signing_key.pem.sign certs/signing_key.x509.sign $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/ \
Justin Vreeland 794d92
    fi \
Justin Vreeland 794d92
  fi \
Justin Vreeland 794d92
  if [ "%{zipmodules}" -eq "1" ]; then \
Justin Vreeland 794d92
    find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs -P%{zcpu} xz; \
Justin Vreeland 794d92
  fi \
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
###
Justin Vreeland 794d92
### Special hacks for debuginfo subpackages.
Justin Vreeland 794d92
###
Justin Vreeland 794d92
Justin Vreeland 794d92
# This macro is used by %%install, so we must redefine it before that.
Justin Vreeland 794d92
%define debug_package %{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_debuginfo}
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifnarch noarch
Justin Vreeland 794d92
%global __debug_package 1
Justin Vreeland 794d92
%files -f debugfiles.list debuginfo-common-%{_target_cpu}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# We don't want to package debuginfo for self-tests and samples but
Justin Vreeland 794d92
# we have to delete them to avoid an error messages about unpackaged
Justin Vreeland 794d92
# files.
Justin Vreeland 794d92
# Delete the debuginfo for for kernel-devel files
Justin Vreeland 794d92
%define __remove_unwanted_dbginfo_install_post \
Justin Vreeland 794d92
  if [ "%{with_selftests}" -ne "0" ]; then \
Justin Vreeland 794d92
    rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/libexec/ksamples; \
Justin Vreeland 794d92
    rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/libexec/kselftests; \
Justin Vreeland 794d92
  fi \
Justin Vreeland 794d92
  rm -rf $RPM_BUILD_ROOT/usr/lib/debug/usr/src; \
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# Disgusting hack alert! We need to ensure we sign modules *after* all
Justin Vreeland 794d92
# invocations of strip occur, which is in __debug_install_post if
Justin Vreeland 794d92
# find-debuginfo.sh runs, and __os_install_post if not.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define __spec_install_post \
Justin Vreeland 794d92
  %{?__debug_package:%{__debug_install_post}}\
Justin Vreeland 794d92
  %{__arch_install_post}\
Justin Vreeland 794d92
  %{__os_install_post}\
Justin Vreeland 794d92
  %{__remove_unwanted_dbginfo_install_post}\
Justin Vreeland 794d92
  %{__modsign_install_post}
Justin Vreeland 794d92
Justin Vreeland 794d92
###
Justin Vreeland 794d92
### install
Justin Vreeland 794d92
###
Justin Vreeland 794d92
Justin Vreeland 794d92
%install
Justin Vreeland 794d92
Justin Vreeland 794d92
cd linux-%{KVERREL}
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_doc}
Justin Vreeland 794d92
docdir=$RPM_BUILD_ROOT%{_datadir}/doc/kernel-doc-%{rpmversion}
Justin Vreeland 794d92
Justin Vreeland 794d92
# copy the source over
Justin Vreeland 794d92
mkdir -p $docdir
Justin Vreeland 794d92
tar -h -f - --exclude=man --exclude='.*' -c Documentation | tar xf - -C $docdir
Justin Vreeland 794d92
Justin Vreeland 794d92
# with_doc
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# We have to do the headers install before the tools install because the
Justin Vreeland 794d92
# kernel headers_install will remove any header files in /usr/include that
Justin Vreeland 794d92
# it doesn't install itself.
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_headers}
Justin Vreeland 794d92
# Install kernel headers
Justin Vreeland 794d92
make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
Justin Vreeland 794d92
Justin Vreeland 794d92
find $RPM_BUILD_ROOT/usr/include \
Justin Vreeland 794d92
     \( -name .install -o -name .check -o \
Justin Vreeland 794d92
        -name ..install.cmd -o -name ..check.cmd \) -delete
Justin Vreeland 794d92
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_cross_headers}
Justin Vreeland 794d92
%if 0%{?fedora}
Justin Vreeland 794d92
HDR_ARCH_LIST='arm arm64 powerpc s390 x86'
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
HDR_ARCH_LIST='arm64 powerpc s390 x86'
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
mkdir -p $RPM_BUILD_ROOT/usr/tmp-headers
Justin Vreeland 794d92
Justin Vreeland 794d92
for arch in $HDR_ARCH_LIST; do
Justin Vreeland 794d92
	mkdir $RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch}
Justin Vreeland 794d92
	make ARCH=${arch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch} headers_install
Justin Vreeland 794d92
done
Justin Vreeland 794d92
Justin Vreeland 794d92
find $RPM_BUILD_ROOT/usr/tmp-headers \
Justin Vreeland 794d92
     \( -name .install -o -name .check -o \
Justin Vreeland 794d92
        -name ..install.cmd -o -name ..check.cmd \) -delete
Justin Vreeland 794d92
Justin Vreeland 794d92
# Copy all the architectures we care about to their respective asm directories
Justin Vreeland 794d92
for arch in $HDR_ARCH_LIST ; do
Justin Vreeland 794d92
	mkdir -p $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include
Justin Vreeland 794d92
	mv $RPM_BUILD_ROOT/usr/tmp-headers/arch-${arch}/include/* $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/
Justin Vreeland 794d92
done
Justin Vreeland 794d92
Justin Vreeland 794d92
rm -rf $RPM_BUILD_ROOT/usr/tmp-headers
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_kernel_abi_whitelists}
Justin Vreeland 794d92
# kabi directory
Justin Vreeland 794d92
INSTALL_KABI_PATH=$RPM_BUILD_ROOT/lib/modules/
Justin Vreeland 794d92
mkdir -p $INSTALL_KABI_PATH
Justin Vreeland 794d92
Justin Vreeland 794d92
# install kabi releases directories
Justin Vreeland 794d92
tar xjvf %{SOURCE300} -C $INSTALL_KABI_PATH
Justin Vreeland 794d92
# with_kernel_abi_whitelists
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_perf}
Justin Vreeland 794d92
# perf tool binary and supporting scripts/binaries
Justin Vreeland 794d92
%{perf_make} DESTDIR=$RPM_BUILD_ROOT lib=%{_lib} install-bin install-traceevent-plugins
Justin Vreeland 794d92
# remove the 'trace' symlink.
Justin Vreeland 794d92
rm -f %{buildroot}%{_bindir}/trace
Justin Vreeland 794d92
Justin Vreeland 794d92
# For both of the below, yes, this should be using a macro but right now
Justin Vreeland 794d92
# it's hard coded and we don't actually want it anyway right now.
Justin Vreeland 794d92
# Whoever wants examples can fix it up!
Justin Vreeland 794d92
Justin Vreeland 794d92
# remove examples
Justin Vreeland 794d92
rm -rf %{buildroot}/usr/lib/perf/examples
Justin Vreeland 794d92
# remove the stray files that somehow got packaged
Justin Vreeland 794d92
rm -rf %{buildroot}/usr/lib/perf/include/bpf/bpf.h
Justin Vreeland 794d92
rm -rf %{buildroot}/usr/lib/perf/include/bpf/stdio.h
Justin Vreeland 794d92
rm -rf %{buildroot}/usr/lib/perf/include/bpf/linux/socket.h
Justin Vreeland 794d92
rm -rf %{buildroot}/usr/lib/perf/include/bpf/pid_filter.h
Justin Vreeland 794d92
rm -rf %{buildroot}/usr/lib/perf/include/bpf/unistd.h
Justin Vreeland 794d92
Justin Vreeland 794d92
# python-perf extension
Justin Vreeland 794d92
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-python_ext
Justin Vreeland 794d92
Justin Vreeland 794d92
# perf man pages (note: implicit rpm magic compresses them later)
Justin Vreeland 794d92
mkdir -p %{buildroot}/%{_mandir}/man1
Justin Vreeland 794d92
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_tools}
Justin Vreeland 794d92
%ifarch %{cpupowerarchs}
Justin Vreeland 794d92
%{make} -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
Justin Vreeland 794d92
rm -f %{buildroot}%{_libdir}/*.{a,la}
Justin Vreeland 794d92
%find_lang cpupower
Justin Vreeland 794d92
mv cpupower.lang ../
Justin Vreeland 794d92
%ifarch x86_64
Justin Vreeland 794d92
    pushd tools/power/cpupower/debug/x86_64
Justin Vreeland 794d92
    install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
Justin Vreeland 794d92
    install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
Justin Vreeland 794d92
    popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
Justin Vreeland 794d92
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
Justin Vreeland 794d92
install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service
Justin Vreeland 794d92
install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%ifarch x86_64
Justin Vreeland 794d92
   mkdir -p %{buildroot}%{_mandir}/man8
Justin Vreeland 794d92
   pushd tools/power/x86/x86_energy_perf_policy
Justin Vreeland 794d92
   %{tools_make} DESTDIR=%{buildroot} install
Justin Vreeland 794d92
   popd
Justin Vreeland 794d92
   pushd tools/power/x86/turbostat
Justin Vreeland 794d92
   %{tools_make} DESTDIR=%{buildroot} install
Justin Vreeland 794d92
   popd
Justin Vreeland 794d92
   pushd tools/power/x86/intel-speed-select
Justin Vreeland 794d92
   %{tools_make} CFLAGS+="-D_GNU_SOURCE -Iinclude" DESTDIR=%{buildroot} install
Justin Vreeland 794d92
   popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
pushd tools/thermal/tmon
Justin Vreeland 794d92
%{tools_make} INSTALL_ROOT=%{buildroot} install
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
pushd tools/iio
Justin Vreeland 794d92
make DESTDIR=%{buildroot} install
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
pushd tools/gpio
Justin Vreeland 794d92
make DESTDIR=%{buildroot} install
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
pushd tools/kvm/kvm_stat
Justin Vreeland 794d92
make INSTALL_ROOT=%{buildroot} install-tools
Justin Vreeland 794d92
make INSTALL_ROOT=%{buildroot} install-man
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_bpftool}
Justin Vreeland 794d92
pushd tools/bpf/bpftool
Justin Vreeland 794d92
%{bpftool_make} prefix=%{_prefix} bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install doc-install
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_selftests}
Justin Vreeland 794d92
pushd samples
Justin Vreeland 794d92
install -d %{buildroot}%{_libexecdir}/ksamples
Justin Vreeland 794d92
# install bpf samples
Justin Vreeland 794d92
pushd bpf
Justin Vreeland 794d92
install -d %{buildroot}%{_libexecdir}/ksamples/bpf
Justin Vreeland 794d92
find -type f -executable -exec install -m755 {} %{buildroot}%{_libexecdir}/ksamples/bpf \;
Justin Vreeland 794d92
install -m755 *.sh %{buildroot}%{_libexecdir}/ksamples/bpf
Justin Vreeland 794d92
# test_lwt_bpf.sh compiles test_lwt_bpf.c when run; this works only from the
Justin Vreeland 794d92
# kernel tree. Just remove it.
Justin Vreeland 794d92
rm %{buildroot}%{_libexecdir}/ksamples/bpf/test_lwt_bpf.sh
Justin Vreeland 794d92
install -m644 tcp_bpf.readme %{buildroot}%{_libexecdir}/ksamples/bpf
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
# install pktgen samples
Justin Vreeland 794d92
pushd pktgen
Justin Vreeland 794d92
install -d %{buildroot}%{_libexecdir}/ksamples/pktgen
Justin Vreeland 794d92
find . -type f -executable -exec install -m755 {} %{buildroot}%{_libexecdir}/ksamples/pktgen/{} \;
Justin Vreeland 794d92
find . -type f ! -executable -exec install -m644 {} %{buildroot}%{_libexecdir}/ksamples/pktgen/{} \;
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
# install drivers/net/mlxsw selftests
Justin Vreeland 794d92
pushd tools/testing/selftests/drivers/net/mlxsw
Justin Vreeland 794d92
find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/drivers/net/mlxsw/{} \;
Justin Vreeland 794d92
find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/drivers/net/mlxsw/{} \;
Justin Vreeland 794d92
find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/drivers/net/mlxsw/{} \;
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
# install net/forwarding selftests
Justin Vreeland 794d92
pushd tools/testing/selftests/net/forwarding
Justin Vreeland 794d92
find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/net/forwarding/{} \;
Justin Vreeland 794d92
find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/net/forwarding/{} \;
Justin Vreeland 794d92
find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/net/forwarding/{} \;
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
# install tc-testing selftests
Justin Vreeland 794d92
pushd tools/testing/selftests/tc-testing
Justin Vreeland 794d92
find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/tc-testing/{} \;
Justin Vreeland 794d92
find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/tc-testing/{} \;
Justin Vreeland 794d92
find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/tc-testing/{} \;
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
# install livepatch selftests
Justin Vreeland 794d92
pushd tools/testing/selftests/livepatch
Justin Vreeland 794d92
find -type d -exec install -d %{buildroot}%{_libexecdir}/kselftests/livepatch/{} \;
Justin Vreeland 794d92
find -type f -executable -exec install -D -m755 {} %{buildroot}%{_libexecdir}/kselftests/livepatch/{} \;
Justin Vreeland 794d92
find -type f ! -executable -exec install -D -m644 {} %{buildroot}%{_libexecdir}/kselftests/livepatch/{} \;
Justin Vreeland 794d92
popd
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# We have to do the headers checksum calculation after the tools install because
Justin Vreeland 794d92
# these might end up installing their own set of headers on top of kernel's
Justin Vreeland 794d92
%if %{with_headers}
Justin Vreeland 794d92
# compute a content hash to export as Provides: kernel-headers-checksum
Justin Vreeland 794d92
HEADERS_CHKSUM=$(export LC_ALL=C; find $RPM_BUILD_ROOT/usr/include -type f -name "*.h" \
Justin Vreeland 794d92
			! -path $RPM_BUILD_ROOT/usr/include/linux/version.h | \
Justin Vreeland 794d92
		 sort | xargs cat | sha1sum - | cut -f 1 -d ' ');
Justin Vreeland 794d92
# export the checksum via usr/include/linux/version.h, so the dynamic
Justin Vreeland 794d92
# find-provides can grab the hash to update it accordingly
Justin Vreeland 794d92
echo "#define KERNEL_HEADERS_CHECKSUM \"$HEADERS_CHKSUM\"" >> $RPM_BUILD_ROOT/usr/include/linux/version.h
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
###
Justin Vreeland 794d92
### clean
Justin Vreeland 794d92
###
Justin Vreeland 794d92
Justin Vreeland 794d92
###
Justin Vreeland 794d92
### scripts
Justin Vreeland 794d92
###
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_tools}
Justin Vreeland 794d92
%post -n kernel-tools-libs
Justin Vreeland 794d92
/sbin/ldconfig
Justin Vreeland 794d92
Justin Vreeland 794d92
%postun -n kernel-tools-libs
Justin Vreeland 794d92
/sbin/ldconfig
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro defines a %%post script for a kernel*-devel package.
Justin Vreeland 794d92
#	%%kernel_devel_post [<subpackage>]
Justin Vreeland 794d92
# Note we don't run hardlink if ostree is in use, as ostree is
Justin Vreeland 794d92
# a far more sophisticated hardlink implementation.
Justin Vreeland 794d92
# https://github.com/projectatomic/rpm-ostree/commit/58a79056a889be8814aa51f507b2c7a4dccee526
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_devel_post() \
Justin Vreeland 794d92
%{expand:%%post %{?1:%{1}-}devel}\
Justin Vreeland 794d92
if [ -f /etc/sysconfig/kernel ]\
Justin Vreeland 794d92
then\
Justin Vreeland 794d92
    . /etc/sysconfig/kernel || exit $?\
Justin Vreeland 794d92
fi\
Justin Vreeland 794d92
if [ "$HARDLINK" != "no" -a -x /usr/sbin/hardlink -a ! -e /run/ostree-booted ] \
Justin Vreeland 794d92
then\
Justin Vreeland 794d92
    (cd /usr/src/kernels/%{KVERREL}%{?1:+%{1}} &&\
Justin Vreeland 794d92
     /usr/bin/find . -type f | while read f; do\
Justin Vreeland 794d92
       hardlink -c /usr/src/kernels/*%{?dist}.*/$f $f\
Justin Vreeland 794d92
     done)\
Justin Vreeland 794d92
fi\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro defines a %%post script for a kernel*-modules-extra package.
Justin Vreeland 794d92
# It also defines a %%postun script that does the same thing.
Justin Vreeland 794d92
#	%%kernel_modules_extra_post [<subpackage>]
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_modules_extra_post() \
Justin Vreeland 794d92
%{expand:%%post %{?1:%{1}-}modules-extra}\
Justin Vreeland 794d92
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
Justin Vreeland 794d92
%{nil}\
Justin Vreeland 794d92
%{expand:%%postun %{?1:%{1}-}modules-extra}\
Justin Vreeland 794d92
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro defines a %%post script for a kernel*-modules-internal package.
Justin Vreeland 794d92
# It also defines a %%postun script that does the same thing.
Justin Vreeland 794d92
#	%%kernel_modules_internal_post [<subpackage>]
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_modules_internal_post() \
Justin Vreeland 794d92
%{expand:%%post %{?1:%{1}-}modules-internal}\
Justin Vreeland 794d92
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
Justin Vreeland 794d92
%{nil}\
Justin Vreeland 794d92
%{expand:%%postun %{?1:%{1}-}modules-internal}\
Justin Vreeland 794d92
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro defines a %%post script for a kernel*-modules package.
Justin Vreeland 794d92
# It also defines a %%postun script that does the same thing.
Justin Vreeland 794d92
#	%%kernel_modules_post [<subpackage>]
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_modules_post() \
Justin Vreeland 794d92
%{expand:%%post %{?1:%{1}-}modules}\
Justin Vreeland 794d92
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
Justin Vreeland 794d92
%{nil}\
Justin Vreeland 794d92
%{expand:%%postun %{?1:%{1}-}modules}\
Justin Vreeland 794d92
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
# This macro defines a %%posttrans script for a kernel package.
Justin Vreeland 794d92
#	%%kernel_variant_posttrans [<subpackage>]
Justin Vreeland 794d92
# More text can follow to go at the end of this variant's %%post.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_variant_posttrans() \
Justin Vreeland 794d92
%{expand:%%posttrans %{?1:%{1}-}core}\
Justin Vreeland 794d92
%if 0%{!?fedora:1}\
Justin Vreeland 794d92
if [ -x %{_sbindir}/weak-modules ]\
Justin Vreeland 794d92
then\
Justin Vreeland 794d92
    %{_sbindir}/weak-modules --add-kernel %{KVERREL}%{?1:+%{1}} || exit $?\
Justin Vreeland 794d92
fi\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
/bin/kernel-install add %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro defines a %%post script for a kernel package and its devel package.
Justin Vreeland 794d92
#	%%kernel_variant_post [-v <subpackage>] [-r <replace>]
Justin Vreeland 794d92
# More text can follow to go at the end of this variant's %%post.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_variant_post(v:r:) \
Justin Vreeland 794d92
%{expand:%%kernel_devel_post %{?-v*}}\
Justin Vreeland 794d92
%{expand:%%kernel_modules_post %{?-v*}}\
Justin Vreeland 794d92
%{expand:%%kernel_modules_extra_post %{?-v*}}\
Justin Vreeland 794d92
%{expand:%%kernel_modules_internal_post %{?-v*}}\
Justin Vreeland 794d92
%{expand:%%kernel_variant_posttrans %{?-v*}}\
Justin Vreeland 794d92
%{expand:%%post %{?-v*:%{-v*}-}core}\
Justin Vreeland 794d92
%{-r:\
Justin Vreeland 794d92
if [ `uname -i` == "x86_64" -o `uname -i` == "i386" ] &&\
Justin Vreeland 794d92
   [ -f /etc/sysconfig/kernel ]; then\
Justin Vreeland 794d92
  /bin/sed -r -i -e 's/^DEFAULTKERNEL=%{-r*}$/DEFAULTKERNEL=kernel%{?-v:-%{-v*}}/' /etc/sysconfig/kernel || exit $?\
Justin Vreeland 794d92
fi}\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro defines a %%preun script for a kernel package.
Justin Vreeland 794d92
#	%%kernel_variant_preun <subpackage>
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_variant_preun() \
Justin Vreeland 794d92
%{expand:%%preun %{?1:%{1}-}core}\
Justin Vreeland 794d92
/bin/kernel-install remove %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\
Justin Vreeland 794d92
%if 0%{!?fedora:1}\
Justin Vreeland 794d92
if [ -x %{_sbindir}/weak-modules ]\
Justin Vreeland 794d92
then\
Justin Vreeland 794d92
    %{_sbindir}/weak-modules --remove-kernel %{KVERREL}%{?1:+%{1}} || exit $?\
Justin Vreeland 794d92
fi\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
%kernel_variant_preun
Justin Vreeland 794d92
%kernel_variant_post -r kernel-smp
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_pae}
Justin Vreeland 794d92
%kernel_variant_preun lpae
Justin Vreeland 794d92
%kernel_variant_post -v lpae -r (kernel|kernel-smp)
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%kernel_variant_preun debug
Justin Vreeland 794d92
%kernel_variant_post -v debug
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_zfcpdump}
Justin Vreeland 794d92
%kernel_variant_preun zfcpdump
Justin Vreeland 794d92
%kernel_variant_post -v zfcpdump
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
if [ -x /sbin/ldconfig ]
Justin Vreeland 794d92
then
Justin Vreeland 794d92
    /sbin/ldconfig -X || exit $?
Justin Vreeland 794d92
fi
Justin Vreeland 794d92
Justin Vreeland 794d92
###
Justin Vreeland 794d92
### file lists
Justin Vreeland 794d92
###
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_headers}
Justin Vreeland 794d92
%files headers
Justin Vreeland 794d92
/usr/include/*
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_cross_headers}
Justin Vreeland 794d92
%files cross-headers
Justin Vreeland 794d92
/usr/*-linux-gnu/include/*
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_kernel_abi_whitelists}
Justin Vreeland 794d92
%files -n kernel-abi-whitelists
Justin Vreeland 794d92
/lib/modules/kabi-*
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_kabidw_base}
Justin Vreeland 794d92
%ifarch x86_64 s390x ppc64 ppc64le aarch64
Justin Vreeland 794d92
%files kabidw-base
Justin Vreeland 794d92
%defattr(-,root,root)
Justin Vreeland 794d92
/kabidw-base/%{_target_cpu}/*
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# only some architecture builds need kernel-doc
Justin Vreeland 794d92
%if %{with_doc}
Justin Vreeland 794d92
%files doc
Justin Vreeland 794d92
%defattr(-,root,root)
Justin Vreeland 794d92
%{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation/*
Justin Vreeland 794d92
%dir %{_datadir}/doc/kernel-doc-%{rpmversion}/Documentation
Justin Vreeland 794d92
%dir %{_datadir}/doc/kernel-doc-%{rpmversion}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_perf}
Justin Vreeland 794d92
%files -n perf
Justin Vreeland 794d92
%{_bindir}/perf
Justin Vreeland 794d92
%{_libdir}/libperf-jvmti.so
Justin Vreeland 794d92
%dir %{_libdir}/traceevent/plugins
Justin Vreeland 794d92
%{_libdir}/traceevent/plugins/*
Justin Vreeland 794d92
%dir %{_libexecdir}/perf-core
Justin Vreeland 794d92
%{_libexecdir}/perf-core/*
Justin Vreeland 794d92
%{_datadir}/perf-core/*
Justin Vreeland 794d92
%{_mandir}/man[1-8]/perf*
Justin Vreeland 794d92
%{_sysconfdir}/bash_completion.d/perf
Justin Vreeland 794d92
%doc linux-%{KVERREL}/tools/perf/Documentation/examples.txt
Justin Vreeland 794d92
%{_docdir}/perf-tip/tips.txt
Justin Vreeland 794d92
Justin Vreeland 794d92
%files -n python3-perf
Justin Vreeland 794d92
%{python3_sitearch}/*
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_debuginfo}
Justin Vreeland 794d92
%files -f perf-debuginfo.list -n perf-debuginfo
Justin Vreeland 794d92
Justin Vreeland 794d92
%files -f python3-perf-debuginfo.list -n python3-perf-debuginfo
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
# with_perf
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_tools}
Justin Vreeland 794d92
%ifnarch %{cpupowerarchs}
Justin Vreeland 794d92
%files -n kernel-tools
Justin Vreeland 794d92
%else
Justin Vreeland 794d92
%files -n kernel-tools -f cpupower.lang
Justin Vreeland 794d92
%{_bindir}/cpupower
Justin Vreeland 794d92
%{_datadir}/bash-completion/completions/cpupower
Justin Vreeland 794d92
%ifarch x86_64
Justin Vreeland 794d92
%{_bindir}/centrino-decode
Justin Vreeland 794d92
%{_bindir}/powernow-k8-decode
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%{_unitdir}/cpupower.service
Justin Vreeland 794d92
%{_mandir}/man[1-8]/cpupower*
Justin Vreeland 794d92
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
Justin Vreeland 794d92
%ifarch x86_64
Justin Vreeland 794d92
%{_bindir}/x86_energy_perf_policy
Justin Vreeland 794d92
%{_mandir}/man8/x86_energy_perf_policy*
Justin Vreeland 794d92
%{_bindir}/turbostat
Justin Vreeland 794d92
%{_mandir}/man8/turbostat*
Justin Vreeland 794d92
%{_bindir}/intel-speed-select
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
# cpupowerarchs
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%{_bindir}/tmon
Justin Vreeland 794d92
%{_bindir}/iio_event_monitor
Justin Vreeland 794d92
%{_bindir}/iio_generic_buffer
Justin Vreeland 794d92
%{_bindir}/lsiio
Justin Vreeland 794d92
%{_bindir}/lsgpio
Justin Vreeland 794d92
%{_bindir}/gpio-hammer
Justin Vreeland 794d92
%{_bindir}/gpio-event-mon
Justin Vreeland 794d92
%{_bindir}/gpio-watch
Justin Vreeland 794d92
%{_mandir}/man1/kvm_stat*
Justin Vreeland 794d92
%{_bindir}/kvm_stat
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_debuginfo}
Justin Vreeland 794d92
%files -f kernel-tools-debuginfo.list -n kernel-tools-debuginfo
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%ifarch %{cpupowerarchs}
Justin Vreeland 794d92
%files -n kernel-tools-libs
Justin Vreeland 794d92
%{_libdir}/libcpupower.so.0
Justin Vreeland 794d92
%{_libdir}/libcpupower.so.0.0.1
Justin Vreeland 794d92
Justin Vreeland 794d92
%files -n kernel-tools-libs-devel
Justin Vreeland 794d92
%{_libdir}/libcpupower.so
Justin Vreeland 794d92
%{_includedir}/cpufreq.h
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
# with_tools
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_bpftool}
Justin Vreeland 794d92
%files -n bpftool
Justin Vreeland 794d92
%{_sbindir}/bpftool
Justin Vreeland 794d92
%{_sysconfdir}/bash_completion.d/bpftool
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-cgroup.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-iter.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-link.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-struct_ops.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-gen.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-map.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-prog.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-perf.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool.8.gz
Justin Vreeland 794d92
%{_mandir}/man7/bpf-helpers.7.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-net.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-feature.8.gz
Justin Vreeland 794d92
%{_mandir}/man8/bpftool-btf.8.gz
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_debuginfo}
Justin Vreeland 794d92
%files -f bpftool-debuginfo.list -n bpftool-debuginfo
Justin Vreeland 794d92
%defattr(-,root,root)
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_selftests}
Justin Vreeland 794d92
%files selftests-internal
Justin Vreeland 794d92
%{_libexecdir}/ksamples
Justin Vreeland 794d92
%{_libexecdir}/kselftests
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# empty meta-package
Justin Vreeland 794d92
%ifnarch %nobuildarches noarch
Justin Vreeland 794d92
%files
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
%if %{with_gcov}
Justin Vreeland 794d92
%ifarch x86_64 s390x ppc64le aarch64
Justin Vreeland 794d92
%files gcov
Justin Vreeland 794d92
%{_builddir}
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
%endif
Justin Vreeland 794d92
Justin Vreeland 794d92
# This is %%{image_install_path} on an arch where that includes ELF files,
Justin Vreeland 794d92
# or empty otherwise.
Justin Vreeland 794d92
%define elf_image_install_path %{?kernel_image_elf:%{image_install_path}}
Justin Vreeland 794d92
Justin Vreeland 794d92
#
Justin Vreeland 794d92
# This macro defines the %%files sections for a kernel package
Justin Vreeland 794d92
# and its devel and debuginfo packages.
Justin Vreeland 794d92
#	%%kernel_variant_files [-k vmlinux] <condition> <subpackage> <without_modules>
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%define kernel_variant_files(k:) \
Justin Vreeland 794d92
%if %{2}\
Justin Vreeland 794d92
%{expand:%%files -f kernel-%{?3:%{3}-}core.list %{?1:-f kernel-%{?3:%{3}-}ldsoconf.list} %{?3:%{3}-}core}\
Justin Vreeland 794d92
%{!?_licensedir:%global license %%doc}\
Justin Vreeland 794d92
%license linux-%{KVERREL}/COPYING-%{version}-%{release}\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/%{?-k:%{-k*}}%{!?-k:vmlinuz}\
Justin Vreeland 794d92
%ghost /%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?3:+%{3}}\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/.vmlinuz.hmac \
Justin Vreeland 794d92
%ghost /%{image_install_path}/.vmlinuz-%{KVERREL}%{?3:+%{3}}.hmac \
Justin Vreeland 794d92
%ifarch %{arm} aarch64\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/dtb \
Justin Vreeland 794d92
%ghost /%{image_install_path}/dtb-%{KVERREL}%{?3:+%{3}} \
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%attr(600,root,root) /lib/modules/%{KVERREL}%{?3:+%{3}}/System.map\
Justin Vreeland 794d92
%ghost /boot/System.map-%{KVERREL}%{?3:+%{3}}\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/symvers.gz\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/config\
Justin Vreeland 794d92
%ghost /boot/symvers-%{KVERREL}%{?3:+%{3}}.gz\
Justin Vreeland 794d92
%ghost /boot/config-%{KVERREL}%{?3:+%{3}}\
Justin Vreeland 794d92
%ghost /boot/initramfs-%{KVERREL}%{?3:+%{3}}.img\
Justin Vreeland 794d92
%dir /lib/modules\
Justin Vreeland 794d92
%dir /lib/modules/%{KVERREL}%{?3:+%{3}}\
Justin Vreeland 794d92
%dir /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/build\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/source\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/updates\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/bls.conf\
Justin Vreeland 794d92
%if 0%{!?fedora:1}\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/weak-updates\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%{_datadir}/doc/kernel-keys/%{KVERREL}%{?3:+%{3}}/kernel-signing-ca*.cer\
Justin Vreeland 794d92
%ifarch s390x ppc64le\
Justin Vreeland 794d92
%if 0%{!?4:1}\
Justin Vreeland 794d92
%{_datadir}/doc/kernel-keys/%{KVERREL}%{?3:+%{3}}/%{signing_key_filename} \
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%if %{1}\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/vdso\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/modules.*\
Justin Vreeland 794d92
%{expand:%%files -f kernel-%{?3:%{3}-}modules.list %{?3:%{3}-}modules}\
Justin Vreeland 794d92
%{expand:%%files %{?3:%{3}-}devel}\
Justin Vreeland 794d92
%defverify(not mtime)\
Justin Vreeland 794d92
/usr/src/kernels/%{KVERREL}%{?3:+%{3}}\
Justin Vreeland 794d92
%{expand:%%files %{?3:%{3}-}modules-extra}\
Justin Vreeland 794d92
%config(noreplace) /etc/modprobe.d/*-blacklist.conf\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/extra\
Justin Vreeland 794d92
%{expand:%%files %{?3:%{3}-}modules-internal}\
Justin Vreeland 794d92
/lib/modules/%{KVERREL}%{?3:+%{3}}/internal\
Justin Vreeland 794d92
%if %{with_debuginfo}\
Justin Vreeland 794d92
%ifnarch noarch\
Justin Vreeland 794d92
%{expand:%%files -f debuginfo%{?3}.list %{?3:%{3}-}debuginfo}\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%if %{?3:1} %{!?3:0}\
Justin Vreeland 794d92
%{expand:%%files %{3}}\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
%kernel_variant_files %{_use_vdso} %{with_up}
Justin Vreeland 794d92
%kernel_variant_files %{_use_vdso} %{with_debug} debug
Justin Vreeland 794d92
%kernel_variant_files %{use_vdso} %{with_pae} lpae
Justin Vreeland 794d92
%kernel_variant_files %{_use_vdso} %{with_zfcpdump} zfcpdump 1
Justin Vreeland 794d92
Justin Vreeland 794d92
%define kernel_variant_ipaclones(k:) \
Justin Vreeland 794d92
%if %{1}\
Justin Vreeland 794d92
%if %{with_ipaclones}\
Justin Vreeland 794d92
%{expand:%%files %{?2:%{2}-}ipaclones-internal}\
Justin Vreeland 794d92
%defattr(-,root,root)\
Justin Vreeland 794d92
%defverify(not mtime)\
Justin Vreeland 794d92
/usr/src/kernels/%{KVERREL}%{?2:+%{2}}-ipaclones\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%endif\
Justin Vreeland 794d92
%{nil}
Justin Vreeland 794d92
Justin Vreeland 794d92
%kernel_variant_ipaclones %{with_up}
Justin Vreeland 794d92
Justin Vreeland 794d92
# plz don't put in a version string unless you're going to tag
Justin Vreeland 794d92
# and build.
Justin Vreeland 794d92
#
Justin Vreeland 794d92
#
Justin Vreeland 794d92
%changelog
Justin Vreeland 735474
* Fri Apr 23 2021 Justin Vreeland <jvreeland@twitter.com> - 5.10.31-200
Justin Vreeland 735474
- Disable kabi checks
Justin Vreeland 735474
Justin Vreeland 794d92
* Thu Apr 22 2021 Justin Vreeland <jvreeland@twitter.com> - 5.10.31-200
Justin Vreeland 794d92
- add files for centos-sig-hyperscale
Justin Vreeland 794d92
- remove changelog to fix errors from mock
Justin Vreeland 794d92
Justin Vreeland 794d92
* Thu Mar 11 2021 Justin M. Forbes <jforbes@fedoraproject.org> - 5.10.23-200
Justin Vreeland 794d92
- Linux v5.10.23
Justin Vreeland 794d92
Justin Vreeland 794d92
Justin Vreeland 794d92
# The following bit is important for automation so please do not remove
Justin Vreeland 794d92
# END OF CHANGELOG
Justin Vreeland 794d92
Justin Vreeland 794d92
###
Justin Vreeland 794d92
# The following Emacs magic makes C-c C-e use UTC dates.
Justin Vreeland 794d92
# Local Variables:
Justin Vreeland 794d92
# rpm-change-log-uses-utc: t
Justin Vreeland 794d92
# End:
Justin Vreeland 794d92
###