e336be
# We have to override the new %%install behavior because, well... the kernel is special.
e336be
%global __spec_install_pre %{___build_pre}
e336be
e336be
Summary: The Linux kernel
e336be
e336be
# For a stable, released kernel, released_kernel should be 1. For rawhide
e336be
# and/or a kernel built from an rc or git snapshot, released_kernel should
e336be
# be 0.
e336be
%global released_kernel 1
e336be
e336be
# Sign modules on x86.  Make sure the config files match this setting if more
e336be
# architectures are added.
e336be
%ifarch %{ix86} x86_64
e336be
%global signkernel 1
e336be
%global signmodules 1
e336be
%global zipmodules 1
e336be
%else
e336be
%global signkernel 0
e336be
%global signmodules 1
e336be
%global zipmodules 1
e336be
%endif
e336be
e336be
%if %{zipmodules}
e336be
%global zipsed -e 's/\.ko$/\.ko.xz/'
e336be
%endif
e336be
e336be
# define buildid .local
e336be
e336be
# baserelease defines which build revision of this kernel version we're
e336be
# building.  We used to call this fedora_build, but the magical name
e336be
# baserelease is matched by the rpmdev-bumpspec tool, which you should use.
e336be
#
e336be
# We used to have some extra magic weirdness to bump this automatically,
e336be
# but now we don't.  Just use: rpmdev-bumpspec -c 'comment for changelog'
e336be
# When changing base_sublevel below or going from rc to a final kernel,
e336be
# reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec).
e336be
# scripts/rebase.sh should be made to do that for you, actually.
e336be
#
e336be
# NOTE: baserelease must be > 0 or bad things will happen if you switch
e336be
#       to a released kernel (released version will be < rc version)
e336be
#
e336be
# For non-released -rc kernels, this will be appended after the rcX and
e336be
# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
e336be
#
11f5cb
%global baserelease 300
e336be
%global fedora_build %{baserelease}
e336be
e336be
# base_sublevel is the kernel version we're starting with and patching
e336be
# on top of -- for example, 3.1-rc7-git1 starts with a 3.0 base,
e336be
# which yields a base_sublevel of 0.
e336be
%define base_sublevel 19
e336be
e336be
## If this is a released kernel ##
e336be
%if 0%{?released_kernel}
e336be
e336be
# Do we have a -stable update to apply?
Pablo Greco ee32db
%define stable_update 113
e336be
# Set rpm version accordingly
e336be
%if 0%{?stable_update}
e336be
%define stablerev %{stable_update}
e336be
%define stable_base %{stable_update}
e336be
%endif
e336be
%define rpmversion 4.%{base_sublevel}.%{stable_update}
e336be
e336be
## The not-released-kernel case ##
e336be
%else
e336be
# The next upstream release sublevel (base_sublevel+1)
e336be
%define upstream_sublevel %(echo $((%{base_sublevel} + 1)))
e336be
# The rc snapshot level
e336be
%global rcrev 0
e336be
# The git snapshot level
e336be
%define gitrev 0
e336be
# Set rpm version accordingly
e336be
%define rpmversion 4.%{upstream_sublevel}.0
e336be
%endif
e336be
# Nb: The above rcrev and gitrev values automagically define Patch00 and Patch01 below.
e336be
e336be
# What parts do we want to build?  We must build at least one kernel.
e336be
# These are the kernels that are built IF the architecture allows it.
e336be
# All should default to 1 (enabled) and be flipped to 0 (disabled)
e336be
# by later arch-specific checks.
e336be
e336be
# The following build options are enabled by default.
e336be
# Use either --without <opt> in your rpmbuild command or force values
e336be
# to 0 in here to disable them.
e336be
#
e336be
# standard kernel
e336be
%define with_up        %{?_without_up:        0} %{?!_without_up:        1}
e336be
# kernel PAE (only valid for i686 (PAE) and ARM (lpae))
e336be
%define with_pae       %{?_without_pae:       0} %{?!_without_pae:       1}
e336be
# kernel-debug
e336be
%define with_debug     %{?_without_debug:     0} %{?!_without_debug:     1}
e336be
# kernel-headers
e336be
%define with_headers   %{?_without_headers:   0} %{?!_without_headers:   1}
e336be
%define with_cross_headers   %{?_without_cross_headers:   0} %{?!_without_cross_headers:   1}
a63ef9
# perf
a63ef9
%define with_perf      %{?_without_perf:      0} %{?!_without_perf:      1}
a63ef9
# tools
a63ef9
%define with_tools     %{?_without_tools:     0} %{?!_without_tools:     1}
e336be
# kernel-debuginfo
e336be
%define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1}
e336be
# Want to build a the vsdo directories installed
e336be
%define with_vdso_install %{?_without_vdso_install: 0} %{?!_without_vdso_install: 1}
e336be
#
e336be
# Additional options for user-friendly one-off kernel building:
e336be
#
e336be
# Only build the base kernel (--with baseonly):
e336be
%define with_baseonly  %{?_with_baseonly:     1} %{?!_with_baseonly:     0}
e336be
# Only build the pae kernel (--with paeonly):
e336be
%define with_paeonly   %{?_with_paeonly:      1} %{?!_with_paeonly:      0}
e336be
# Only build the debug kernel (--with dbgonly):
e336be
%define with_dbgonly   %{?_with_dbgonly:      1} %{?!_with_dbgonly:      0}
e336be
#
e336be
# should we do C=1 builds with sparse
e336be
%define with_sparse    %{?_with_sparse:       1} %{?!_with_sparse:       0}
e336be
#
e336be
# Cross compile requested?
e336be
%define with_cross    %{?_with_cross:         1} %{?!_with_cross:        0}
e336be
#
e336be
# build a release kernel on rawhide
e336be
%define with_release   %{?_with_release:      1} %{?!_with_release:      0}
e336be
e336be
# verbose build, i.e. no silent rules and V=1
e336be
%define with_verbose %{?_with_verbose:        1} %{?!_with_verbose:      0}
e336be
e336be
# Set debugbuildsenabled to 1 for production (build separate debug kernels)
e336be
#  and 0 for rawhide (all kernels are debug kernels).
e336be
# See also 'make debug' and 'make release'.
e336be
%define debugbuildsenabled 1
e336be
e336be
# Kernel headers are being split out into a separate package
e336be
%if 0%{?fedora}
e336be
%define with_headers 0
e336be
%define with_cross_headers 0
e336be
%endif
e336be
e336be
%if %{with_verbose}
e336be
%define make_opts V=1
e336be
%else
e336be
%define make_opts -s
e336be
%endif
e336be
e336be
# Want to build a vanilla kernel build without any non-upstream patches?
e336be
%define with_vanilla %{?_with_vanilla: 1} %{?!_with_vanilla: 0}
e336be
e336be
# pkg_release is what we'll fill in for the rpm Release: field
e336be
%if 0%{?released_kernel}
e336be
e336be
%define pkg_release %{fedora_build}%{?buildid}%{?dist}
e336be
e336be
%else
e336be
e336be
# non-released_kernel
e336be
%if 0%{?rcrev}
e336be
%define rctag .rc%rcrev
e336be
%else
e336be
%define rctag .rc0
e336be
%endif
e336be
%if 0%{?gitrev}
e336be
%define gittag .git%gitrev
e336be
%else
e336be
%define gittag .git0
e336be
%endif
e336be
%define pkg_release 0%{?rctag}%{?gittag}.%{fedora_build}%{?buildid}%{?dist}
e336be
e336be
%endif
e336be
e336be
# The kernel tarball/base version
e336be
%define kversion 4.%{base_sublevel}
e336be
e336be
%define make_target bzImage
e336be
%define image_install_path boot
e336be
e336be
%define KVERREL %{version}-%{release}.%{_target_cpu}
e336be
%define hdrarch %_target_cpu
e336be
%define asmarch %_target_cpu
e336be
e336be
%if 0%{!?nopatches:1}
e336be
%define nopatches 0
e336be
%endif
e336be
e336be
%if %{with_vanilla}
e336be
%define nopatches 1
e336be
%endif
e336be
e336be
%if %{nopatches}
e336be
%define variant -vanilla
e336be
%endif
e336be
e336be
%if !%{debugbuildsenabled}
e336be
%define with_debug 0
e336be
%endif
e336be
e336be
%if !%{with_debuginfo}
e336be
%define _enable_debug_packages 0
e336be
%endif
e336be
%define debuginfodir /usr/lib/debug
e336be
# Needed because we override almost everything involving build-ids
e336be
# and debuginfo generation. Currently we rely on the old alldebug setting.
e336be
%global _build_id_links alldebug
e336be
e336be
# kernel PAE is only built on ARMv7 in rawhide.
e336be
# Fedora 27 and earlier still support PAE, so change this on rebases.
e336be
# %ifnarch i686 armv7hl
e336be
%ifnarch armv7hl
e336be
%define with_pae 0
e336be
%endif
e336be
e336be
# if requested, only build base kernel
e336be
%if %{with_baseonly}
e336be
%define with_pae 0
e336be
%define with_debug 0
e336be
%endif
e336be
e336be
# if requested, only build pae kernel
e336be
%if %{with_paeonly}
e336be
%define with_up 0
e336be
%define with_debug 0
e336be
%endif
e336be
e336be
# if requested, only build debug kernel
e336be
%if %{with_dbgonly}
e336be
%if %{debugbuildsenabled}
e336be
%define with_up 0
e336be
%define with_pae 0
e336be
%endif
e336be
%define with_pae 0
a63ef9
%define with_tools 0
a63ef9
%define with_perf 0
e336be
%endif
e336be
e336be
%define all_x86 i386 i686
e336be
e336be
%if %{with_vdso_install}
e336be
%define use_vdso 1
e336be
%endif
e336be
e336be
# Overrides for generic default options
e336be
e336be
# don't do debug builds on anything but i686 and x86_64
e336be
%ifnarch i686 x86_64
e336be
%define with_debug 0
e336be
%endif
e336be
e336be
# don't build noarch kernels or headers (duh)
e336be
%ifarch noarch
e336be
%define with_up 0
e336be
%define with_headers 0
e336be
%define with_cross_headers 0
a63ef9
%define with_tools 0
a63ef9
%define with_perf 0
e336be
%define all_arch_configs kernel-%{version}-*.config
e336be
%endif
e336be
e336be
# sparse blows up on ppc
e336be
%ifnarch %{power64}
e336be
%define with_sparse 0
e336be
%endif
e336be
e336be
# Per-arch tweaks
e336be
e336be
%ifarch %{all_x86}
e336be
%define asmarch x86
e336be
%define hdrarch i386
e336be
%define pae PAE
e336be
%define all_arch_configs kernel-%{version}-i?86*.config
e336be
%define kernel_image arch/x86/boot/bzImage
e336be
%endif
e336be
e336be
%ifarch x86_64
e336be
%define asmarch x86
e336be
%define all_arch_configs kernel-%{version}-x86_64*.config
e336be
%define kernel_image arch/x86/boot/bzImage
e336be
%endif
e336be
e336be
%ifarch %{power64}
e336be
%define asmarch powerpc
e336be
%define hdrarch powerpc
e336be
%define make_target vmlinux
e336be
%define kernel_image vmlinux
e336be
%define kernel_image_elf 1
e336be
%ifarch ppc64le
e336be
%define all_arch_configs kernel-%{version}-ppc64le*.config
e336be
%endif
e336be
%endif
e336be
e336be
%ifarch s390x
e336be
%define asmarch s390
e336be
%define hdrarch s390
e336be
%define all_arch_configs kernel-%{version}-s390x.config
e336be
%define kernel_image arch/s390/boot/bzImage
e336be
%endif
e336be
e336be
%ifarch %{arm}
e336be
%define all_arch_configs kernel-%{version}-arm*.config
e336be
%define skip_nonpae_vdso 1
e336be
%define asmarch arm
e336be
%define hdrarch arm
e336be
%define pae lpae
e336be
%define make_target bzImage
e336be
%define kernel_image arch/arm/boot/zImage
e336be
# http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/091404.html
e336be
%define kernel_mflags KALLSYMS_EXTRA_PASS=1
e336be
# we only build headers/perf/tools on the base arm arches
e336be
# just like we used to only build them on i386 for x86
e336be
%ifnarch armv7hl
e336be
%define with_headers 0
e336be
%define with_cross_headers 0
a63ef9
%define with_perf 0
a63ef9
%define with_tools 0
e336be
%endif
e336be
%endif
e336be
e336be
%ifarch aarch64
e336be
%define all_arch_configs kernel-%{version}-aarch64*.config
e336be
%define asmarch arm64
e336be
%define hdrarch arm64
e336be
%define make_target Image.gz
e336be
%define kernel_image arch/arm64/boot/Image.gz
e336be
%endif
e336be
e336be
# Should make listnewconfig fail if there's config options
e336be
# printed out?
e336be
%if %{nopatches}
e336be
%define listnewconfig_fail 0
e336be
%define configmismatch_fail 0
e336be
%else
e336be
%define listnewconfig_fail 1
e336be
%define configmismatch_fail 1
e336be
%endif
e336be
e336be
# To temporarily exclude an architecture from being built, add it to
e336be
# %%nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we
e336be
# don't build kernel-headers then the new build system will no longer let
e336be
# us use the previous build of that package -- it'll just be completely AWOL.
e336be
# Which is a BadThing(tm).
e336be
e336be
# We only build kernel-headers on the following...
e336be
%define nobuildarches i386
e336be
e336be
%ifarch %nobuildarches
e336be
%define with_up 0
e336be
%define with_pae 0
e336be
%define with_debuginfo 0
e336be
%define with_debug 0
a63ef9
%define with_perf 0
a63ef9
%define with_tools 0
e336be
%define _enable_debug_packages 0
e336be
%endif
e336be
e336be
%define with_pae_debug 0
e336be
%if %{with_pae}
e336be
%define with_pae_debug %{with_debug}
e336be
%endif
e336be
e336be
# Architectures we build tools/cpupower on
e336be
%define cpupowerarchs %{ix86} x86_64 %{power64} %{arm} aarch64
e336be
e336be
%if %{use_vdso}
e336be
e336be
%if 0%{?skip_nonpae_vdso}
e336be
%define _use_vdso 0
e336be
%else
e336be
%define _use_vdso 1
e336be
%endif
e336be
e336be
%else
e336be
%define _use_vdso 0
e336be
%endif
e336be
8c7c00
%if 0%{?rhel} >= 8
8c7c00
%define python_name python3
8c7c00
%define python_selected %{__python3}
8c7c00
%else
8c7c00
%define python_name python
8c7c00
%define python_selected %{__python}
8c7c00
%endif
e336be
e336be
#
e336be
# Packages that need to be installed before the kernel is, because the %%post
e336be
# scripts use them.
e336be
#
e336be
%define kernel_prereq  coreutils, systemd >= 203-2, /usr/bin/kernel-install
e336be
%define initrd_prereq  dracut >= 027
e336be
e336be
e336be
Name: kernel%{?variant}
e336be
License: GPLv2 and Redistributable, no modification permitted
e336be
URL: https://www.kernel.org/
e336be
Version: %{rpmversion}
e336be
Release: %{pkg_release}
e336be
# DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD.
e336be
# SET %%nobuildarches (ABOVE) INSTEAD
e336be
ExclusiveArch: %{all_x86} x86_64 s390x %{arm} aarch64 ppc64le
e336be
ExclusiveOS: Linux
e336be
%ifnarch %{nobuildarches}
e336be
Requires: kernel-core-uname-r = %{KVERREL}%{?variant}
e336be
Requires: kernel-modules-uname-r = %{KVERREL}%{?variant}
e336be
%endif
e336be
e336be
Conflicts: xorg-x11-drv-vmmouse < 14.0.0
e336be
e336be
#
e336be
# List the packages used during the kernel build
e336be
#
e336be
BuildRequires: kmod, patch, bash, tar, git-core
e336be
BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk
e336be
BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc, bison, flex
e336be
BuildRequires: net-tools, hostname, bc, elfutils-devel
e336be
%if %{with_sparse}
e336be
BuildRequires: sparse
e336be
%endif
a63ef9
%if %{with_perf}
8c7c00
BuildRequires: zlib-devel binutils-devel newt-devel perl(ExtUtils::Embed) bison flex xz-devel
8c7c00
%if 0%{?rhel} >= 8
8c7c00
BuildRequires: python3-devel python3-docutils
8c7c00
# Used to mangle unversioned shebangs to be Python 3
8c7c00
BuildRequires: /usr/bin/pathfix.py
8c7c00
%else
8c7c00
BuildRequires: python-devel
8c7c00
%endif
a63ef9
BuildRequires: audit-libs-devel
a63ef9
BuildRequires: asciidoc xmlto
a63ef9
%ifnarch s390x %{arm}
a63ef9
BuildRequires: numactl-devel
a63ef9
%endif
a63ef9
%endif
a63ef9
%if %{with_tools}
a63ef9
BuildRequires: pciutils-devel gettext ncurses-devel
a63ef9
%endif
e336be
BuildConflicts: rhbuildsys(DiskFree) < 500Mb
e336be
%if %{with_debuginfo}
e336be
BuildRequires: rpm-build, elfutils
e336be
BuildConflicts: rpm < 4.13.0.1-19
e336be
# Most of these should be enabled after more investigation
e336be
%undefine _include_minidebuginfo
e336be
%undefine _find_debuginfo_dwz_opts
e336be
%undefine _unique_build_ids
e336be
%undefine _unique_debug_names
e336be
%undefine _unique_debug_srcs
e336be
%undefine _debugsource_packages
e336be
%undefine _debuginfo_subpackages
e336be
%undefine _include_gdb_index
e336be
%global _find_debuginfo_opts -r
e336be
%global _missing_build_ids_terminate_build 1
e336be
%global _no_recompute_build_ids 1
e336be
%endif
e336be
e336be
%if %{signkernel}%{signmodules}
e336be
BuildRequires: openssl openssl-devel
e336be
%if %{signkernel}
e336be
BuildRequires: pesign >= 0.10-4
e336be
%endif
e336be
%endif
e336be
e336be
%if %{with_cross}
e336be
BuildRequires: binutils-%{_build_arch}-linux-gnu, gcc-%{_build_arch}-linux-gnu
e336be
%define cross_opts CROSS_COMPILE=%{_build_arch}-linux-gnu-
e336be
%endif
e336be
e336be
Source0: https://www.kernel.org/pub/linux/kernel/v4.x/linux-%{kversion}.tar.xz
e336be
e336be
Source11: x509.genkey
e336be
Source12: remove-binary-diff.pl
e336be
Source15: merge.pl
e336be
Source16: mod-extra.list
e336be
Source17: mod-extra.sh
e336be
Source18: mod-sign.sh
e336be
Source90: filter-x86_64.sh
e336be
Source91: filter-armv7hl.sh
e336be
Source92: filter-i686.sh
e336be
Source93: filter-aarch64.sh
e336be
Source94: filter-ppc64le.sh
e336be
Source95: filter-s390x.sh
e336be
Source99: filter-modules.sh
e336be
%define modsign_cmd %{SOURCE18}
e336be
e336be
Source20: kernel-aarch64.config
e336be
Source21: kernel-aarch64-debug.config
e336be
Source22: kernel-armv7hl.config
e336be
Source23: kernel-armv7hl-debug.config
e336be
Source24: kernel-armv7hl-lpae.config
e336be
Source25: kernel-armv7hl-lpae-debug.config
e336be
Source26: kernel-i686.config
e336be
Source27: kernel-i686-debug.config
e336be
Source30: kernel-ppc64le.config
e336be
Source31: kernel-ppc64le-debug.config
e336be
Source32: kernel-s390x.config
e336be
Source33: kernel-s390x-debug.config
e336be
Source34: kernel-x86_64.config
e336be
Source35: kernel-x86_64-debug.config
e336be
e336be
Source40: generate_all_configs.sh
e336be
Source41: generate_debug_configs.sh
e336be
e336be
Source42: process_configs.sh
e336be
Source43: generate_bls_conf.sh
e336be
e336be
# This file is intentionally left empty in the stock kernel. Its a nicety
e336be
# added for those wanting to do custom rebuilds with altered config opts.
e336be
Source1000: kernel-local
e336be
e336be
# Sources for kernel-tools
e336be
Source2000: cpupower.service
e336be
Source2001: cpupower.config
e336be
e336be
# Here should be only the patches up to the upstream canonical Linus tree.
e336be
e336be
# For a stable release kernel
e336be
%if 0%{?stable_update}
e336be
%if 0%{?stable_base}
e336be
%define    stable_patch_00  patch-4.%{base_sublevel}.%{stable_base}.xz
e336be
Source5000: %{stable_patch_00}
e336be
%endif
e336be
e336be
# non-released_kernel case
e336be
# These are automagically defined by the rcrev and gitrev values set up
e336be
# near the top of this spec file.
e336be
%else
e336be
%if 0%{?rcrev}
e336be
Source5000: patch-4.%{upstream_sublevel}-rc%{rcrev}.xz
e336be
%if 0%{?gitrev}
e336be
Source5001: patch-4.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}.xz
e336be
%endif
e336be
%else
e336be
# pre-{base_sublevel+1}-rc1 case
e336be
%if 0%{?gitrev}
e336be
Source5000: patch-4.%{base_sublevel}-git%{gitrev}.xz
e336be
%endif
e336be
%endif
e336be
%endif
e336be
e336be
## Patches needed for building this package
e336be
e336be
## compile fixes
e336be
e336be
# ongoing complaint, full discussion delayed until ksummit/plumbers
e336be
Patch002: 0001-iio-Use-event-header-from-kernel-tree.patch
e336be
e336be
%if !%{nopatches}
e336be
e336be
# Git trees.
e336be
e336be
# Standalone patches
e336be
# 100 - Generic long running patches
e336be
e336be
Patch110: lib-cpumask-Make-CPUMASK_OFFSTACK-usable-without-deb.patch
e336be
e336be
Patch111: input-kill-stupid-messages.patch
e336be
e336be
Patch112: die-floppy-die.patch
e336be
e336be
Patch113: no-pcspkr-modalias.patch
e336be
e336be
Patch114: silence-fbcon-logo.patch
e336be
e336be
Patch115: Kbuild-Add-an-option-to-enable-GCC-VTA.patch
e336be
e336be
Patch116: crash-driver.patch
e336be
e336be
Patch117: lis3-improve-handling-of-null-rate.patch
e336be
e336be
Patch118: scsi-sd_revalidate_disk-prevent-NULL-ptr-deref.patch
e336be
e336be
Patch119: namespaces-no-expert.patch
e336be
e336be
Patch120: ath9k-rx-dma-stop-check.patch
e336be
e336be
Patch122: Input-synaptics-pin-3-touches-when-the-firmware-repo.patch
e336be
e336be
# This no longer applies, let's see if it needs to be updated
e336be
# Patch123: firmware-Drop-WARN-from-usermodehelper_read_trylock-.patch
e336be
e336be
# 200 - x86 / secureboot
e336be
e336be
Patch201: efi-lockdown.patch
e336be
e336be
Patch202: KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch
e336be
e336be
Patch203: Add-EFI-signature-data-types.patch
e336be
e336be
Patch204: Add-an-EFI-signature-blob-parser-and-key-loader.patch
e336be
e336be
Patch205: MODSIGN-Import-certificates-from-UEFI-Secure-Boot.patch
e336be
e336be
Patch206: MODSIGN-Support-not-importing-certs-from-db.patch
e336be
e336be
# bz 1497559 - Make kernel MODSIGN code not error on missing variables
e336be
Patch207: 0001-Make-get_cert_list-not-complain-about-cert-lists-tha.patch
e336be
Patch208: 0002-Add-efi_status_to_str-and-rework-efi_status_to_err.patch
e336be
Patch209: 0003-Make-get_cert_list-use-efi_status_to_str-to-print-er.patch
e336be
e336be
Patch210: disable-i8042-check-on-apple-mac.patch
e336be
e336be
Patch211: drm-i915-hush-check-crtc-state.patch
e336be
e336be
Patch212: efi-secureboot.patch
e336be
e336be
# 300 - ARM patches
e336be
Patch300: arm64-Add-option-of-13-for-FORCE_MAX_ZONEORDER.patch
e336be
e336be
# http://www.spinics.net/lists/linux-tegra/msg26029.html
e336be
Patch301: usb-phy-tegra-Add-38.4MHz-clock-table-entry.patch
e336be
# http://patchwork.ozlabs.org/patch/587554/
e336be
Patch302: ARM-tegra-usb-no-reset.patch
e336be
e336be
# https://patchwork.kernel.org/patch/10351797/
e336be
Patch303: ACPI-scan-Fix-regression-related-to-X-Gene-UARTs.patch
e336be
# rhbz 1574718
e336be
Patch304: ACPI-irq-Workaround-firmware-issue-on-X-Gene-based-m400.patch
e336be
e336be
# https://patchwork.kernel.org/patch/9820417/
e336be
Patch305: qcom-msm89xx-fixes.patch
e336be
e336be
# https://patchwork.kernel.org/project/linux-mmc/list/?submitter=71861
e336be
Patch306: arm-sdhci-esdhc-imx-fixes.patch
e336be
e336be
# https://www.spinics.net/lists/arm-kernel/msg670137.html
e336be
Patch307: arm64-ZynqMP-firmware-clock-drivers-core.patch
e336be
e336be
Patch308: arm64-96boards-Rock960-CE-board-support.patch
e336be
Patch309: arm64-rockchip-add-initial-Rockpro64.patch
e336be
Patch310: arm64-rk3399-add-idle-states.patch
e336be
e336be
Patch330: bcm2835-cpufreq-add-CPU-frequency-control-driver.patch
e336be
e336be
# From 4.20, fix eth link/act lights on 3B+
e336be
Patch334: bcm2837-fix-eth-leds.patch
e336be
e336be
# Patches enabling device specific brcm firmware nvram
e336be
# https://www.spinics.net/lists/linux-wireless/msg178827.html
e336be
Patch340: brcmfmac-Remove-firmware-loading-code-duplication.patch
e336be
e336be
# 400 - IBM (ppc/s390x) patches
e336be
e336be
# 500 - Temp fixes/CVEs etc
e336be
e336be
# rhbz 1476467
e336be
Patch501: Fix-for-module-sig-verification.patch
e336be
e336be
# rhbz 1431375
e336be
Patch502: input-rmi4-remove-the-need-for-artifical-IRQ.patch
e336be
e336be
# Ena fixes from 4.20
e336be
Patch503: ena-fixes.patch
e336be
e336be
# Patches from 4.20 fixing black screen on CHT devices with i915.fastboot=1
e336be
Patch508: cherrytrail-pwm-lpss-fixes.patch
e336be
e336be
# rhbz 1526312 (accelerometer part of the bug), patches pending upstream
e336be
Patch510: iio-accel-kxcjk1013-Add-more-hardware-ids.patch
e336be
e336be
# rhbz 1645070 patch queued upstream for merging into 4.21
e336be
Patch516: asus-fx503-keyb.patch
e336be
e336be
# rhbz 1661961 patch merged upstream in 4.20
e336be
Patch517: 0001-Bluetooth-btsdio-Do-not-bind-to-non-removable-BCM434.patch
e336be
e336be
##centos
e336be
Patch10002: 9999-centos-a83t-hdmi.patch
e336be
Patch11002: 9999-centos-r40sata.patch
917372
Patch11003: 9999-centos-r40-v40-dts-update.patch
Pablo Greco f2aff3
Patch11004: v3-drivers-ata-ahci_sunxi-Increased-SATA-AHCI-DMA-TX-RX-FIFOs.patch
e336be
##end centos
e336be
e336be
# END OF PATCH DEFINITIONS
e336be
e336be
%endif
e336be
e336be
e336be
%description
e336be
The kernel meta package
e336be
e336be
#
e336be
# This macro does requires, provides, conflicts, obsoletes for a kernel package.
e336be
#	%%kernel_reqprovconf <subpackage>
e336be
# It uses any kernel_<subpackage>_conflicts and kernel_<subpackage>_obsoletes
e336be
# macros defined above.
e336be
#
e336be
%define kernel_reqprovconf \
e336be
Provides: kernel = %{rpmversion}-%{pkg_release}\
e336be
Provides: kernel-%{_target_cpu} = %{rpmversion}-%{pkg_release}%{?1:+%{1}}\
e336be
Provides: kernel-drm-nouveau = 16\
e336be
Provides: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
e336be
Requires(pre): %{kernel_prereq}\
e336be
Requires(pre): %{initrd_prereq}\
e336be
Requires(pre): linux-firmware >= 20150904-56.git6ebf5d57\
e336be
Requires(preun): systemd >= 200\
e336be
Conflicts: xfsprogs < 4.3.0-1\
e336be
Conflicts: xorg-x11-drv-vmmouse < 13.0.99\
e336be
%{expand:%%{?kernel%{?1:_%{1}}_conflicts:Conflicts: %%{kernel%{?1:_%{1}}_conflicts}}}\
e336be
%{expand:%%{?kernel%{?1:_%{1}}_obsoletes:Obsoletes: %%{kernel%{?1:_%{1}}_obsoletes}}}\
e336be
%{expand:%%{?kernel%{?1:_%{1}}_provides:Provides: %%{kernel%{?1:_%{1}}_provides}}}\
e336be
# We can't let RPM do the dependencies automatic because it'll then pick up\
e336be
# a correct but undesirable perl dependency from the module headers which\
e336be
# isn't required for the kernel proper to function\
e336be
AutoReq: no\
e336be
AutoProv: yes\
e336be
%{nil}
e336be
e336be
%package headers
e336be
Summary: Header files for the Linux kernel for use by glibc
e336be
Obsoletes: glibc-kernheaders < 3.0-46
e336be
Provides: glibc-kernheaders = 3.0-46
e336be
%if "0%{?variant}"
e336be
Obsoletes: kernel-headers < %{rpmversion}-%{pkg_release}
e336be
Provides: kernel-headers = %{rpmversion}-%{pkg_release}
e336be
%endif
e336be
%description headers
e336be
Kernel-headers includes the C header files that specify the interface
e336be
between the Linux kernel and userspace libraries and programs.  The
e336be
header files define structures and constants that are needed for
e336be
building most standard programs and are also needed for rebuilding the
e336be
glibc package.
e336be
e336be
%package cross-headers
e336be
Summary: Header files for the Linux kernel for use by cross-glibc
e336be
%description cross-headers
e336be
Kernel-cross-headers includes the C header files that specify the interface
e336be
between the Linux kernel and userspace libraries and programs.  The
e336be
header files define structures and constants that are needed for
e336be
building most standard programs and are also needed for rebuilding the
e336be
cross-glibc package.
e336be
e336be
e336be
%package debuginfo-common-%{_target_cpu}
e336be
Summary: Kernel source files used by %{name}-debuginfo packages
e336be
Provides: installonlypkg(kernel)
e336be
%description debuginfo-common-%{_target_cpu}
e336be
This package is required by %{name}-debuginfo subpackages.
e336be
It provides the kernel source files common to all builds.
e336be
a63ef9
%if %{with_perf}
a63ef9
%package -n perf
a63ef9
Summary: Performance monitoring for the Linux kernel
a63ef9
License: GPLv2
a63ef9
%description -n perf
a63ef9
This package contains the perf tool, which enables performance monitoring
a63ef9
of the Linux kernel.
a63ef9
a63ef9
%package -n perf-debuginfo
a63ef9
Summary: Debug information for package perf
a63ef9
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
a63ef9
AutoReqProv: no
a63ef9
%description -n perf-debuginfo
a63ef9
This package provides debug information for the perf package.
a63ef9
a63ef9
# Note that this pattern only works right to match the .build-id
a63ef9
# symlinks because of the trailing nonmatching alternation and
a63ef9
# the leading .*, because of find-debuginfo.sh's buggy handling
a63ef9
# of matching the pattern against the symlinks file.
a63ef9
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|.*%%{_libdir}/traceevent/plugins/.*|XXX' -o perf-debuginfo.list}
a63ef9
8c7c00
%package -n %{python_name}-perf
a63ef9
Summary: Python bindings for apps which will manipulate perf events
8c7c00
%description -n %{python_name}-perf
8c7c00
The %{python_name}-perf package contains a module that permits applications
a63ef9
written in the Python programming language to use the interface
a63ef9
to manipulate perf events.
a63ef9
8c7c00
%if 0%{?rhel} >= 8
8c7c00
%global python_sitearch %{python3_sitearch}
8c7c00
%else
a63ef9
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
8c7c00
%endif
a63ef9
8c7c00
%if 0%{?rhel} < 8
8c7c00
%package -n %{python_name}-perf-debuginfo
a63ef9
Summary: Debug information for package perf python bindings
a63ef9
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
a63ef9
AutoReqProv: no
8c7c00
%description -n %{python_name}-perf-debuginfo
a63ef9
This package provides debug information for the perf python bindings.
a63ef9
a63ef9
# the python_sitearch macro should already be defined from above
8c7c00
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{python_sitearch}/perf.so(\.debug)?|XXX' -o %%{python_name}-perf-debuginfo.list}
8c7c00
%endif
a63ef9
a63ef9
%endif # with_perf
a63ef9
a63ef9
%if %{with_tools}
a63ef9
%package -n kernel-tools
a63ef9
Summary: Assortment of tools for the Linux kernel
a63ef9
License: GPLv2
a63ef9
Provides:  cpupowerutils = 1:009-0.6.p1
a63ef9
Obsoletes: cpupowerutils < 1:009-0.6.p1
a63ef9
Provides:  cpufreq-utils = 1:009-0.6.p1
a63ef9
Provides:  cpufrequtils = 1:009-0.6.p1
a63ef9
Obsoletes: cpufreq-utils < 1:009-0.6.p1
a63ef9
Obsoletes: cpufrequtils < 1:009-0.6.p1
a63ef9
Obsoletes: cpuspeed < 1:1.5-16
a63ef9
Requires: kernel-tools-libs = %{version}-%{release}
a63ef9
%define __requires_exclude ^%{_bindir}/python
a63ef9
%description -n kernel-tools
a63ef9
This package contains the tools/ directory from the kernel source
a63ef9
and the supporting documentation.
a63ef9
a63ef9
%package -n kernel-tools-libs
a63ef9
Summary: Libraries for the kernels-tools
a63ef9
License: GPLv2
a63ef9
%description -n kernel-tools-libs
a63ef9
This package contains the libraries built from the tools/ directory
a63ef9
from the kernel source.
a63ef9
a63ef9
%package -n kernel-tools-libs-devel
a63ef9
Summary: Assortment of tools for the Linux kernel
a63ef9
License: GPLv2
a63ef9
Requires: kernel-tools = %{version}-%{release}
a63ef9
Provides:  cpupowerutils-devel = 1:009-0.6.p1
a63ef9
Obsoletes: cpupowerutils-devel < 1:009-0.6.p1
a63ef9
Requires: kernel-tools-libs = %{version}-%{release}
a63ef9
Provides: kernel-tools-devel
a63ef9
%description -n kernel-tools-libs-devel
a63ef9
This package contains the development files for the tools/ directory from
a63ef9
the kernel source.
a63ef9
a63ef9
%package -n kernel-tools-debuginfo
a63ef9
Summary: Debug information for package kernel-tools
a63ef9
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
a63ef9
AutoReqProv: no
a63ef9
%description -n kernel-tools-debuginfo
a63ef9
This package provides debug information for package kernel-tools.
a63ef9
a63ef9
# Note that this pattern only works right to match the .build-id
a63ef9
# symlinks because of the trailing nonmatching alternation and
a63ef9
# the leading .*, because of find-debuginfo.sh's buggy handling
a63ef9
# of matching the pattern against the symlinks file.
a63ef9
%{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}
a63ef9
a63ef9
%endif # with_tools
a63ef9
a63ef9
e336be
#
e336be
# This macro creates a kernel-<subpackage>-debuginfo package.
e336be
#	%%kernel_debuginfo_package <subpackage>
e336be
#
e336be
%define kernel_debuginfo_package() \
e336be
%package %{?1:%{1}-}debuginfo\
e336be
Summary: Debug information for package %{name}%{?1:-%{1}}\
e336be
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}\
e336be
Provides: %{name}%{?1:-%{1}}-debuginfo-%{_target_cpu} = %{version}-%{release}\
e336be
Provides: installonlypkg(kernel)\
e336be
AutoReqProv: no\
e336be
%description %{?1:%{1}-}debuginfo\
e336be
This package provides debug information for package %{name}%{?1:-%{1}}.\
e336be
This is required to use SystemTap with %{name}%{?1:-%{1}}-%{KVERREL}.\
e336be
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '/.*/%%{KVERREL}%{?1:[+]%{1}}/.*|/.*%%{KVERREL}%{?1:\+%{1}}(\.debug)?' -o debuginfo%{?1}.list}\
e336be
%{nil}
e336be
e336be
#
e336be
# This macro creates a kernel-<subpackage>-devel package.
e336be
#	%%kernel_devel_package <subpackage> <pretty-name>
e336be
#
e336be
%define kernel_devel_package() \
e336be
%package %{?1:%{1}-}devel\
e336be
Summary: Development package for building kernel modules to match the %{?2:%{2} }kernel\
e336be
Provides: kernel%{?1:-%{1}}-devel-%{_target_cpu} = %{version}-%{release}\
e336be
Provides: kernel-devel-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
e336be
Provides: kernel-devel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
e336be
Provides: installonlypkg(kernel)\
e336be
AutoReqProv: no\
e336be
Requires(pre): findutils\
e336be
Requires: findutils\
e336be
Requires: perl-interpreter\
e336be
%description %{?1:%{1}-}devel\
e336be
This package provides kernel headers and makefiles sufficient to build modules\
e336be
against the %{?2:%{2} }kernel package.\
e336be
%{nil}
e336be
e336be
#
e336be
# This macro creates a kernel-<subpackage>-modules-extra package.
e336be
#	%%kernel_modules_extra_package <subpackage> <pretty-name>
e336be
#
e336be
%define kernel_modules_extra_package() \
e336be
%package %{?1:%{1}-}modules-extra\
e336be
Summary: Extra kernel modules to match the %{?2:%{2} }kernel\
e336be
Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}\
e336be
Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
e336be
Provides: kernel%{?1:-%{1}}-modules-extra = %{version}-%{release}%{?1:+%{1}}\
e336be
Provides: installonlypkg(kernel-module)\
e336be
Provides: kernel%{?1:-%{1}}-modules-extra-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
e336be
Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
e336be
Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
e336be
AutoReq: no\
e336be
AutoProv: yes\
e336be
%description %{?1:%{1}-}modules-extra\
e336be
This package provides less commonly used kernel modules for the %{?2:%{2} }kernel package.\
e336be
%{nil}
e336be
e336be
#
e336be
# This macro creates a kernel-<subpackage>-modules package.
e336be
#	%%kernel_modules_package <subpackage> <pretty-name>
e336be
#
e336be
%define kernel_modules_package() \
e336be
%package %{?1:%{1}-}modules\
e336be
Summary: kernel modules to match the %{?2:%{2}-}core kernel\
e336be
Provides: kernel%{?1:-%{1}}-modules-%{_target_cpu} = %{version}-%{release}\
e336be
Provides: kernel-modules-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
e336be
Provides: kernel-modules = %{version}-%{release}%{?1:+%{1}}\
e336be
Provides: installonlypkg(kernel-module)\
e336be
Provides: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
e336be
Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
e336be
AutoReq: no\
e336be
AutoProv: yes\
e336be
%description %{?1:%{1}-}modules\
e336be
This package provides commonly used kernel modules for the %{?2:%{2}-}core kernel package.\
e336be
%{nil}
e336be
e336be
#
e336be
# this macro creates a kernel-<subpackage> meta package.
e336be
#	%%kernel_meta_package <subpackage>
e336be
#
e336be
%define kernel_meta_package() \
e336be
%package %{1}\
e336be
summary: kernel meta-package for the %{1} kernel\
e336be
Requires: kernel-%{1}-core-uname-r = %{KVERREL}%{?variant}+%{1}\
e336be
Requires: kernel-%{1}-modules-uname-r = %{KVERREL}%{?variant}+%{1}\
e336be
Provides: installonlypkg(kernel)\
e336be
%description %{1}\
e336be
The meta-package for the %{1} kernel\
e336be
%{nil}
e336be
e336be
#
e336be
# This macro creates a kernel-<subpackage> and its -devel and -debuginfo too.
e336be
#	%%define variant_summary The Linux kernel compiled for <configuration>
e336be
#	%%kernel_variant_package [-n <pretty-name>] <subpackage>
e336be
#
e336be
%define kernel_variant_package(n:) \
e336be
%package %{?1:%{1}-}core\
e336be
Summary: %{variant_summary}\
e336be
Provides: kernel-%{?1:%{1}-}core-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
e336be
Provides: installonlypkg(kernel)\
e336be
%ifarch %{power64}\
e336be
Obsoletes: kernel-bootwrapper\
e336be
%endif\
e336be
%{expand:%%kernel_reqprovconf}\
e336be
%if %{?1:1} %{!?1:0} \
e336be
%{expand:%%kernel_meta_package %{?1:%{1}}}\
e336be
%endif\
e336be
%{expand:%%kernel_devel_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
e336be
%{expand:%%kernel_modules_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
e336be
%{expand:%%kernel_modules_extra_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
e336be
%{expand:%%kernel_debuginfo_package %{?1:%{1}}}\
e336be
%{nil}
e336be
e336be
# Now, each variant package.
e336be
e336be
%if %{with_pae}
e336be
%ifnarch armv7hl
e336be
%define variant_summary The Linux kernel compiled for PAE capable machines
e336be
%kernel_variant_package %{pae}
e336be
%description %{pae}-core
e336be
This package includes a version of the Linux kernel with support for up to
e336be
64GB of high memory. It requires a CPU with Physical Address Extensions (PAE).
e336be
The non-PAE kernel can only address up to 4GB of memory.
e336be
Install the kernel-PAE package if your machine has more than 4GB of memory.
e336be
%else
e336be
%define variant_summary The Linux kernel compiled for Cortex-A15
e336be
%kernel_variant_package %{pae}
e336be
%description %{pae}-core
e336be
This package includes a version of the Linux kernel with support for
e336be
Cortex-A15 devices with LPAE and HW virtualisation support
e336be
%endif
e336be
e336be
e336be
%define variant_summary The Linux kernel compiled with extra debugging enabled for PAE capable machines
e336be
%kernel_variant_package %{pae}debug
e336be
Obsoletes: kernel-PAE-debug
e336be
%description %{pae}debug-core
e336be
This package includes a version of the Linux kernel with support for up to
e336be
64GB of high memory. It requires a CPU with Physical Address Extensions (PAE).
e336be
The non-PAE kernel can only address up to 4GB of memory.
e336be
Install the kernel-PAE package if your machine has more than 4GB of memory.
e336be
e336be
This variant of the kernel has numerous debugging options enabled.
e336be
It should only be installed when trying to gather additional information
e336be
on kernel bugs, as some of these options impact performance noticably.
e336be
%endif
e336be
e336be
%define variant_summary The Linux kernel compiled with extra debugging enabled
e336be
%kernel_variant_package debug
e336be
%description debug-core
e336be
The kernel package contains the Linux kernel (vmlinuz), the core of any
e336be
Linux operating system.  The kernel handles the basic functions
e336be
of the operating system:  memory allocation, process allocation, device
e336be
input and output, etc.
e336be
e336be
This variant of the kernel has numerous debugging options enabled.
e336be
It should only be installed when trying to gather additional information
e336be
on kernel bugs, as some of these options impact performance noticably.
e336be
e336be
# And finally the main -core package
e336be
e336be
%define variant_summary The Linux kernel
e336be
%kernel_variant_package
e336be
%description core
e336be
The kernel package contains the Linux kernel (vmlinuz), the core of any
e336be
Linux operating system.  The kernel handles the basic functions
e336be
of the operating system: memory allocation, process allocation, device
e336be
input and output, etc.
e336be
e336be
e336be
%prep
e336be
# do a few sanity-checks for --with *only builds
e336be
%if %{with_baseonly}
e336be
%if !%{with_up}%{with_pae}
e336be
echo "Cannot build --with baseonly, up build is disabled"
e336be
exit 1
e336be
%endif
e336be
%endif
e336be
e336be
%if "%{baserelease}" == "0"
e336be
echo "baserelease must be greater than zero"
e336be
exit 1
e336be
%endif
e336be
e336be
# more sanity checking; do it quietly
e336be
if [ "%{patches}" != "%%{patches}" ] ; then
e336be
  for patch in %{patches} ; do
e336be
    if [ ! -f $patch ] ; then
e336be
      echo "ERROR: Patch  ${patch##/*/}  listed in specfile but is missing"
e336be
      exit 1
e336be
    fi
e336be
  done
e336be
fi 2>/dev/null
e336be
e336be
patch_command='patch -p1 -F1 -s'
e336be
ApplyPatch()
e336be
{
e336be
  local patch=$1
e336be
  shift
e336be
  if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
e336be
    exit 1
e336be
  fi
e336be
  if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME%%%%%{?variant}}.spec ; then
e336be
    if [ "${patch:0:8}" != "patch-4." ] ; then
e336be
      echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
e336be
      exit 1
e336be
    fi
e336be
  fi 2>/dev/null
e336be
  case "$patch" in
e336be
  *.bz2) bunzip2 < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
e336be
  *.gz)  gunzip  < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
e336be
  *.xz)  unxz    < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
e336be
  *) $patch_command ${1+"$@"} < "$RPM_SOURCE_DIR/$patch" ;;
e336be
  esac
e336be
}
e336be
e336be
# don't apply patch if it's empty
e336be
ApplyOptionalPatch()
e336be
{
e336be
  local patch=$1
e336be
  shift
e336be
  if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
e336be
    exit 1
e336be
  fi
e336be
  local C=$(wc -l $RPM_SOURCE_DIR/$patch | awk '{print $1}')
e336be
  if [ "$C" -gt 9 ]; then
e336be
    ApplyPatch $patch ${1+"$@"}
e336be
  fi
e336be
}
e336be
e336be
# First we unpack the kernel tarball.
e336be
# If this isn't the first make prep, we use links to the existing clean tarball
e336be
# which speeds things up quite a bit.
e336be
e336be
# Update to latest upstream.
e336be
%if 0%{?released_kernel}
e336be
%define vanillaversion 4.%{base_sublevel}
e336be
# non-released_kernel case
e336be
%else
e336be
%if 0%{?rcrev}
e336be
%define vanillaversion 4.%{upstream_sublevel}-rc%{rcrev}
e336be
%if 0%{?gitrev}
e336be
%define vanillaversion 4.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}
e336be
%endif
e336be
%else
e336be
# pre-{base_sublevel+1}-rc1 case
e336be
%if 0%{?gitrev}
e336be
%define vanillaversion 4.%{base_sublevel}-git%{gitrev}
e336be
%else
e336be
%define vanillaversion 4.%{base_sublevel}
e336be
%endif
e336be
%endif
e336be
%endif
e336be
e336be
# %%{vanillaversion} : the full version name, e.g. 2.6.35-rc6-git3
e336be
# %%{kversion}       : the base version, e.g. 2.6.34
e336be
e336be
# Use kernel-%%{kversion}%%{?dist} as the top-level directory name
e336be
# so we can prep different trees within a single git directory.
e336be
e336be
# Build a list of the other top-level kernel tree directories.
e336be
# This will be used to hardlink identical vanilla subdirs.
e336be
sharedirs=$(find "$PWD" -maxdepth 1 -type d -name 'kernel-4.*' \
e336be
            | grep -x -v "$PWD"/kernel-%{kversion}%{?dist}) ||:
e336be
e336be
# Delete all old stale trees.
e336be
if [ -d kernel-%{kversion}%{?dist} ]; then
e336be
  cd kernel-%{kversion}%{?dist}
e336be
  for i in linux-*
e336be
  do
e336be
     if [ -d $i ]; then
e336be
       # Just in case we ctrl-c'd a prep already
e336be
       rm -rf deleteme.%{_target_cpu}
e336be
       # Move away the stale away, and delete in background.
e336be
       mv $i deleteme-$i
e336be
       rm -rf deleteme* &
e336be
     fi
e336be
  done
e336be
  cd ..
e336be
fi
e336be
e336be
# Generate new tree
e336be
if [ ! -d kernel-%{kversion}%{?dist}/vanilla-%{vanillaversion} ]; then
e336be
e336be
  if [ -d kernel-%{kversion}%{?dist}/vanilla-%{kversion} ]; then
e336be
e336be
    # The base vanilla version already exists.
e336be
    cd kernel-%{kversion}%{?dist}
e336be
e336be
    # Any vanilla-* directories other than the base one are stale.
e336be
    for dir in vanilla-*; do
e336be
      [ "$dir" = vanilla-%{kversion} ] || rm -rf $dir &
e336be
    done
e336be
e336be
  else
e336be
e336be
    rm -f pax_global_header
e336be
    # Look for an identical base vanilla dir that can be hardlinked.
e336be
    for sharedir in $sharedirs ; do
e336be
      if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{kversion} ]] ; then
e336be
        break
e336be
      fi
e336be
    done
e336be
    if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{kversion} ]] ; then
e336be
%setup -q -n kernel-%{kversion}%{?dist} -c -T
e336be
      cp -al $sharedir/vanilla-%{kversion} .
e336be
    else
e336be
%setup -q -n kernel-%{kversion}%{?dist} -c
e336be
      mv linux-%{kversion} vanilla-%{kversion}
e336be
    fi
e336be
e336be
  fi
e336be
e336be
%if "%{kversion}" != "%{vanillaversion}"
e336be
e336be
  for sharedir in $sharedirs ; do
e336be
    if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{vanillaversion} ]] ; then
e336be
      break
e336be
    fi
e336be
  done
e336be
  if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{vanillaversion} ]] ; then
e336be
e336be
    cp -al $sharedir/vanilla-%{vanillaversion} .
e336be
e336be
  else
e336be
e336be
    # Need to apply patches to the base vanilla version.
e336be
    cp -al vanilla-%{kversion} vanilla-%{vanillaversion}
e336be
    cd vanilla-%{vanillaversion}
e336be
e336be
cp %{SOURCE12} .
e336be
e336be
# Update vanilla to the latest upstream.
e336be
# (non-released_kernel case only)
e336be
%if 0%{?rcrev}
e336be
    xzcat %{SOURCE5000} | ./remove-binary-diff.pl | patch -p1 -F1 -s
e336be
%if 0%{?gitrev}
e336be
    xzcat %{SOURCE5001} | ./remove-binary-diff.pl | patch -p1 -F1 -s
e336be
%endif
e336be
%else
e336be
# pre-{base_sublevel+1}-rc1 case
e336be
%if 0%{?gitrev}
e336be
    xzcat %{SOURCE5000} | ./remove-binary-diff.pl | patch -p1 -F1 -s
e336be
%endif
e336be
%endif
e336be
    git init
e336be
    git config user.email "noreply@centos.org"
e336be
    git config user.name "AltArch Kernel"
e336be
    git config gc.auto 0
e336be
    git add .
e336be
    git commit -a -q -m "baseline"
e336be
e336be
    cd ..
e336be
e336be
  fi
e336be
e336be
%endif
e336be
e336be
else
e336be
e336be
  # We already have all vanilla dirs, just change to the top-level directory.
e336be
  cd kernel-%{kversion}%{?dist}
e336be
e336be
fi
e336be
e336be
# Now build the fedora kernel tree.
e336be
cp -al vanilla-%{vanillaversion} linux-%{KVERREL}
e336be
e336be
cd linux-%{KVERREL}
e336be
if [ ! -d .git ]; then
e336be
    git init
e336be
    git config user.email "noreply@centos.org"
e336be
    git config user.name "AltArch Kernel"
e336be
    git config gc.auto 0
e336be
    git add .
e336be
    git commit -a -q -m "baseline"
e336be
fi
e336be
e336be
e336be
# released_kernel with possible stable updates
e336be
%if 0%{?stable_base}
e336be
# This is special because the kernel spec is hell and nothing is consistent
e336be
xzcat %{SOURCE5000} | patch -p1 -F1 -s
e336be
git commit -a -m "Stable update"
e336be
%endif
e336be
e336be
# Note: Even in the "nopatches" path some patches (build tweaks and compile
e336be
# fixes) will always get applied; see patch defition above for details
e336be
e336be
git am %{patches}
e336be
e336be
# END OF PATCH APPLICATIONS
e336be
e336be
# Any further pre-build tree manipulations happen here.
e336be
e336be
chmod +x scripts/checkpatch.pl
e336be
chmod +x tools/objtool/sync-check.sh
e336be
mv COPYING COPYING-%{version}
e336be
e336be
# This Prevents scripts/setlocalversion from mucking with our version numbers.
e336be
touch .scmversion
e336be
e336be
# Deal with configs stuff
e336be
mkdir configs
e336be
cd configs
e336be
e336be
# Drop some necessary files from the source dir into the buildroot
e336be
cp $RPM_SOURCE_DIR/kernel-*.config .
e336be
cp %{SOURCE1000} .
e336be
cp %{SOURCE15} .
e336be
cp %{SOURCE40} .
e336be
cp %{SOURCE41} .
e336be
cp %{SOURCE43} .
e336be
e336be
%if !%{debugbuildsenabled}
e336be
# The normal build is a really debug build and the user has explicitly requested
e336be
# a release kernel. Change the config files into non-debug versions.
e336be
%if !%{with_release}
e336be
VERSION=%{version} ./generate_debug_configs.sh
e336be
%else
e336be
VERSION=%{version} ./generate_all_configs.sh
e336be
%endif
e336be
e336be
%else
e336be
VERSION=%{version} ./generate_all_configs.sh
e336be
%endif
e336be
e336be
# Merge in any user-provided local config option changes
e336be
%ifnarch %nobuildarches
e336be
for i in %{all_arch_configs}
e336be
do
e336be
  mv $i $i.tmp
e336be
  ./merge.pl %{SOURCE1000} $i.tmp > $i
e336be
  rm $i.tmp
e336be
done
e336be
%endif
e336be
e336be
# only deal with configs if we are going to build for the arch
e336be
%ifnarch %nobuildarches
e336be
e336be
%if !%{debugbuildsenabled}
e336be
rm -f kernel-%{version}-*debug.config
e336be
%endif
e336be
e336be
%define make make %{?cross_opts}
e336be
e336be
CheckConfigs() {
e336be
     ./check_configs.awk $1 $2 > .mismatches
e336be
     if [ -s .mismatches ]
e336be
     then
e336be
	echo "Error: Mismatches found in configuration files"
e336be
	cat .mismatches
e336be
	exit 1
e336be
     fi
e336be
}
e336be
e336be
cp %{SOURCE42} .
e336be
OPTS=""
e336be
%if %{listnewconfig_fail}
e336be
	OPTS="$OPTS -n"
e336be
%endif
e336be
%if %{configmismatch_fail}
e336be
	OPTS="$OPTS -c"
e336be
%endif
e336be
./process_configs.sh $OPTS kernel %{rpmversion}
e336be
e336be
# end of kernel config
e336be
%endif
e336be
e336be
cd ..
e336be
# End of Configs stuff
e336be
e336be
# get rid of unwanted files resulting from patch fuzz
e336be
find . \( -name "*.orig" -o -name "*~" \) -delete >/dev/null
e336be
e336be
# remove unnecessary SCM files
e336be
find . -name .gitignore -delete >/dev/null
e336be
8c7c00
%if 0%{?rhel} >= 8
8c7c00
# Mangle /usr/bin/python shebangs to /usr/bin/python3
8c7c00
# Mangle all Python shebangs to be Python 3 explicitly
8c7c00
# -p preserves timestamps
8c7c00
# -n prevents creating ~backup files
8c7c00
# -i specifies the interpreter for the shebang
8c7c00
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/
8c7c00
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/diffconfig
8c7c00
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/bloat-o-meter
8c7c00
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/show_delta
8c7c00
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" tools/ tools/perf/scripts/python/*.py tools/kvm/kvm_stat/kvm_stat
8c7c00
%endif
8c7c00
e336be
cd ..
e336be
e336be
###
e336be
### build
e336be
###
e336be
%build
e336be
e336be
%if %{with_sparse}
e336be
%define sparse_mflags	C=1
e336be
%endif
e336be
e336be
cp_vmlinux()
e336be
{
e336be
  eu-strip --remove-comment -o "$2" "$1"
e336be
}
e336be
e336be
# These are for host programs that get built as part of the kernel and
e336be
# are required to be packaged in kernel-devel for building external modules.
e336be
# Since they are userspace binaries, they are required to pickup the hardening
e336be
# flags defined in the macros. The --build-id=uuid is a trick to get around
e336be
# debuginfo limitations: Typically, find-debuginfo.sh will update the build
e336be
# id of all binaries to allow for parllel debuginfo installs. The kernel
e336be
# can't use this because it breaks debuginfo for the vDSO so we have to
e336be
# use a special mechanism for kernel and modules to be unique. Unfortunately,
e336be
# we still have userspace binaries which need unique debuginfo and because
e336be
# they come from the kernel package, we can't just use find-debuginfo.sh to
e336be
# rewrite only those binaries. The easiest option right now is just to have
e336be
# the build id be a uuid for the host programs.
e336be
#
e336be
# Note we need to disable these flags for cross builds because the flags
e336be
# from redhat-rpm-config assume that host == target so target arch
e336be
# flags cause issues with the host compiler.
e336be
%if !%{with_cross}
e336be
%define build_hostcflags  %{?build_cflags}
e336be
%define build_hostldflags %{?build_ldflags} -Wl,--build-id=uuid
e336be
%endif
e336be
e336be
BuildKernel() {
e336be
    MakeTarget=$1
e336be
    KernelImage=$2
e336be
    Flavour=$4
e336be
    DoVDSO=$3
e336be
    Flav=${Flavour:++${Flavour}}
e336be
    InstallName=${5:-vmlinuz}
e336be
e336be
    # Pick the right config file for the kernel we're building
e336be
    Config=kernel-%{version}-%{_target_cpu}${Flavour:+-${Flavour}}.config
e336be
    DevelDir=/usr/src/kernels/%{KVERREL}${Flav}
e336be
e336be
    # When the bootable image is just the ELF kernel, strip it.
e336be
    # We already copy the unstripped file into the debuginfo package.
e336be
    if [ "$KernelImage" = vmlinux ]; then
e336be
      CopyKernel=cp_vmlinux
e336be
    else
e336be
      CopyKernel=cp
e336be
    fi
e336be
e336be
    KernelVer=%{version}-%{release}.%{_target_cpu}${Flav}
e336be
    echo BUILDING A KERNEL FOR ${Flavour} %{_target_cpu}...
e336be
e336be
    %if 0%{?stable_update}
e336be
    # make sure SUBLEVEL is incremented on a stable release.  Sigh 3.x.
e336be
    perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{?stablerev}/" Makefile
e336be
    %endif
e336be
e336be
    # make sure EXTRAVERSION says what we want it to say
e336be
    # Trim the release if this is a CI build, since KERNELVERSION is limited to 64 characters
e336be
    ShortRel=$(perl -e "print \"%{release}\" =~ s/\.pr\.[0-9A-Fa-f]{32}//r")
e336be
    perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -${ShortRel}.%{_target_cpu}${Flav}/" Makefile
e336be
e336be
    # if pre-rc1 devel kernel, must fix up PATCHLEVEL for our versioning scheme
e336be
    %if !0%{?rcrev}
e336be
    %if 0%{?gitrev}
e336be
    perl -p -i -e 's/^PATCHLEVEL.*/PATCHLEVEL = %{upstream_sublevel}/' Makefile
e336be
    %endif
e336be
    %endif
e336be
e336be
    # and now to start the build process
e336be
e336be
    make %{?make_opts} mrproper
e336be
    cp configs/$Config .config
e336be
e336be
    %if %{signkernel}%{signmodules}
e336be
    cp %{SOURCE11} certs/.
e336be
    %endif
e336be
e336be
    Arch=`head -1 .config | cut -b 3-`
e336be
    echo USING ARCH=$Arch
e336be
e336be
    make %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" ARCH=$Arch olddefconfig
e336be
e336be
    # This ensures build-ids are unique to allow parallel debuginfo
e336be
    perl -p -i -e "s/^CONFIG_BUILD_SALT.*/CONFIG_BUILD_SALT=\"%{KVERREL}\"/" .config
e336be
    %{make} %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" ARCH=$Arch %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags}
e336be
    %{make} %{?make_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" ARCH=$Arch %{?_smp_mflags} modules %{?sparse_mflags} || exit 1
e336be
e336be
    mkdir -p $RPM_BUILD_ROOT/%{image_install_path}
e336be
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
e336be
%if %{with_debuginfo}
e336be
    mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/%{image_install_path}
e336be
%endif
e336be
e336be
%ifarch %{arm} aarch64
e336be
    %{make} %{?make_opts} ARCH=$Arch dtbs dtbs_install INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer
e336be
    cp -r $RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/dtb
e336be
    find arch/$Arch/boot/dts -name '*.dtb' -type f -delete
e336be
%endif
e336be
e336be
    # Start installing the results
e336be
    install -m 644 .config $RPM_BUILD_ROOT/boot/config-$KernelVer
e336be
    install -m 644 .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/config
e336be
    install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-$KernelVer
e336be
    install -m 644 System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/System.map
e336be
e336be
    # We estimate the size of the initramfs because rpm needs to take this size
e336be
    # into consideration when performing disk space calculations. (See bz #530778)
e336be
    dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initramfs-$KernelVer.img bs=1M count=20
e336be
e336be
    if [ -f arch/$Arch/boot/zImage.stub ]; then
e336be
      cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/%{image_install_path}/zImage.stub-$KernelVer || :
e336be
      cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/lib/modules/$KernelVer/zImage.stub-$KernelVer || :
e336be
    fi
e336be
    %if %{signkernel}
e336be
    # Sign the image if we're using EFI
e336be
    %pesign -s -i $KernelImage -o vmlinuz.signed
e336be
    if [ ! -s vmlinuz.signed ]; then
e336be
        echo "pesigning failed"
e336be
        exit 1
e336be
    fi
e336be
    mv vmlinuz.signed $KernelImage
e336be
    %endif
e336be
    $CopyKernel $KernelImage \
e336be
                $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
e336be
    chmod 755 $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
e336be
    cp $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/$InstallName
e336be
e336be
    # hmac sign the kernel for FIPS
e336be
    echo "Creating hmac file: $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac"
e336be
    ls -l $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
e336be
    sha512hmac $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer | sed -e "s,$RPM_BUILD_ROOT,," > $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac;
e336be
    cp $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac $RPM_BUILD_ROOT/lib/modules/$KernelVer/.vmlinuz.hmac
e336be
e336be
    # Override $(mod-fw) because we don't want it to install any firmware
e336be
    # we'll get it from the linux-firmware package and we don't want conflicts
e336be
    %{make} %{?make_opts} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw=
e336be
e336be
    # add an a noop %%defattr statement 'cause rpm doesn't like empty file list files
e336be
    echo '%%defattr(-,-,-)' > ../kernel${Flavour:+-${Flavour}}-ldsoconf.list
e336be
    if [ $DoVDSO -ne 0 ]; then
e336be
        %{make} %{?make_opts} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer
e336be
        if [ -s ldconfig-kernel.conf ]; then
e336be
            install -D -m 444 ldconfig-kernel.conf \
e336be
                $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf
e336be
            echo /etc/ld.so.conf.d/kernel-$KernelVer.conf >> ../kernel${Flavour:+-${Flavour}}-ldsoconf.list
e336be
        fi
e336be
        rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/vdso/.build-id
e336be
    fi
e336be
e336be
    # And save the headers/makefiles etc for building modules against
e336be
    #
e336be
    # This all looks scary, but the end result is supposed to be:
e336be
    # * all arch relevant include/ files
e336be
    # * all Makefile/Kconfig files
e336be
    # * all script/ files
e336be
e336be
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
e336be
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/source
e336be
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
e336be
    (cd $RPM_BUILD_ROOT/lib/modules/$KernelVer ; ln -s build source)
e336be
    # dirs for additional modules per module-init-tools, kbuild/modules.txt
e336be
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/extra
e336be
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/updates
e336be
    # first copy everything
e336be
    cp --parents `find  -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
e336be
    cp Module.symvers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
e336be
    cp System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
e336be
    if [ -s Module.markers ]; then
e336be
      cp Module.markers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
e336be
    fi
e336be
    # then drop all but the needed Makefiles/Kconfig files
e336be
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Documentation
e336be
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts
e336be
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
e336be
    cp .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
e336be
    cp -a scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
e336be
    if [ -f tools/objtool/objtool ]; then
e336be
      cp -a tools/objtool/objtool $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/tools/objtool/ || :
e336be
      # these are a few files associated with objtool
e336be
      cp -a --parents tools/build/Build.include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
      cp -a --parents tools/build/Build $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
      cp -a --parents tools/build/fixdep.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
      cp -a --parents tools/scripts/utilities.mak $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
      # also more than necessary but it's not that many more files
e336be
      cp -a --parents tools/objtool/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
      cp -a --parents tools/lib/str_error_r.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
      cp -a --parents tools/lib/string.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
      cp -a --parents tools/lib/subcmd/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    fi
e336be
    if [ -d arch/$Arch/scripts ]; then
e336be
      cp -a arch/$Arch/scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch} || :
e336be
    fi
e336be
    if [ -f arch/$Arch/*lds ]; then
e336be
      cp -a arch/$Arch/*lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch}/ || :
e336be
    fi
e336be
    if [ -f arch/%{asmarch}/kernel/module.lds ]; then
e336be
      cp -a --parents arch/%{asmarch}/kernel/module.lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    fi
e336be
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*.o
e336be
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o
e336be
%ifarch %{power64}
e336be
    cp -a --parents arch/powerpc/lib/crtsavres.[So] $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
%endif
e336be
    if [ -d arch/%{asmarch}/include ]; then
e336be
      cp -a --parents arch/%{asmarch}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    fi
e336be
%ifarch aarch64
e336be
    # arch/arm64/include/asm/xen references arch/arm
e336be
    cp -a --parents arch/arm/include/asm/xen $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    # arch/arm64/include/asm/opcodes.h references arch/arm
e336be
    cp -a --parents arch/arm/include/asm/opcodes.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
%endif
e336be
    # include the machine specific headers for ARM variants, if available.
e336be
%ifarch %{arm}
e336be
    if [ -d arch/%{asmarch}/mach-${Flavour}/include ]; then
e336be
      cp -a --parents arch/%{asmarch}/mach-${Flavour}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    fi
e336be
    # include a few files for 'make prepare'
e336be
    cp -a --parents arch/arm/tools/gen-mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/arm/tools/mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
e336be
%endif
e336be
    cp -a include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
e336be
%ifarch %{ix86} x86_64
e336be
    # files for 'make prepare' to succeed with kernel-devel
e336be
    cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/entry/syscalls/syscalltbl.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/entry/syscalls/syscallhdr.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/tools/relocs_32.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/tools/relocs_64.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/tools/relocs.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/tools/relocs_common.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/tools/relocs.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    # Yes this is more includes than we probably need. Feel free to sort out
e336be
    # dependencies if you so choose.
e336be
    cp -a --parents tools/include/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/purgatory/purgatory.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/purgatory/stack.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
Pablo Greco 3ee77c
    cp -a --parents arch/x86/boot/compressed/string.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/purgatory/setup-x86_64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/purgatory/entry64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/boot/string.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/boot/string.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
    cp -a --parents arch/x86/boot/ctype.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
e336be
%endif
e336be
    # Make sure the Makefile and version.h have a matching timestamp so that
e336be
    # external modules can be built
e336be
    touch -r $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Makefile $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/generated/uapi/linux/version.h
e336be
e336be
    # Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
e336be
    cp $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/.config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/config/auto.conf
e336be
e336be
%if %{with_debuginfo}
e336be
    eu-readelf -n vmlinux | grep "Build ID" | awk '{print $NF}' > vmlinux.id
e336be
    cp vmlinux.id $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/vmlinux.id
e336be
e336be
    #
e336be
    # save the vmlinux file for kernel debugging into the kernel-debuginfo rpm
e336be
    #
e336be
    mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
e336be
    cp vmlinux $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
e336be
%endif
e336be
e336be
    find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name "*.ko" -type f >modnames
e336be
e336be
    # mark modules executable so that strip-to-file can strip them
e336be
    xargs --no-run-if-empty chmod u+x < modnames
e336be
e336be
    # Generate a list of modules for block and networking.
e336be
e336be
    grep -F /drivers/ modnames | xargs --no-run-if-empty nm -upA |
e336be
    sed -n 's,^.*/\([^/]*\.ko\):  *U \(.*\)$,\1 \2,p' > drivers.undef
e336be
e336be
    collect_modules_list()
e336be
    {
e336be
      sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef |
e336be
        LC_ALL=C sort -u > $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
e336be
      if [ ! -z "$3" ]; then
e336be
        sed -r -e "/^($3)\$/d" -i $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
e336be
      fi
e336be
    }
e336be
e336be
    collect_modules_list networking \
e336be
      'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt(l_|2x00)(pci|usb)_probe|register_netdevice'
e336be
    collect_modules_list block \
e336be
      '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'
e336be
    collect_modules_list drm \
e336be
      'drm_open|drm_init'
e336be
    collect_modules_list modesetting \
e336be
      'drm_crtc_init'
e336be
e336be
    # detect missing or incorrect license tags
e336be
    ( find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name '*.ko' | xargs /sbin/modinfo -l | \
e336be
        grep -E -v 'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' ) && exit 1
e336be
e336be
    # remove files that will be auto generated by depmod at rpm -i time
e336be
    pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/
e336be
        rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep}
e336be
    popd
e336be
e336be
    # Call the modules-extra script to move things around
e336be
    %{SOURCE17} $RPM_BUILD_ROOT/lib/modules/$KernelVer %{SOURCE16}
e336be
e336be
    #
e336be
    # Generate the kernel-core and kernel-modules files lists
e336be
    #
e336be
e336be
    # Copy the System.map file for depmod to use, and create a backup of the
e336be
    # full module tree so we can restore it after we're done filtering
e336be
    cp System.map $RPM_BUILD_ROOT/.
e336be
    pushd $RPM_BUILD_ROOT
e336be
    mkdir restore
e336be
    cp -r lib/modules/$KernelVer/* restore/.
e336be
e336be
    # don't include anything going into k-m-e in the file lists
e336be
    rm -rf lib/modules/$KernelVer/extra
e336be
e336be
    # Find all the module files and filter them out into the core and modules
e336be
    # lists.  This actually removes anything going into -modules from the dir.
e336be
    find lib/modules/$KernelVer/kernel -name *.ko | sort -n > modules.list
e336be
    cp $RPM_SOURCE_DIR/filter-*.sh .
e336be
    %{SOURCE99} modules.list %{_target_cpu}
e336be
    rm filter-*.sh
e336be
e336be
    # Run depmod on the resulting module tree and make sure it isn't broken
e336be
    depmod -b . -aeF ./System.map $KernelVer &> depmod.out
e336be
    if [ -s depmod.out ]; then
e336be
        echo "Depmod failure"
e336be
        cat depmod.out
e336be
        exit 1
e336be
    else
e336be
        rm depmod.out
e336be
    fi
e336be
    # remove files that will be auto generated by depmod at rpm -i time
e336be
    pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/
e336be
        rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep}
e336be
    popd
e336be
e336be
    # Go back and find all of the various directories in the tree.  We use this
e336be
    # for the dir lists in kernel-core
e336be
    find lib/modules/$KernelVer/kernel -mindepth 1 -type d | sort -n > module-dirs.list
e336be
e336be
    # Cleanup
e336be
    rm System.map
e336be
    cp -r restore/* lib/modules/$KernelVer/.
e336be
    rm -rf restore
e336be
    popd
e336be
e336be
    # Make sure the files lists start with absolute paths or rpmbuild fails.
e336be
    # Also add in the dir entries
e336be
    sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/k-d.list > ../kernel${Flavour:+-${Flavour}}-modules.list
e336be
    sed -e 's/^lib*/%dir \/lib/' %{?zipsed} $RPM_BUILD_ROOT/module-dirs.list > ../kernel${Flavour:+-${Flavour}}-core.list
e336be
    sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/modules.list >> ../kernel${Flavour:+-${Flavour}}-core.list
e336be
e336be
    # Cleanup
e336be
    rm -f $RPM_BUILD_ROOT/k-d.list
e336be
    rm -f $RPM_BUILD_ROOT/modules.list
e336be
    rm -f $RPM_BUILD_ROOT/module-dirs.list
e336be
e336be
%if %{signmodules}
e336be
    # Save the signing keys so we can sign the modules in __modsign_install_post
e336be
    cp certs/signing_key.pem certs/signing_key.pem.sign${Flav}
e336be
    cp certs/signing_key.x509 certs/signing_key.x509.sign${Flav}
e336be
%endif
e336be
e336be
    # Move the devel headers out of the root file system
e336be
    mkdir -p $RPM_BUILD_ROOT/usr/src/kernels
e336be
    mv $RPM_BUILD_ROOT/lib/modules/$KernelVer/build $RPM_BUILD_ROOT/$DevelDir
e336be
e336be
    # This is going to create a broken link during the build, but we don't use
e336be
    # it after this point.  We need the link to actually point to something
e336be
    # when kernel-devel is installed, and a relative link doesn't work across
e336be
    # the F17 UsrMove feature.
e336be
    ln -sf $DevelDir $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
e336be
e336be
    # prune junk from kernel-devel
e336be
    find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -delete
e336be
e336be
    # build a BLS config for this kernel
e336be
    %{SOURCE43} "$KernelVer" "$RPM_BUILD_ROOT" "%{?variant}"
e336be
}
e336be
e336be
###
e336be
# DO it...
e336be
###
e336be
e336be
# prepare directories
e336be
rm -rf $RPM_BUILD_ROOT
e336be
mkdir -p $RPM_BUILD_ROOT/boot
e336be
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}
e336be
e336be
cd linux-%{KVERREL}
e336be
e336be
e336be
%if %{with_debug}
e336be
BuildKernel %make_target %kernel_image %{_use_vdso} debug
e336be
%endif
e336be
e336be
%if %{with_pae_debug}
e336be
BuildKernel %make_target %kernel_image %{use_vdso} %{pae}debug
e336be
%endif
e336be
e336be
%if %{with_pae}
e336be
BuildKernel %make_target %kernel_image %{use_vdso} %{pae}
e336be
%endif
e336be
e336be
%if %{with_up}
e336be
BuildKernel %make_target %kernel_image %{_use_vdso}
e336be
%endif
e336be
a63ef9
%global perf_make \
a63ef9
  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 NO_JVMTI=1 prefix=%{_prefix}
a63ef9
%if %{with_perf}
a63ef9
# perf
a63ef9
# make sure check-headers.sh is executable
a63ef9
chmod +x tools/perf/check-headers.sh
8c7c00
%{perf_make} DESTDIR=$RPM_BUILD_ROOT PYTHON=%{python_selected} all
a63ef9
# Build the docs
a63ef9
pushd tools/kvm/kvm_stat/
a63ef9
make %{?_smp_mflags} man
a63ef9
popd
a63ef9
pushd tools/perf/Documentation/
a63ef9
make %{?_smp_mflags} man
a63ef9
popd
a63ef9
%endif
a63ef9
a63ef9
%if %{with_tools}
a63ef9
%ifarch %{cpupowerarchs}
a63ef9
# cpupower
a63ef9
# make sure version-gen.sh is executable.
a63ef9
chmod +x tools/power/cpupower/utils/version-gen.sh
a63ef9
%{make} %{?_smp_mflags} -C tools/power/cpupower CPUFREQ_BENCH=false
a63ef9
%ifarch %{ix86}
a63ef9
    pushd tools/power/cpupower/debug/i386
a63ef9
    %{make} %{?_smp_mflags} centrino-decode powernow-k8-decode
a63ef9
    popd
a63ef9
%endif
a63ef9
%ifarch x86_64
a63ef9
    pushd tools/power/cpupower/debug/x86_64
a63ef9
    %{make} %{?_smp_mflags} centrino-decode powernow-k8-decode
a63ef9
    popd
a63ef9
%endif
a63ef9
%ifarch %{ix86} x86_64
a63ef9
   pushd tools/power/x86/x86_energy_perf_policy/
a63ef9
   %{make}
a63ef9
   popd
a63ef9
   pushd tools/power/x86/turbostat
a63ef9
   %{make}
a63ef9
   popd
a63ef9
%endif #turbostat/x86_energy_perf_policy
a63ef9
%endif
a63ef9
pushd tools/thermal/tmon/
a63ef9
%{make}
a63ef9
popd
a63ef9
pushd tools/iio/
a63ef9
%{make}
a63ef9
popd
a63ef9
pushd tools/gpio/
a63ef9
%{make}
a63ef9
popd
a63ef9
%endif
a63ef9
e336be
# In the modsign case, we do 3 things.  1) We check the "flavour" and hard
e336be
# code the value in the following invocations.  This is somewhat sub-optimal
e336be
# but we're doing this inside of an RPM macro and it isn't as easy as it
e336be
# could be because of that.  2) We restore the .tmp_versions/ directory from
e336be
# the one we saved off in BuildKernel above.  This is to make sure we're
e336be
# signing the modules we actually built/installed in that flavour.  3) We
e336be
# grab the arch and invoke mod-sign.sh command to actually sign the modules.
e336be
#
e336be
# We have to do all of those things _after_ find-debuginfo runs, otherwise
e336be
# that will strip the signature off of the modules.
e336be
e336be
%define __modsign_install_post \
e336be
  if [ "%{signmodules}" -eq "1" ]; then \
e336be
    if [ "%{with_pae}" -ne "0" ]; then \
e336be
      %{modsign_cmd} certs/signing_key.pem.sign+%{pae} certs/signing_key.x509.sign+%{pae} $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+%{pae}/ \
e336be
    fi \
e336be
    if [ "%{with_debug}" -ne "0" ]; then \
e336be
      %{modsign_cmd} certs/signing_key.pem.sign+debug certs/signing_key.x509.sign+debug $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+debug/ \
e336be
    fi \
e336be
    if [ "%{with_pae_debug}" -ne "0" ]; then \
e336be
      %{modsign_cmd} certs/signing_key.pem.sign+%{pae}debug certs/signing_key.x509.sign+%{pae}debug $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+%{pae}debug/ \
e336be
    fi \
e336be
    if [ "%{with_up}" -ne "0" ]; then \
e336be
      %{modsign_cmd} certs/signing_key.pem.sign certs/signing_key.x509.sign $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/ \
e336be
    fi \
e336be
  fi \
e336be
  if [ "%{zipmodules}" -eq "1" ]; then \
e336be
    find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs xz; \
e336be
  fi \
e336be
%{nil}
e336be
e336be
###
e336be
### Special hacks for debuginfo subpackages.
e336be
###
e336be
e336be
# This macro is used by %%install, so we must redefine it before that.
e336be
%define debug_package %{nil}
e336be
e336be
%if %{with_debuginfo}
e336be
e336be
%ifnarch noarch
e336be
%global __debug_package 1
e336be
%files -f debugfiles.list debuginfo-common-%{_target_cpu}
e336be
%endif
e336be
e336be
%endif
e336be
e336be
#
e336be
# Disgusting hack alert! We need to ensure we sign modules *after* all
e336be
# invocations of strip occur, which is in __debug_install_post if
e336be
# find-debuginfo.sh runs, and __os_install_post if not.
e336be
#
e336be
%define __spec_install_post \
e336be
  %{?__debug_package:%{__debug_install_post}}\
e336be
  %{__arch_install_post}\
e336be
  %{__os_install_post}\
e336be
  %{__modsign_install_post}
e336be
e336be
###
e336be
### install
e336be
###
e336be
e336be
%install
e336be
e336be
cd linux-%{KVERREL}
e336be
e336be
# We have to do the headers install before the tools install because the
e336be
# kernel headers_install will remove any header files in /usr/include that
e336be
# it doesn't install itself.
e336be
e336be
%if %{with_headers}
e336be
# Install kernel headers
e336be
make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
e336be
e336be
find $RPM_BUILD_ROOT/usr/include \
e336be
     \( -name .install -o -name .check -o \
e336be
        -name ..install.cmd -o -name ..check.cmd \) -delete
e336be
e336be
%endif
e336be
e336be
%if %{with_cross_headers}
e336be
mkdir -p $RPM_BUILD_ROOT/usr/tmp-headers
e336be
make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/tmp-headers headers_install_all
e336be
e336be
find $RPM_BUILD_ROOT/usr/tmp-headers/include \
e336be
     \( -name .install -o -name .check -o \
e336be
        -name ..install.cmd -o -name ..check.cmd \) -delete
e336be
e336be
# Copy all the architectures we care about to their respective asm directories
e336be
for arch in arm arm64 powerpc s390 x86 ; do
e336be
mkdir -p $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include
e336be
mv $RPM_BUILD_ROOT/usr/tmp-headers/include/arch-${arch}/asm $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/
e336be
cp -a $RPM_BUILD_ROOT/usr/tmp-headers/include/asm-generic $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/.
e336be
done
e336be
e336be
# Remove the rest of the architectures
e336be
rm -rf $RPM_BUILD_ROOT/usr/tmp-headers/include/arch*
e336be
rm -rf $RPM_BUILD_ROOT/usr/tmp-headers/include/asm-*
e336be
e336be
# Copy the rest of the headers over
e336be
for arch in arm arm64 powerpc s390 x86 ; do
e336be
cp -a $RPM_BUILD_ROOT/usr/tmp-headers/include/* $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/.
e336be
done
e336be
e336be
rm -rf $RPM_BUILD_ROOT/usr/tmp-headers
e336be
%endif
e336be
a63ef9
%if %{with_perf}
a63ef9
# perf tool binary and supporting scripts/binaries
8c7c00
%{perf_make} DESTDIR=$RPM_BUILD_ROOT PYTHON=%{python_selected} lib=%{_lib} install-bin install-traceevent-plugins
a63ef9
# remove the 'trace' symlink.
a63ef9
rm -f %{buildroot}%{_bindir}/trace
a63ef9
# remove the perf-tips
a63ef9
rm -rf %{buildroot}%{_docdir}/perf-tip
a63ef9
26424c
# For both of the below, yes, this should be using a macro but right now
26424c
# it's hard coded and we don't actually want it anyway right now.
26424c
# Whoever wants examples can fix it up!
26424c
26424c
# remove examples
26424c
rm -rf %{buildroot}/usr/lib/perf/examples
26424c
# remove the stray header file that somehow got packaged in examples
26424c
rm -rf %{buildroot}/usr/lib/perf/include/bpf/
26424c
a63ef9
# python-perf extension
8c7c00
%{perf_make} DESTDIR=$RPM_BUILD_ROOT PYTHON=%{python_selected} install-python_ext
a63ef9
a63ef9
# perf man pages (note: implicit rpm magic compresses them later)
a63ef9
install -d %{buildroot}/%{_mandir}/man1
a63ef9
install -pm0644 tools/perf/Documentation/*.1 %{buildroot}/%{_mandir}/man1/
a63ef9
%if %{with_tools}
a63ef9
    install -pm0644 tools/kvm/kvm_stat/kvm_stat.1 %{buildroot}/%{_mandir}/man1/
a63ef9
%endif
a63ef9
%endif
a63ef9
a63ef9
%if %{with_tools}
a63ef9
%ifarch %{cpupowerarchs}
a63ef9
%{make} -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
a63ef9
rm -f %{buildroot}%{_libdir}/*.{a,la}
a63ef9
%find_lang cpupower
a63ef9
mv cpupower.lang ../
a63ef9
%ifarch %{ix86}
a63ef9
    pushd tools/power/cpupower/debug/i386
a63ef9
    install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
a63ef9
    install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
a63ef9
    popd
a63ef9
%endif
a63ef9
%ifarch x86_64
a63ef9
    pushd tools/power/cpupower/debug/x86_64
a63ef9
    install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
a63ef9
    install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
a63ef9
    popd
a63ef9
%endif
a63ef9
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
a63ef9
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
a63ef9
install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service
a63ef9
install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
a63ef9
%endif
a63ef9
%ifarch %{ix86} x86_64
a63ef9
   mkdir -p %{buildroot}%{_mandir}/man8
a63ef9
   pushd tools/power/x86/x86_energy_perf_policy
a63ef9
   make DESTDIR=%{buildroot} install
a63ef9
   popd
a63ef9
   pushd tools/power/x86/turbostat
a63ef9
   make DESTDIR=%{buildroot} install
a63ef9
   popd
a63ef9
%endif #turbostat/x86_energy_perf_policy
a63ef9
pushd tools/thermal/tmon
a63ef9
make INSTALL_ROOT=%{buildroot} install
a63ef9
popd
a63ef9
pushd tools/iio
a63ef9
make DESTDIR=%{buildroot} install
a63ef9
popd
a63ef9
pushd tools/gpio
a63ef9
make DESTDIR=%{buildroot} install
a63ef9
popd
a63ef9
pushd tools/kvm/kvm_stat
a63ef9
make INSTALL_ROOT=%{buildroot} install-tools
a63ef9
popd
a63ef9
%endif
a63ef9
e336be
###
e336be
### clean
e336be
###
e336be
e336be
###
e336be
### scripts
e336be
###
e336be
a63ef9
%if %{with_tools}
a63ef9
%post -n kernel-tools-libs
a63ef9
/sbin/ldconfig
a63ef9
a63ef9
%postun -n kernel-tools-libs
a63ef9
/sbin/ldconfig
a63ef9
%endif
a63ef9
e336be
#
e336be
# This macro defines a %%post script for a kernel*-devel package.
e336be
#	%%kernel_devel_post [<subpackage>]
e336be
#
e336be
%define kernel_devel_post() \
e336be
%{expand:%%post %{?1:%{1}-}devel}\
e336be
if [ -f /etc/sysconfig/kernel ]\
e336be
then\
e336be
    . /etc/sysconfig/kernel || exit $?\
e336be
fi\
e336be
if [ "$HARDLINK" != "no" -a -x /usr/sbin/hardlink ]\
e336be
then\
e336be
    (cd /usr/src/kernels/%{KVERREL}%{?1:+%{1}} &&\
e336be
     /usr/bin/find . -type f | while read f; do\
e336be
       hardlink -c /usr/src/kernels/*.fc*.*/$f $f\
e336be
     done)\
e336be
fi\
e336be
%{nil}
e336be
e336be
#
e336be
# This macro defines a %%post script for a kernel*-modules-extra package.
e336be
# It also defines a %%postun script that does the same thing.
e336be
#	%%kernel_modules_extra_post [<subpackage>]
e336be
#
e336be
%define kernel_modules_extra_post() \
e336be
%{expand:%%post %{?1:%{1}-}modules-extra}\
e336be
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
e336be
%{nil}\
e336be
%{expand:%%postun %{?1:%{1}-}modules-extra}\
e336be
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
e336be
%{nil}
e336be
e336be
#
e336be
# This macro defines a %%post script for a kernel*-modules package.
e336be
# It also defines a %%postun script that does the same thing.
e336be
#	%%kernel_modules_post [<subpackage>]
e336be
#
e336be
%define kernel_modules_post() \
e336be
%{expand:%%post %{?1:%{1}-}modules}\
e336be
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
e336be
%{nil}\
e336be
%{expand:%%postun %{?1:%{1}-}modules}\
e336be
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
e336be
%{nil}
e336be
e336be
# This macro defines a %%posttrans script for a kernel package.
e336be
#	%%kernel_variant_posttrans [<subpackage>]
e336be
# More text can follow to go at the end of this variant's %%post.
e336be
#
e336be
%define kernel_variant_posttrans() \
e336be
%{expand:%%posttrans %{?1:%{1}-}core}\
e336be
/bin/kernel-install add %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\
e336be
%{nil}