orgads / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
f2c60e
# We have to override the new %%install behavior because, well... the kernel is special.
f2c60e
%global __spec_install_pre %{___build_pre}
f2c60e
f2c60e
Summary: The Linux kernel
f2c60e
f2c60e
# For a stable, released kernel, released_kernel should be 1. For rawhide
f2c60e
# and/or a kernel built from an rc or git snapshot, released_kernel should
f2c60e
# be 0.
f2c60e
%global released_kernel 1
f2c60e
f2c60e
# Sign modules on x86.  Make sure the config files match this setting if more
f2c60e
# architectures are added.
f2c60e
%ifarch %{ix86} x86_64
f2c60e
%global signkernel 1
f2c60e
%global signmodules 1
f2c60e
%global zipmodules 1
f2c60e
%else
f2c60e
%global signkernel 0
f2c60e
%global signmodules 1
f2c60e
%global zipmodules 1
f2c60e
%endif
f2c60e
f2c60e
%if %{zipmodules}
f2c60e
%global zipsed -e 's/\.ko$/\.ko.xz/'
f2c60e
%endif
f2c60e
f2c60e
# define buildid .local
f2c60e
f2c60e
# baserelease defines which build revision of this kernel version we're
f2c60e
# building.  We used to call this fedora_build, but the magical name
f2c60e
# baserelease is matched by the rpmdev-bumpspec tool, which you should use.
f2c60e
#
f2c60e
# We used to have some extra magic weirdness to bump this automatically,
f2c60e
# but now we don't.  Just use: rpmdev-bumpspec -c 'comment for changelog'
f2c60e
# When changing base_sublevel below or going from rc to a final kernel,
f2c60e
# reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec).
f2c60e
# scripts/rebase.sh should be made to do that for you, actually.
f2c60e
#
f2c60e
# NOTE: baserelease must be > 0 or bad things will happen if you switch
f2c60e
#       to a released kernel (released version will be < rc version)
f2c60e
#
f2c60e
# For non-released -rc kernels, this will be appended after the rcX and
f2c60e
# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
f2c60e
#
f2c60e
%global baserelease 200
f2c60e
%global fedora_build %{baserelease}
f2c60e
f2c60e
# base_sublevel is the kernel version we're starting with and patching
f2c60e
# on top of -- for example, 3.1-rc7-git1 starts with a 3.0 base,
f2c60e
# which yields a base_sublevel of 0.
f2c60e
%define base_sublevel 14
f2c60e
f2c60e
## If this is a released kernel ##
f2c60e
%if 0%{?released_kernel}
f2c60e
f2c60e
# Do we have a -stable update to apply?
Pablo Greco c42444
%define stable_update 134
f2c60e
# Set rpm version accordingly
f2c60e
%if 0%{?stable_update}
f2c60e
%define stablerev %{stable_update}
f2c60e
%define stable_base %{stable_update}
f2c60e
%endif
f2c60e
%define rpmversion 4.%{base_sublevel}.%{stable_update}
f2c60e
f2c60e
## The not-released-kernel case ##
f2c60e
%else
f2c60e
# The next upstream release sublevel (base_sublevel+1)
f2c60e
%define upstream_sublevel %(echo $((%{base_sublevel} + 1)))
f2c60e
# The rc snapshot level
f2c60e
%global rcrev 0
f2c60e
# The git snapshot level
f2c60e
%define gitrev 0
f2c60e
# Set rpm version accordingly
f2c60e
%define rpmversion 4.%{upstream_sublevel}.0
f2c60e
%endif
f2c60e
# Nb: The above rcrev and gitrev values automagically define Patch00 and Patch01 below.
f2c60e
f2c60e
# What parts do we want to build?  We must build at least one kernel.
f2c60e
# These are the kernels that are built IF the architecture allows it.
f2c60e
# All should default to 1 (enabled) and be flipped to 0 (disabled)
f2c60e
# by later arch-specific checks.
f2c60e
f2c60e
# The following build options are enabled by default.
f2c60e
# Use either --without <opt> in your rpmbuild command or force values
f2c60e
# to 0 in here to disable them.
f2c60e
#
f2c60e
# standard kernel
f2c60e
%define with_up        %{?_without_up:        0} %{?!_without_up:        1}
f2c60e
# kernel PAE (only valid for i686 (PAE) and ARM (lpae))
f2c60e
%define with_pae       %{?_without_pae:       0} %{?!_without_pae:       1}
f2c60e
# kernel-debug
f2c60e
%define with_debug     %{?_without_debug:     0} %{?!_without_debug:     1}
f2c60e
# kernel-headers
f2c60e
%define with_headers   %{?_without_headers:   0} %{?!_without_headers:   1}
f2c60e
%define with_cross_headers   %{?_without_cross_headers:   0} %{?!_without_cross_headers:   1}
f2c60e
# perf
f2c60e
%define with_perf      %{?_without_perf:      0} %{?!_without_perf:      1}
f2c60e
# tools
f2c60e
%define with_tools     %{?_without_tools:     0} %{?!_without_tools:     1}
f2c60e
# kernel-debuginfo
f2c60e
%define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1}
f2c60e
# kernel-bootwrapper (for creating zImages from kernel + initrd)
f2c60e
%define with_bootwrapper %{?_without_bootwrapper: 0} %{?!_without_bootwrapper: 1}
f2c60e
# Want to build a the vsdo directories installed
f2c60e
%define with_vdso_install %{?_without_vdso_install: 0} %{?!_without_vdso_install: 1}
f2c60e
#
f2c60e
# Additional options for user-friendly one-off kernel building:
f2c60e
#
f2c60e
# Only build the base kernel (--with baseonly):
f2c60e
%define with_baseonly  %{?_with_baseonly:     1} %{?!_with_baseonly:     0}
f2c60e
# Only build the pae kernel (--with paeonly):
f2c60e
%define with_paeonly   %{?_with_paeonly:      1} %{?!_with_paeonly:      0}
f2c60e
# Only build the debug kernel (--with dbgonly):
f2c60e
%define with_dbgonly   %{?_with_dbgonly:      1} %{?!_with_dbgonly:      0}
f2c60e
#
f2c60e
# should we do C=1 builds with sparse
f2c60e
%define with_sparse    %{?_with_sparse:       1} %{?!_with_sparse:       0}
f2c60e
#
f2c60e
# Cross compile requested?
f2c60e
%define with_cross    %{?_with_cross:         1} %{?!_with_cross:        0}
f2c60e
#
f2c60e
# build a release kernel on rawhide
f2c60e
%define with_release   %{?_with_release:      1} %{?!_with_release:      0}
f2c60e
f2c60e
# Set debugbuildsenabled to 1 for production (build separate debug kernels)
f2c60e
#  and 0 for rawhide (all kernels are debug kernels).
f2c60e
# See also 'make debug' and 'make release'.
f2c60e
%define debugbuildsenabled 1
f2c60e
f2c60e
# Want to build a vanilla kernel build without any non-upstream patches?
f2c60e
%define with_vanilla %{?_with_vanilla: 1} %{?!_with_vanilla: 0}
f2c60e
f2c60e
# pkg_release is what we'll fill in for the rpm Release: field
f2c60e
%if 0%{?released_kernel}
f2c60e
f2c60e
%define pkg_release %{fedora_build}%{?buildid}%{?dist}
f2c60e
f2c60e
%else
f2c60e
f2c60e
# non-released_kernel
f2c60e
%if 0%{?rcrev}
f2c60e
%define rctag .rc%rcrev
f2c60e
%else
f2c60e
%define rctag .rc0
f2c60e
%endif
f2c60e
%if 0%{?gitrev}
f2c60e
%define gittag .git%gitrev
f2c60e
%else
f2c60e
%define gittag .git0
f2c60e
%endif
f2c60e
%define pkg_release 0%{?rctag}%{?gittag}.%{fedora_build}%{?buildid}%{?dist}
f2c60e
f2c60e
%endif
f2c60e
f2c60e
# The kernel tarball/base version
f2c60e
%define kversion 4.%{base_sublevel}
f2c60e
f2c60e
%define make_target bzImage
f2c60e
%define image_install_path boot
f2c60e
f2c60e
%define KVERREL %{version}-%{release}.%{_target_cpu}
f2c60e
%define hdrarch %_target_cpu
f2c60e
%define asmarch %_target_cpu
f2c60e
f2c60e
%if 0%{!?nopatches:1}
f2c60e
%define nopatches 0
f2c60e
%endif
f2c60e
f2c60e
%if %{with_vanilla}
f2c60e
%define nopatches 1
f2c60e
%endif
f2c60e
f2c60e
%if %{nopatches}
f2c60e
%define with_bootwrapper 0
f2c60e
%define variant -vanilla
f2c60e
%endif
f2c60e
f2c60e
%if !%{debugbuildsenabled}
f2c60e
%define with_debug 0
f2c60e
%endif
f2c60e
f2c60e
%if !%{with_debuginfo}
f2c60e
%define _enable_debug_packages 0
f2c60e
%endif
f2c60e
%define debuginfodir /usr/lib/debug
f2c60e
# Needed because we override almost everything involving build-ids
f2c60e
# and debuginfo generation. Currently we rely on the old alldebug setting.
f2c60e
%global _build_id_links alldebug
f2c60e
f2c60e
# kernel PAE is only built on i686 and ARMv7.
f2c60e
%ifnarch i686 armv7hl
f2c60e
%define with_pae 0
f2c60e
%endif
f2c60e
f2c60e
# if requested, only build base kernel
f2c60e
%if %{with_baseonly}
f2c60e
%define with_pae 0
f2c60e
%define with_debug 0
f2c60e
%endif
f2c60e
f2c60e
# if requested, only build pae kernel
f2c60e
%if %{with_paeonly}
f2c60e
%define with_up 0
f2c60e
%define with_debug 0
f2c60e
%endif
f2c60e
f2c60e
# if requested, only build debug kernel
f2c60e
%if %{with_dbgonly}
f2c60e
%if %{debugbuildsenabled}
f2c60e
%define with_up 0
f2c60e
%define with_pae 0
f2c60e
%endif
f2c60e
%define with_pae 0
f2c60e
%define with_tools 0
f2c60e
%define with_perf 0
f2c60e
%endif
f2c60e
f2c60e
%define all_x86 i386 i686
f2c60e
f2c60e
%if %{with_vdso_install}
f2c60e
%define use_vdso 1
f2c60e
%endif
f2c60e
f2c60e
# Overrides for generic default options
f2c60e
f2c60e
# don't do debug builds on anything but i686 and x86_64
f2c60e
%ifnarch i686 x86_64
f2c60e
%define with_debug 0
f2c60e
%endif
f2c60e
f2c60e
# don't build noarch kernels or headers (duh)
f2c60e
%ifarch noarch
f2c60e
%define with_up 0
f2c60e
%define with_headers 0
f2c60e
%define with_cross_headers 0
f2c60e
%define with_tools 0
f2c60e
%define with_perf 0
f2c60e
%define all_arch_configs kernel-%{version}-*.config
f2c60e
%endif
f2c60e
f2c60e
# bootwrapper is only on ppc
f2c60e
# sparse blows up on ppc
f2c60e
%ifnarch %{power64}
f2c60e
%define with_bootwrapper 0
f2c60e
%define with_sparse 0
f2c60e
%endif
f2c60e
f2c60e
# Per-arch tweaks
f2c60e
f2c60e
%ifarch %{all_x86}
f2c60e
%define asmarch x86
f2c60e
%define hdrarch i386
f2c60e
%define pae PAE
f2c60e
%define all_arch_configs kernel-%{version}-i?86*.config
f2c60e
%define kernel_image arch/x86/boot/bzImage
f2c60e
%endif
f2c60e
f2c60e
%ifarch x86_64
f2c60e
%define asmarch x86
f2c60e
%define all_arch_configs kernel-%{version}-x86_64*.config
f2c60e
%define kernel_image arch/x86/boot/bzImage
f2c60e
%endif
f2c60e
f2c60e
%ifarch %{power64}
f2c60e
%define asmarch powerpc
f2c60e
%define hdrarch powerpc
f2c60e
%define make_target vmlinux
f2c60e
%define kernel_image vmlinux
f2c60e
%define kernel_image_elf 1
f2c60e
%ifarch ppc64
f2c60e
%define all_arch_configs kernel-%{version}-ppc64*.config
f2c60e
%endif
f2c60e
%ifarch ppc64le
f2c60e
%define all_arch_configs kernel-%{version}-ppc64le*.config
f2c60e
%endif
f2c60e
%endif
f2c60e
f2c60e
%ifarch s390x
f2c60e
%define asmarch s390
f2c60e
%define hdrarch s390
f2c60e
%define all_arch_configs kernel-%{version}-s390x.config
f2c60e
%define make_target image
f2c60e
%define kernel_image arch/s390/boot/image
f2c60e
%define with_tools 0
f2c60e
%endif
f2c60e
f2c60e
%ifarch %{arm}
f2c60e
%define all_arch_configs kernel-%{version}-arm*.config
f2c60e
%define skip_nonpae_vdso 1
f2c60e
%define asmarch arm
f2c60e
%define hdrarch arm
f2c60e
%define pae lpae
f2c60e
%define make_target bzImage
f2c60e
%define kernel_image arch/arm/boot/zImage
f2c60e
# http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/091404.html
f2c60e
%define kernel_mflags KALLSYMS_EXTRA_PASS=1
f2c60e
# we only build headers/perf/tools on the base arm arches
f2c60e
# just like we used to only build them on i386 for x86
f2c60e
%ifnarch armv7hl
f2c60e
%define with_headers 0
f2c60e
%define with_cross_headers 0
f2c60e
%define with_perf 0
f2c60e
%define with_tools 0
f2c60e
%endif
f2c60e
%endif
f2c60e
f2c60e
%ifarch aarch64
f2c60e
%define all_arch_configs kernel-%{version}-aarch64*.config
f2c60e
%define asmarch arm64
f2c60e
%define hdrarch arm64
f2c60e
%define make_target Image.gz
f2c60e
%define kernel_image arch/arm64/boot/Image.gz
f2c60e
%endif
f2c60e
f2c60e
# Should make listnewconfig fail if there's config options
f2c60e
# printed out?
f2c60e
%if %{nopatches}
f2c60e
%define listnewconfig_fail 0
f2c60e
%define configmismatch_fail 0
f2c60e
%else
f2c60e
%define listnewconfig_fail 1
f2c60e
%define configmismatch_fail 1
f2c60e
%endif
f2c60e
f2c60e
# To temporarily exclude an architecture from being built, add it to
f2c60e
# %%nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we
f2c60e
# don't build kernel-headers then the new build system will no longer let
f2c60e
# us use the previous build of that package -- it'll just be completely AWOL.
f2c60e
# Which is a BadThing(tm).
f2c60e
f2c60e
# We only build kernel-headers on the following...
f2c60e
%define nobuildarches i386
f2c60e
f2c60e
%ifarch %nobuildarches
f2c60e
%define with_up 0
f2c60e
%define with_pae 0
f2c60e
%define with_debuginfo 0
f2c60e
%define with_perf 0
f2c60e
%define with_tools 0
f2c60e
%define _enable_debug_packages 0
f2c60e
%endif
f2c60e
f2c60e
%define with_pae_debug 0
f2c60e
%if %{with_pae}
f2c60e
%define with_pae_debug %{with_debug}
f2c60e
%endif
f2c60e
f2c60e
# Architectures we build tools/cpupower on
f2c60e
%define cpupowerarchs %{ix86} x86_64 %{power64} %{arm} aarch64
f2c60e
f2c60e
%if %{use_vdso}
f2c60e
f2c60e
%if 0%{?skip_nonpae_vdso}
f2c60e
%define _use_vdso 0
f2c60e
%else
f2c60e
%define _use_vdso 1
f2c60e
%endif
f2c60e
f2c60e
%else
f2c60e
%define _use_vdso 0
f2c60e
%endif
f2c60e
f2c60e
f2c60e
#
f2c60e
# Packages that need to be installed before the kernel is, because the %%post
f2c60e
# scripts use them.
f2c60e
#
f2c60e
%define kernel_prereq  coreutils, systemd >= 203-2, /usr/bin/kernel-install, /usr/sbin/new-kernel-pkg
f2c60e
%define initrd_prereq  dracut >= 027
f2c60e
f2c60e
f2c60e
Name: kernel%{?variant}
f2c60e
Group: System Environment/Kernel
f2c60e
License: GPLv2 and Redistributable, no modification permitted
f2c60e
URL: http://www.kernel.org/
f2c60e
Version: %{rpmversion}
f2c60e
Release: %{pkg_release}
f2c60e
# DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD.
f2c60e
# SET %%nobuildarches (ABOVE) INSTEAD
f2c60e
ExclusiveArch: %{all_x86} x86_64 ppc64 s390x %{arm} aarch64 ppc64le
f2c60e
ExclusiveOS: Linux
f2c60e
%ifnarch %{nobuildarches}
f2c60e
Requires: kernel-core-uname-r = %{KVERREL}%{?variant}
f2c60e
Requires: kernel-modules-uname-r = %{KVERREL}%{?variant}
f2c60e
%endif
f2c60e
f2c60e
Conflicts: xorg-x11-drv-vmmouse < 14.0.0
f2c60e
f2c60e
#
f2c60e
# List the packages used during the kernel build
f2c60e
#
f2c60e
BuildRequires: kmod, patch, bash, sh-utils, tar, git
f2c60e
BuildRequires: bzip2, xz, findutils, gzip, m4, perl, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk
f2c60e
BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc
f2c60e
BuildRequires: net-tools, hostname, bc, elfutils-devel
f2c60e
%if %{with_sparse}
f2c60e
BuildRequires: sparse
f2c60e
%endif
f2c60e
%if %{with_perf}
f2c60e
BuildRequires: zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) bison flex xz-devel
f2c60e
BuildRequires: audit-libs-devel
f2c60e
%ifnarch s390x %{arm}
f2c60e
BuildRequires: numactl-devel
f2c60e
%endif
f2c60e
%endif
f2c60e
%if %{with_tools}
f2c60e
BuildRequires: pciutils-devel gettext ncurses-devel
f2c60e
%endif
f2c60e
BuildConflicts: rhbuildsys(DiskFree) < 500Mb
f2c60e
%if %{with_debuginfo}
f2c60e
BuildRequires: rpm-build, elfutils
f2c60e
%define debuginfo_args --strict-build-id -r
f2c60e
%endif
f2c60e
f2c60e
%if %{signkernel}%{signmodules}
f2c60e
BuildRequires: openssl openssl-devel
f2c60e
%if %{signkernel}
f2c60e
BuildRequires: pesign >= 0.10-4
f2c60e
%endif
f2c60e
%endif
f2c60e
f2c60e
%if %{with_cross}
f2c60e
BuildRequires: binutils-%{_build_arch}-linux-gnu, gcc-%{_build_arch}-linux-gnu
f2c60e
%define cross_opts CROSS_COMPILE=%{_build_arch}-linux-gnu-
f2c60e
%endif
f2c60e
f2c60e
Source0: https://www.kernel.org/pub/linux/kernel/v4.x/linux-%{kversion}.tar.xz
f2c60e
f2c60e
Source10: perf-man-%{kversion}.tar.gz
f2c60e
Source11: x509.genkey
f2c60e
Source12: remove-binary-diff.pl
f2c60e
Source15: merge.pl
f2c60e
Source16: mod-extra.list
f2c60e
Source17: mod-extra.sh
f2c60e
Source18: mod-sign.sh
f2c60e
Source90: filter-x86_64.sh
f2c60e
Source91: filter-armv7hl.sh
f2c60e
Source92: filter-i686.sh
f2c60e
Source93: filter-aarch64.sh
f2c60e
Source95: filter-ppc64.sh
f2c60e
Source96: filter-ppc64le.sh
f2c60e
Source97: filter-s390x.sh
f2c60e
Source99: filter-modules.sh
f2c60e
%define modsign_cmd %{SOURCE18}
f2c60e
f2c60e
Source20: kernel-aarch64.config
f2c60e
Source21: kernel-aarch64-debug.config
f2c60e
Source22: kernel-armv7hl.config
f2c60e
Source23: kernel-armv7hl-debug.config
f2c60e
Source24: kernel-armv7hl-lpae.config
f2c60e
Source25: kernel-armv7hl-lpae-debug.config
f2c60e
Source26: kernel-i686.config
f2c60e
Source27: kernel-i686-debug.config
f2c60e
Source28: kernel-i686-PAE.config
f2c60e
Source29: kernel-i686-PAEdebug.config
f2c60e
Source30: kernel-ppc64.config
f2c60e
Source31: kernel-ppc64-debug.config
f2c60e
Source32: kernel-ppc64le.config
f2c60e
Source33: kernel-ppc64le-debug.config
f2c60e
Source36: kernel-s390x.config
f2c60e
Source37: kernel-s390x-debug.config
f2c60e
Source38: kernel-x86_64.config
f2c60e
Source39: kernel-x86_64-debug.config
f2c60e
f2c60e
Source40: generate_all_configs.sh
f2c60e
Source41: generate_debug_configs.sh
f2c60e
f2c60e
Source42: check_configs.awk
f2c60e
f2c60e
# This file is intentionally left empty in the stock kernel. Its a nicety
f2c60e
# added for those wanting to do custom rebuilds with altered config opts.
f2c60e
Source1000: kernel-local
f2c60e
f2c60e
# Sources for kernel-tools
f2c60e
Source2000: cpupower.service
f2c60e
Source2001: cpupower.config
f2c60e
f2c60e
# Here should be only the patches up to the upstream canonical Linus tree.
f2c60e
f2c60e
# For a stable release kernel
f2c60e
%if 0%{?stable_update}
f2c60e
%if 0%{?stable_base}
f2c60e
%define    stable_patch_00  patch-4.%{base_sublevel}.%{stable_base}.xz
f2c60e
Source5000: %{stable_patch_00}
f2c60e
%endif
f2c60e
f2c60e
# non-released_kernel case
f2c60e
# These are automagically defined by the rcrev and gitrev values set up
f2c60e
# near the top of this spec file.
f2c60e
%else
f2c60e
%if 0%{?rcrev}
f2c60e
Source5000: patch-4.%{upstream_sublevel}-rc%{rcrev}.xz
f2c60e
%if 0%{?gitrev}
f2c60e
Source5001: patch-4.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}.xz
f2c60e
%endif
f2c60e
%else
f2c60e
# pre-{base_sublevel+1}-rc1 case
f2c60e
%if 0%{?gitrev}
f2c60e
Source5000: patch-4.%{base_sublevel}-git%{gitrev}.xz
f2c60e
%endif
f2c60e
%endif
f2c60e
%endif
f2c60e
f2c60e
## Patches needed for building this package
f2c60e
f2c60e
# build tweak for build ID magic, even for -vanilla
f2c60e
Patch001: kbuild-AFTER_LINK.patch
f2c60e
f2c60e
## compile fixes
f2c60e
f2c60e
# ongoing complaint, full discussion delayed until ksummit/plumbers
f2c60e
Patch002: 0001-iio-Use-event-header-from-kernel-tree.patch
f2c60e
f2c60e
%if !%{nopatches}
f2c60e
f2c60e
# Git trees.
f2c60e
f2c60e
# Standalone patches
f2c60e
# 100 - Generic long running patches
f2c60e
f2c60e
Patch110: lib-cpumask-Make-CPUMASK_OFFSTACK-usable-without-deb.patch
f2c60e
f2c60e
Patch111: input-kill-stupid-messages.patch
f2c60e
f2c60e
Patch112: die-floppy-die.patch
f2c60e
f2c60e
Patch113: no-pcspkr-modalias.patch
f2c60e
f2c60e
Patch114: silence-fbcon-logo.patch
f2c60e
f2c60e
Patch115: Kbuild-Add-an-option-to-enable-GCC-VTA.patch
f2c60e
f2c60e
Patch116: crash-driver.patch
f2c60e
f2c60e
Patch117: lis3-improve-handling-of-null-rate.patch
f2c60e
f2c60e
Patch118: scsi-sd_revalidate_disk-prevent-NULL-ptr-deref.patch
f2c60e
f2c60e
Patch119: criu-no-expert.patch
f2c60e
f2c60e
Patch120: ath9k-rx-dma-stop-check.patch
f2c60e
f2c60e
Patch122: Input-synaptics-pin-3-touches-when-the-firmware-repo.patch
f2c60e
f2c60e
# This no longer applies, let's see if it needs to be updated
f2c60e
# Patch123: firmware-Drop-WARN-from-usermodehelper_read_trylock-.patch
f2c60e
f2c60e
# 200 - x86 / secureboot
f2c60e
f2c60e
Patch201: efi-lockdown.patch
f2c60e
f2c60e
Patch202: KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch
f2c60e
f2c60e
Patch203: Add-EFI-signature-data-types.patch
f2c60e
f2c60e
Patch204: Add-an-EFI-signature-blob-parser-and-key-loader.patch
f2c60e
f2c60e
Patch205: MODSIGN-Import-certificates-from-UEFI-Secure-Boot.patch
f2c60e
f2c60e
Patch206: MODSIGN-Support-not-importing-certs-from-db.patch
f2c60e
f2c60e
# bz 1497559 - Make kernel MODSIGN code not error on missing variables
f2c60e
Patch207: 0001-Make-get_cert_list-not-complain-about-cert-lists-tha.patch
f2c60e
Patch208: 0002-Add-efi_status_to_str-and-rework-efi_status_to_err.patch
f2c60e
Patch209: 0003-Make-get_cert_list-use-efi_status_to_str-to-print-er.patch
f2c60e
f2c60e
Patch210: disable-i8042-check-on-apple-mac.patch
f2c60e
f2c60e
Patch211: drm-i915-hush-check-crtc-state.patch
f2c60e
f2c60e
# 300 - ARM patches
f2c60e
f2c60e
# Reduces a number of primarily info logs to dmesg
f2c60e
# https://patchwork.freedesktop.org/patch/180737/
f2c60e
# https://patchwork.freedesktop.org/patch/180554/
f2c60e
Patch300: drm-cma-reduce-dmesg-logs.patch
f2c60e
f2c60e
# http://www.spinics.net/lists/linux-tegra/msg26029.html
f2c60e
Patch301: usb-phy-tegra-Add-38.4MHz-clock-table-entry.patch
f2c60e
f2c60e
# Fix OMAP4 (pandaboard)
f2c60e
Patch302: arm-revert-mmc-omap_hsmmc-Use-dma_request_chan-for-reque.patch
f2c60e
f2c60e
# http://patchwork.ozlabs.org/patch/587554/
f2c60e
Patch303: ARM-tegra-usb-no-reset.patch
f2c60e
f2c60e
Patch304: allwinner-net-emac.patch
f2c60e
f2c60e
Patch305: arm64-Revert-allwinner-a64-pine64-Use-dcdc1-regulato.patch
f2c60e
f2c60e
# https://www.spinics.net/lists/arm-kernel/msg554183.html
f2c60e
Patch306: arm-imx6-hummingboard2.patch
f2c60e
f2c60e
Patch307: arm64-Add-option-of-13-for-FORCE_MAX_ZONEORDER.patch
f2c60e
f2c60e
# https://patchwork.kernel.org/patch/9820417/
f2c60e
Patch310: qcom-msm89xx-fixes.patch
f2c60e
f2c60e
# Fix USB on the RPi https://patchwork.kernel.org/patch/9879371/
f2c60e
Patch321: bcm283x-dma-mapping-skip-USB-devices-when-configuring-DMA-during-probe.patch
f2c60e
f2c60e
# bcm2837 bluetooth support
f2c60e
Patch323: bcm2837-bluetooth-support.patch
f2c60e
f2c60e
# Generic fixes and enablement for Socionext SoC and 96board
f2c60e
# https://patchwork.kernel.org/patch/9980861/
f2c60e
#Patch331: PCI-aspm-deal-with-missing-root-ports-in-link-state-handling.patch
f2c60e
f2c60e
# https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/log/?h=synquacer-netsec
f2c60e
Patch332: arm64-socionext-96b-enablement.patch
f2c60e
f2c60e
Patch335: arm-exynos-fix-usb3.patch
f2c60e
f2c60e
# 400 - IBM (ppc/s390x) patches
f2c60e
f2c60e
# 500 - Temp fixes/CVEs etc
f2c60e
f2c60e
# rbhz 1519591 1520764
f2c60e
#Patch500: dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch
f2c60e
f2c60e
# 550-600 Meltdown and Spectre Fixes
f2c60e
#Patch550: prevent-bounds-check-bypass-via-speculative-execution.patch
f2c60e
f2c60e
# 600 - Patches for improved Bay and Cherry Trail device support
f2c60e
# Below patches are submitted upstream, awaiting review / merging
f2c60e
Patch601: 0001-Input-gpio_keys-Allow-suppression-of-input-events-fo.patch
f2c60e
Patch602: 0002-Input-soc_button_array-Suppress-power-button-presses.patch
f2c60e
Patch610: 0010-Input-silead-Add-support-for-capactive-home-button-f.patch
f2c60e
f2c60e
# rhbz 1476467
f2c60e
Patch617: Fix-for-module-sig-verification.patch
f2c60e
f2c60e
# rhbz 1431375
f2c60e
Patch619: input-rmi4-remove-the-need-for-artifical-IRQ.patch
f2c60e
f2c60e
# Headed upstream
f2c60e
Patch621: drm-i915-Boost-GPU-clocks-if-we-miss-the-pageflip-s-vblank.patch
f2c60e
f2c60e
# rhbz 1509461
f2c60e
#Patch625: v3-2-2-Input-synaptics---Lenovo-X1-Carbon-5-should-use-SMBUS-RMI.patch
f2c60e
f2c60e
# Fixes for QXL issues
f2c60e
#Patch627: qxl-fixes.patch
f2c60e
f2c60e
# rhbz 1462175
f2c60e
Patch628: HID-rmi-Check-that-a-device-is-a-RMI-device-before-c.patch
f2c60e
f2c60e
# rhbz 1514969
f2c60e
#Patch633: 0001-platform-x86-dell-laptop-Filter-out-spurious-keyboar.patch
f2c60e
f2c60e
# Fix crash on Xwayland using nouveau
f2c60e
#Patch634: dma-buf-fix-reservation_object_wait_timeout_rcu-once-more-v2.patch
f2c60e
f2c60e
# rhbz 1539238
f2c60e
Patch635: Add-support-for-One-by-Wacom-CTL-472-CTL-672.patch
f2c60e
f2c60e
# CVE-2018-5750 rhbz 1539706 1539708
f2c60e
#Patch636: ACPI-sbshc-remove-raw-pointer-from-printk-message.patch
f2c60e
f2c60e
# rhbz 1492664 1492665
f2c60e
#Patch637: 0001-mm-don-t-warn-about-allocations-which-stall-for-too-.patch
f2c60e
f2c60e
# END OF PATCH DEFINITIONS
f2c60e
f2c60e
%endif
f2c60e
f2c60e
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
f2c60e
f2c60e
%description
f2c60e
The kernel meta package
f2c60e
f2c60e
#
f2c60e
# This macro does requires, provides, conflicts, obsoletes for a kernel package.
f2c60e
#	%%kernel_reqprovconf <subpackage>
f2c60e
# It uses any kernel_<subpackage>_conflicts and kernel_<subpackage>_obsoletes
f2c60e
# macros defined above.
f2c60e
#
f2c60e
%define kernel_reqprovconf \
f2c60e
Provides: kernel = %{rpmversion}-%{pkg_release}\
f2c60e
Provides: kernel-%{_target_cpu} = %{rpmversion}-%{pkg_release}%{?1:+%{1}}\
f2c60e
Provides: kernel-drm-nouveau = 16\
f2c60e
Provides: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
f2c60e
Requires(pre): %{kernel_prereq}\
f2c60e
Requires(pre): %{initrd_prereq}\
f2c60e
Requires(pre): linux-firmware >= 20150904-56.git6ebf5d57\
f2c60e
Requires(preun): systemd >= 200\
f2c60e
Conflicts: xfsprogs < 4.3.0-1\
f2c60e
Conflicts: xorg-x11-drv-vmmouse < 13.0.99\
f2c60e
%{expand:%%{?kernel%{?1:_%{1}}_conflicts:Conflicts: %%{kernel%{?1:_%{1}}_conflicts}}}\
f2c60e
%{expand:%%{?kernel%{?1:_%{1}}_obsoletes:Obsoletes: %%{kernel%{?1:_%{1}}_obsoletes}}}\
f2c60e
%{expand:%%{?kernel%{?1:_%{1}}_provides:Provides: %%{kernel%{?1:_%{1}}_provides}}}\
f2c60e
# We can't let RPM do the dependencies automatic because it'll then pick up\
f2c60e
# a correct but undesirable perl dependency from the module headers which\
f2c60e
# isn't required for the kernel proper to function\
f2c60e
AutoReq: no\
f2c60e
AutoProv: yes\
f2c60e
%{nil}
f2c60e
f2c60e
%package headers
f2c60e
Summary: Header files for the Linux kernel for use by glibc
f2c60e
Group: Development/System
f2c60e
Obsoletes: glibc-kernheaders < 3.0-46
f2c60e
Provides: glibc-kernheaders = 3.0-46
f2c60e
%if "0%{?variant}"
f2c60e
Obsoletes: kernel-headers < %{rpmversion}-%{pkg_release}
f2c60e
Provides: kernel-headers = %{rpmversion}-%{pkg_release}
f2c60e
%endif
f2c60e
%description headers
f2c60e
Kernel-headers includes the C header files that specify the interface
f2c60e
between the Linux kernel and userspace libraries and programs.  The
f2c60e
header files define structures and constants that are needed for
f2c60e
building most standard programs and are also needed for rebuilding the
f2c60e
glibc package.
f2c60e
f2c60e
%package cross-headers
f2c60e
Summary: Header files for the Linux kernel for use by cross-glibc
f2c60e
Group: Development/System
f2c60e
%description cross-headers
f2c60e
Kernel-cross-headers includes the C header files that specify the interface
f2c60e
between the Linux kernel and userspace libraries and programs.  The
f2c60e
header files define structures and constants that are needed for
f2c60e
building most standard programs and are also needed for rebuilding the
f2c60e
cross-glibc package.
f2c60e
f2c60e
f2c60e
%package bootwrapper
f2c60e
Summary: Boot wrapper files for generating combined kernel + initrd images
f2c60e
Group: Development/System
f2c60e
Requires: gzip binutils
f2c60e
%description bootwrapper
f2c60e
Kernel-bootwrapper contains the wrapper code which makes bootable "zImage"
f2c60e
files combining both kernel and initial ramdisk.
f2c60e
f2c60e
%package debuginfo-common-%{_target_cpu}
f2c60e
Summary: Kernel source files used by %{name}-debuginfo packages
f2c60e
Group: Development/Debug
f2c60e
Provides: installonlypkg(kernel)
f2c60e
%description debuginfo-common-%{_target_cpu}
f2c60e
This package is required by %{name}-debuginfo subpackages.
f2c60e
It provides the kernel source files common to all builds.
f2c60e
f2c60e
%if %{with_perf}
f2c60e
%package -n perf
f2c60e
Summary: Performance monitoring for the Linux kernel
f2c60e
Group: Development/System
f2c60e
License: GPLv2
f2c60e
%description -n perf
f2c60e
This package contains the perf tool, which enables performance monitoring
f2c60e
of the Linux kernel.
f2c60e
f2c60e
%package -n perf-debuginfo
f2c60e
Summary: Debug information for package perf
f2c60e
Group: Development/Debug
f2c60e
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
f2c60e
AutoReqProv: no
f2c60e
%description -n perf-debuginfo
f2c60e
This package provides debug information for the perf package.
f2c60e
f2c60e
# Note that this pattern only works right to match the .build-id
f2c60e
# symlinks because of the trailing nonmatching alternation and
f2c60e
# the leading .*, because of find-debuginfo.sh's buggy handling
f2c60e
# of matching the pattern against the symlinks file.
f2c60e
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|.*%%{_libdir}/traceevent/plugins/.*|XXX' -o perf-debuginfo.list}
f2c60e
f2c60e
%package -n python-perf
f2c60e
Summary: Python bindings for apps which will manipulate perf events
f2c60e
Group: Development/Libraries
f2c60e
%description -n python-perf
f2c60e
The python-perf package contains a module that permits applications
f2c60e
written in the Python programming language to use the interface
f2c60e
to manipulate perf events.
f2c60e
f2c60e
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
f2c60e
f2c60e
%package -n python-perf-debuginfo
f2c60e
Summary: Debug information for package perf python bindings
f2c60e
Group: Development/Debug
f2c60e
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
f2c60e
AutoReqProv: no
f2c60e
%description -n python-perf-debuginfo
f2c60e
This package provides debug information for the perf python bindings.
f2c60e
f2c60e
# the python_sitearch macro should already be defined from above
f2c60e
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{python_sitearch}/perf.so(\.debug)?|XXX' -o python-perf-debuginfo.list}
f2c60e
f2c60e
f2c60e
%endif # with_perf
f2c60e
f2c60e
%if %{with_tools}
f2c60e
%package -n kernel-tools
f2c60e
Summary: Assortment of tools for the Linux kernel
f2c60e
Group: Development/System
f2c60e
License: GPLv2
f2c60e
Provides:  cpupowerutils = 1:009-0.6.p1
f2c60e
Obsoletes: cpupowerutils < 1:009-0.6.p1
f2c60e
Provides:  cpufreq-utils = 1:009-0.6.p1
f2c60e
Provides:  cpufrequtils = 1:009-0.6.p1
f2c60e
Obsoletes: cpufreq-utils < 1:009-0.6.p1
f2c60e
Obsoletes: cpufrequtils < 1:009-0.6.p1
f2c60e
Obsoletes: cpuspeed < 1:1.5-16
f2c60e
Requires: kernel-tools-libs = %{version}-%{release}
f2c60e
%define __requires_exclude ^%{_bindir}/python
f2c60e
%description -n kernel-tools
f2c60e
This package contains the tools/ directory from the kernel source
f2c60e
and the supporting documentation.
f2c60e
f2c60e
%package -n kernel-tools-libs
f2c60e
Summary: Libraries for the kernels-tools
f2c60e
Group: Development/System
f2c60e
License: GPLv2
f2c60e
%description -n kernel-tools-libs
f2c60e
This package contains the libraries built from the tools/ directory
f2c60e
from the kernel source.
f2c60e
f2c60e
%package -n kernel-tools-libs-devel
f2c60e
Summary: Assortment of tools for the Linux kernel
f2c60e
Group: Development/System
f2c60e
License: GPLv2
f2c60e
Requires: kernel-tools = %{version}-%{release}
f2c60e
Provides:  cpupowerutils-devel = 1:009-0.6.p1
f2c60e
Obsoletes: cpupowerutils-devel < 1:009-0.6.p1
f2c60e
Requires: kernel-tools-libs = %{version}-%{release}
f2c60e
Provides: kernel-tools-devel
f2c60e
%description -n kernel-tools-libs-devel
f2c60e
This package contains the development files for the tools/ directory from
f2c60e
the kernel source.
f2c60e
f2c60e
%package -n kernel-tools-debuginfo
f2c60e
Summary: Debug information for package kernel-tools
f2c60e
Group: Development/Debug
f2c60e
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
f2c60e
AutoReqProv: no
f2c60e
%description -n kernel-tools-debuginfo
f2c60e
This package provides debug information for package kernel-tools.
f2c60e
f2c60e
# Note that this pattern only works right to match the .build-id
f2c60e
# symlinks because of the trailing nonmatching alternation and
f2c60e
# the leading .*, because of find-debuginfo.sh's buggy handling
f2c60e
# of matching the pattern against the symlinks file.
f2c60e
%{expand:%%global debuginfo_args %{?debuginfo_args} -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}
f2c60e
f2c60e
%endif # with_tools
f2c60e
f2c60e
f2c60e
#
f2c60e
# This macro creates a kernel-<subpackage>-debuginfo package.
f2c60e
#	%%kernel_debuginfo_package <subpackage>
f2c60e
#
f2c60e
%define kernel_debuginfo_package() \
f2c60e
%package %{?1:%{1}-}debuginfo\
f2c60e
Summary: Debug information for package %{name}%{?1:-%{1}}\
f2c60e
Group: Development/Debug\
f2c60e
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}\
f2c60e
Provides: %{name}%{?1:-%{1}}-debuginfo-%{_target_cpu} = %{version}-%{release}\
f2c60e
Provides: installonlypkg(kernel)\
f2c60e
AutoReqProv: no\
f2c60e
%description %{?1:%{1}-}debuginfo\
f2c60e
This package provides debug information for package %{name}%{?1:-%{1}}.\
f2c60e
This is required to use SystemTap with %{name}%{?1:-%{1}}-%{KVERREL}.\
f2c60e
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '/.*/%%{KVERREL}%{?1:[+]%{1}}/.*|/.*%%{KVERREL}%{?1:\+%{1}}(\.debug)?' -o debuginfo%{?1}.list}\
f2c60e
%{nil}
f2c60e
f2c60e
#
f2c60e
# This macro creates a kernel-<subpackage>-devel package.
f2c60e
#	%%kernel_devel_package <subpackage> <pretty-name>
f2c60e
#
f2c60e
%define kernel_devel_package() \
f2c60e
%package %{?1:%{1}-}devel\
f2c60e
Summary: Development package for building kernel modules to match the %{?2:%{2} }kernel\
f2c60e
Group: System Environment/Kernel\
f2c60e
Provides: kernel%{?1:-%{1}}-devel-%{_target_cpu} = %{version}-%{release}\
f2c60e
Provides: kernel-devel-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
f2c60e
Provides: kernel-devel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
f2c60e
Provides: installonlypkg(kernel)\
f2c60e
AutoReqProv: no\
f2c60e
Requires(pre): findutils\
f2c60e
Requires: findutils\
f2c60e
Requires: perl\
f2c60e
%description %{?1:%{1}-}devel\
f2c60e
This package provides kernel headers and makefiles sufficient to build modules\
f2c60e
against the %{?2:%{2} }kernel package.\
f2c60e
%{nil}
f2c60e
f2c60e
#
f2c60e
# This macro creates a kernel-<subpackage>-modules-extra package.
f2c60e
#	%%kernel_modules_extra_package <subpackage> <pretty-name>
f2c60e
#
f2c60e
%define kernel_modules_extra_package() \
f2c60e
%package %{?1:%{1}-}modules-extra\
f2c60e
Summary: Extra kernel modules to match the %{?2:%{2} }kernel\
f2c60e
Group: System Environment/Kernel\
f2c60e
Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}\
f2c60e
Provides: kernel%{?1:-%{1}}-modules-extra-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
f2c60e
Provides: kernel%{?1:-%{1}}-modules-extra = %{version}-%{release}%{?1:+%{1}}\
f2c60e
Provides: installonlypkg(kernel-module)\
f2c60e
Provides: kernel%{?1:-%{1}}-modules-extra-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
f2c60e
Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
f2c60e
Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
f2c60e
AutoReq: no\
f2c60e
AutoProv: yes\
f2c60e
%description %{?1:%{1}-}modules-extra\
f2c60e
This package provides less commonly used kernel modules for the %{?2:%{2} }kernel package.\
f2c60e
%{nil}
f2c60e
f2c60e
#
f2c60e
# This macro creates a kernel-<subpackage>-modules package.
f2c60e
#	%%kernel_modules_package <subpackage> <pretty-name>
f2c60e
#
f2c60e
%define kernel_modules_package() \
f2c60e
%package %{?1:%{1}-}modules\
f2c60e
Summary: kernel modules to match the %{?2:%{2}-}core kernel\
f2c60e
Group: System Environment/Kernel\
f2c60e
Provides: kernel%{?1:-%{1}}-modules-%{_target_cpu} = %{version}-%{release}\
f2c60e
Provides: kernel-modules-%{_target_cpu} = %{version}-%{release}%{?1:+%{1}}\
f2c60e
Provides: kernel-modules = %{version}-%{release}%{?1:+%{1}}\
f2c60e
Provides: installonlypkg(kernel-module)\
f2c60e
Provides: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
f2c60e
Requires: kernel-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
f2c60e
AutoReq: no\
f2c60e
AutoProv: yes\
f2c60e
%description %{?1:%{1}-}modules\
f2c60e
This package provides commonly used kernel modules for the %{?2:%{2}-}core kernel package.\
f2c60e
%{nil}
f2c60e
f2c60e
#
f2c60e
# this macro creates a kernel-<subpackage> meta package.
f2c60e
#	%%kernel_meta_package <subpackage>
f2c60e
#
f2c60e
%define kernel_meta_package() \
f2c60e
%package %{1}\
f2c60e
summary: kernel meta-package for the %{1} kernel\
f2c60e
group: system environment/kernel\
f2c60e
Requires: kernel-%{1}-core-uname-r = %{KVERREL}%{?variant}+%{1}\
f2c60e
Requires: kernel-%{1}-modules-uname-r = %{KVERREL}%{?variant}+%{1}\
f2c60e
Provides: installonlypkg(kernel)\
f2c60e
%description %{1}\
f2c60e
The meta-package for the %{1} kernel\
f2c60e
%{nil}
f2c60e
f2c60e
#
f2c60e
# This macro creates a kernel-<subpackage> and its -devel and -debuginfo too.
f2c60e
#	%%define variant_summary The Linux kernel compiled for <configuration>
f2c60e
#	%%kernel_variant_package [-n <pretty-name>] <subpackage>
f2c60e
#
f2c60e
%define kernel_variant_package(n:) \
f2c60e
%package %{?1:%{1}-}core\
f2c60e
Summary: %{variant_summary}\
f2c60e
Group: System Environment/Kernel\
f2c60e
Provides: kernel-%{?1:%{1}-}core-uname-r = %{KVERREL}%{?variant}%{?1:+%{1}}\
f2c60e
Provides: installonlypkg(kernel)\
f2c60e
%{expand:%%kernel_reqprovconf}\
f2c60e
%if %{?1:1} %{!?1:0} \
f2c60e
%{expand:%%kernel_meta_package %{?1:%{1}}}\
f2c60e
%endif\
f2c60e
%{expand:%%kernel_devel_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
f2c60e
%{expand:%%kernel_modules_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
f2c60e
%{expand:%%kernel_modules_extra_package %{?1:%{1}} %{!?{-n}:%{1}}%{?{-n}:%{-n*}}}\
f2c60e
%{expand:%%kernel_debuginfo_package %{?1:%{1}}}\
f2c60e
%{nil}
f2c60e
f2c60e
# Now, each variant package.
f2c60e
f2c60e
%ifnarch armv7hl
f2c60e
%define variant_summary The Linux kernel compiled for PAE capable machines
f2c60e
%kernel_variant_package %{pae}
f2c60e
%description %{pae}-core
f2c60e
This package includes a version of the Linux kernel with support for up to
f2c60e
64GB of high memory. It requires a CPU with Physical Address Extensions (PAE).
f2c60e
The non-PAE kernel can only address up to 4GB of memory.
f2c60e
Install the kernel-PAE package if your machine has more than 4GB of memory.
f2c60e
%else
f2c60e
%define variant_summary The Linux kernel compiled for Cortex-A15
f2c60e
%kernel_variant_package %{pae}
f2c60e
%description %{pae}-core
f2c60e
This package includes a version of the Linux kernel with support for
f2c60e
Cortex-A15 devices with LPAE and HW virtualisation support
f2c60e
%endif
f2c60e
f2c60e
f2c60e
%define variant_summary The Linux kernel compiled with extra debugging enabled for PAE capable machines
f2c60e
%kernel_variant_package %{pae}debug
f2c60e
Obsoletes: kernel-PAE-debug
f2c60e
%description %{pae}debug-core
f2c60e
This package includes a version of the Linux kernel with support for up to
f2c60e
64GB of high memory. It requires a CPU with Physical Address Extensions (PAE).
f2c60e
The non-PAE kernel can only address up to 4GB of memory.
f2c60e
Install the kernel-PAE package if your machine has more than 4GB of memory.
f2c60e
f2c60e
This variant of the kernel has numerous debugging options enabled.
f2c60e
It should only be installed when trying to gather additional information
f2c60e
on kernel bugs, as some of these options impact performance noticably.
f2c60e
f2c60e
f2c60e
%define variant_summary The Linux kernel compiled with extra debugging enabled
f2c60e
%kernel_variant_package debug
f2c60e
%description debug-core
f2c60e
The kernel package contains the Linux kernel (vmlinuz), the core of any
f2c60e
Linux operating system.  The kernel handles the basic functions
f2c60e
of the operating system:  memory allocation, process allocation, device
f2c60e
input and output, etc.
f2c60e
f2c60e
This variant of the kernel has numerous debugging options enabled.
f2c60e
It should only be installed when trying to gather additional information
f2c60e
on kernel bugs, as some of these options impact performance noticably.
f2c60e
f2c60e
# And finally the main -core package
f2c60e
f2c60e
%define variant_summary The Linux kernel
f2c60e
%kernel_variant_package
f2c60e
%description core
f2c60e
The kernel package contains the Linux kernel (vmlinuz), the core of any
f2c60e
Linux operating system.  The kernel handles the basic functions
f2c60e
of the operating system: memory allocation, process allocation, device
f2c60e
input and output, etc.
f2c60e
f2c60e
f2c60e
%prep
f2c60e
# do a few sanity-checks for --with *only builds
f2c60e
%if %{with_baseonly}
f2c60e
%if !%{with_up}%{with_pae}
f2c60e
echo "Cannot build --with baseonly, up build is disabled"
f2c60e
exit 1
f2c60e
%endif
f2c60e
%endif
f2c60e
f2c60e
%if "%{baserelease}" == "0"
f2c60e
echo "baserelease must be greater than zero"
f2c60e
exit 1
f2c60e
%endif
f2c60e
f2c60e
# more sanity checking; do it quietly
f2c60e
if [ "%{patches}" != "%%{patches}" ] ; then
f2c60e
  for patch in %{patches} ; do
f2c60e
    if [ ! -f $patch ] ; then
f2c60e
      echo "ERROR: Patch  ${patch##/*/}  listed in specfile but is missing"
f2c60e
      exit 1
f2c60e
    fi
f2c60e
  done
f2c60e
fi 2>/dev/null
f2c60e
f2c60e
patch_command='patch -p1 -F1 -s'
f2c60e
ApplyPatch()
f2c60e
{
f2c60e
  local patch=$1
f2c60e
  shift
f2c60e
  if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
f2c60e
    exit 1
f2c60e
  fi
f2c60e
  if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME%%%%%{?variant}}.spec ; then
f2c60e
    if [ "${patch:0:8}" != "patch-4." ] ; then
f2c60e
      echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
f2c60e
      exit 1
f2c60e
    fi
f2c60e
  fi 2>/dev/null
f2c60e
  case "$patch" in
f2c60e
  *.bz2) bunzip2 < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
f2c60e
  *.gz)  gunzip  < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
f2c60e
  *.xz)  unxz    < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
f2c60e
  *) $patch_command ${1+"$@"} < "$RPM_SOURCE_DIR/$patch" ;;
f2c60e
  esac
f2c60e
}
f2c60e
f2c60e
# don't apply patch if it's empty
f2c60e
ApplyOptionalPatch()
f2c60e
{
f2c60e
  local patch=$1
f2c60e
  shift
f2c60e
  if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
f2c60e
    exit 1
f2c60e
  fi
f2c60e
  local C=$(wc -l $RPM_SOURCE_DIR/$patch | awk '{print $1}')
f2c60e
  if [ "$C" -gt 9 ]; then
f2c60e
    ApplyPatch $patch ${1+"$@"}
f2c60e
  fi
f2c60e
}
f2c60e
f2c60e
# First we unpack the kernel tarball.
f2c60e
# If this isn't the first make prep, we use links to the existing clean tarball
f2c60e
# which speeds things up quite a bit.
f2c60e
f2c60e
# Update to latest upstream.
f2c60e
%if 0%{?released_kernel}
f2c60e
%define vanillaversion 4.%{base_sublevel}
f2c60e
# non-released_kernel case
f2c60e
%else
f2c60e
%if 0%{?rcrev}
f2c60e
%define vanillaversion 4.%{upstream_sublevel}-rc%{rcrev}
f2c60e
%if 0%{?gitrev}
f2c60e
%define vanillaversion 4.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}
f2c60e
%endif
f2c60e
%else
f2c60e
# pre-{base_sublevel+1}-rc1 case
f2c60e
%if 0%{?gitrev}
f2c60e
%define vanillaversion 4.%{base_sublevel}-git%{gitrev}
f2c60e
%else
f2c60e
%define vanillaversion 4.%{base_sublevel}
f2c60e
%endif
f2c60e
%endif
f2c60e
%endif
f2c60e
f2c60e
# %%{vanillaversion} : the full version name, e.g. 2.6.35-rc6-git3
f2c60e
# %%{kversion}       : the base version, e.g. 2.6.34
f2c60e
f2c60e
# Use kernel-%%{kversion}%%{?dist} as the top-level directory name
f2c60e
# so we can prep different trees within a single git directory.
f2c60e
f2c60e
# Build a list of the other top-level kernel tree directories.
f2c60e
# This will be used to hardlink identical vanilla subdirs.
f2c60e
sharedirs=$(find "$PWD" -maxdepth 1 -type d -name 'kernel-4.*' \
f2c60e
            | grep -x -v "$PWD"/kernel-%{kversion}%{?dist}) ||:
f2c60e
f2c60e
# Delete all old stale trees.
f2c60e
if [ -d kernel-%{kversion}%{?dist} ]; then
f2c60e
  cd kernel-%{kversion}%{?dist}
f2c60e
  for i in linux-*
f2c60e
  do
f2c60e
     if [ -d $i ]; then
f2c60e
       # Just in case we ctrl-c'd a prep already
f2c60e
       rm -rf deleteme.%{_target_cpu}
f2c60e
       # Move away the stale away, and delete in background.
f2c60e
       mv $i deleteme-$i
f2c60e
       rm -rf deleteme* &
f2c60e
     fi
f2c60e
  done
f2c60e
  cd ..
f2c60e
fi
f2c60e
f2c60e
# Generate new tree
f2c60e
if [ ! -d kernel-%{kversion}%{?dist}/vanilla-%{vanillaversion} ]; then
f2c60e
f2c60e
  if [ -d kernel-%{kversion}%{?dist}/vanilla-%{kversion} ]; then
f2c60e
f2c60e
    # The base vanilla version already exists.
f2c60e
    cd kernel-%{kversion}%{?dist}
f2c60e
f2c60e
    # Any vanilla-* directories other than the base one are stale.
f2c60e
    for dir in vanilla-*; do
f2c60e
      [ "$dir" = vanilla-%{kversion} ] || rm -rf $dir &
f2c60e
    done
f2c60e
f2c60e
  else
f2c60e
f2c60e
    rm -f pax_global_header
f2c60e
    # Look for an identical base vanilla dir that can be hardlinked.
f2c60e
    for sharedir in $sharedirs ; do
f2c60e
      if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{kversion} ]] ; then
f2c60e
        break
f2c60e
      fi
f2c60e
    done
f2c60e
    if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{kversion} ]] ; then
f2c60e
%setup -q -n kernel-%{kversion}%{?dist} -c -T
f2c60e
      cp -al $sharedir/vanilla-%{kversion} .
f2c60e
    else
f2c60e
%setup -q -n kernel-%{kversion}%{?dist} -c
f2c60e
      mv linux-%{kversion} vanilla-%{kversion}
f2c60e
    fi
f2c60e
f2c60e
  fi
f2c60e
f2c60e
%if "%{kversion}" != "%{vanillaversion}"
f2c60e
f2c60e
  for sharedir in $sharedirs ; do
f2c60e
    if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{vanillaversion} ]] ; then
f2c60e
      break
f2c60e
    fi
f2c60e
  done
f2c60e
  if [[ ! -z $sharedir  &&  -d $sharedir/vanilla-%{vanillaversion} ]] ; then
f2c60e
f2c60e
    cp -al $sharedir/vanilla-%{vanillaversion} .
f2c60e
f2c60e
  else
f2c60e
f2c60e
    # Need to apply patches to the base vanilla version.
f2c60e
    cp -al vanilla-%{kversion} vanilla-%{vanillaversion}
f2c60e
    cd vanilla-%{vanillaversion}
f2c60e
f2c60e
cp %{SOURCE12} .
f2c60e
f2c60e
# Update vanilla to the latest upstream.
f2c60e
# (non-released_kernel case only)
f2c60e
%if 0%{?rcrev}
f2c60e
    xzcat %{SOURCE5000} | ./remove-binary-diff.pl | patch -p1 -F1 -s
f2c60e
%if 0%{?gitrev}
f2c60e
    xzcat %{SOURCE5001} | ./remove-binary-diff.pl | patch -p1 -F1 -s
f2c60e
%endif
f2c60e
%else
f2c60e
# pre-{base_sublevel+1}-rc1 case
f2c60e
%if 0%{?gitrev}
f2c60e
    xzcat %{SOURCE5000} | ./remove-binary-diff.pl | patch -p1 -F1 -s
f2c60e
%endif
f2c60e
%endif
f2c60e
    git init
f2c60e
    git config user.email "noreply@centos.org"
f2c60e
    git config user.name "AltArch Kernel"
f2c60e
    git config gc.auto 0
f2c60e
    git add .
f2c60e
    git commit -a -q -m "baseline"
f2c60e
f2c60e
    cd ..
f2c60e
f2c60e
  fi
f2c60e
f2c60e
%endif
f2c60e
f2c60e
else
f2c60e
f2c60e
  # We already have all vanilla dirs, just change to the top-level directory.
f2c60e
  cd kernel-%{kversion}%{?dist}
f2c60e
f2c60e
fi
f2c60e
f2c60e
# Now build the fedora kernel tree.
f2c60e
cp -al vanilla-%{vanillaversion} linux-%{KVERREL}
f2c60e
f2c60e
cd linux-%{KVERREL}
f2c60e
if [ ! -d .git ]; then
f2c60e
    git init
f2c60e
    git config user.email "noreply@centos.org"
f2c60e
    git config user.name "AltArch Kernel"
f2c60e
    git config gc.auto 0
f2c60e
    git add .
f2c60e
    git commit -a -q -m "baseline"
f2c60e
fi
f2c60e
f2c60e
f2c60e
# released_kernel with possible stable updates
f2c60e
%if 0%{?stable_base}
f2c60e
# This is special because the kernel spec is hell and nothing is consistent
f2c60e
xzcat %{SOURCE5000} | patch -p1 -F1 -s
f2c60e
git commit -a -m "Stable update"
f2c60e
%endif
f2c60e
f2c60e
# Drop some necessary files from the source dir into the buildroot
f2c60e
cp $RPM_SOURCE_DIR/kernel-*.config .
f2c60e
cp %{SOURCE1000} .
f2c60e
cp %{SOURCE15} .
f2c60e
cp %{SOURCE40} .
f2c60e
cp %{SOURCE41} .
f2c60e
f2c60e
%if !%{debugbuildsenabled}
f2c60e
# The normal build is a really debug build and the user has explicitly requested
f2c60e
# a release kernel. Change the config files into non-debug versions.
f2c60e
%if !%{with_release}
f2c60e
VERSION=%{version} ./generate_debug_configs.sh
f2c60e
%else
f2c60e
VERSION=%{version} ./generate_all_configs.sh
f2c60e
%endif
f2c60e
f2c60e
%else
f2c60e
VERSION=%{version} ./generate_all_configs.sh
f2c60e
%endif
f2c60e
f2c60e
# Merge in any user-provided local config option changes
f2c60e
%ifnarch %nobuildarches
f2c60e
for i in %{all_arch_configs}
f2c60e
do
f2c60e
  mv $i $i.tmp
f2c60e
  ./merge.pl %{SOURCE1000} $i.tmp > $i
f2c60e
  rm $i.tmp
f2c60e
done
f2c60e
%endif
f2c60e
f2c60e
# Note: Even in the "nopatches" path some patches (build tweaks and compile
f2c60e
# fixes) will always get applied; see patch defition above for details
f2c60e
f2c60e
git am %{patches}
f2c60e
f2c60e
# END OF PATCH APPLICATIONS
f2c60e
f2c60e
# Any further pre-build tree manipulations happen here.
f2c60e
f2c60e
chmod +x scripts/checkpatch.pl
f2c60e
chmod +x tools/objtool/sync-check.sh
f2c60e
f2c60e
# This Prevents scripts/setlocalversion from mucking with our version numbers.
f2c60e
touch .scmversion
f2c60e
f2c60e
# only deal with configs if we are going to build for the arch
f2c60e
%ifnarch %nobuildarches
f2c60e
f2c60e
mkdir configs
f2c60e
f2c60e
%if !%{debugbuildsenabled}
f2c60e
rm -f kernel-%{version}-*debug.config
f2c60e
%endif
f2c60e
f2c60e
%define make make %{?cross_opts}
f2c60e
f2c60e
CheckConfigs() {
f2c60e
     ./check_configs.awk $1 $2 > .mismatches
f2c60e
     if [ -s .mismatches ]
f2c60e
     then
f2c60e
	echo "Error: Mismatches found in configuration files"
f2c60e
	cat .mismatches
f2c60e
	exit 1
f2c60e
     fi
f2c60e
}
f2c60e
f2c60e
cp %{SOURCE42} .
f2c60e
# now run oldconfig over all the config files
f2c60e
for i in *.config
f2c60e
do
f2c60e
  cat $i > temp-$i
f2c60e
  mv $i .config
f2c60e
  Arch=`head -1 .config | cut -b 3-`
f2c60e
  make ARCH=$Arch listnewconfig | grep -E '^CONFIG_' >.newoptions || true
f2c60e
%if %{listnewconfig_fail}
f2c60e
  if [ -s .newoptions ]; then
f2c60e
    cat .newoptions
f2c60e
    exit 1
f2c60e
  fi
f2c60e
%endif
f2c60e
  rm -f .newoptions
f2c60e
  make ARCH=$Arch oldnoconfig
f2c60e
  echo "# $Arch" > configs/$i
f2c60e
  cat .config >> configs/$i
f2c60e
%if %{configmismatch_fail}
f2c60e
  CheckConfigs configs/$i temp-$i
f2c60e
%endif
f2c60e
  rm temp-$i
f2c60e
done
f2c60e
# end of kernel config
f2c60e
%endif
f2c60e
f2c60e
# get rid of unwanted files resulting from patch fuzz
f2c60e
find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null
f2c60e
f2c60e
# remove unnecessary SCM files
f2c60e
find . -name .gitignore -exec rm -f {} \; >/dev/null
f2c60e
f2c60e
cd ..
f2c60e
f2c60e
###
f2c60e
### build
f2c60e
###
f2c60e
%build
f2c60e
f2c60e
%if %{with_sparse}
f2c60e
%define sparse_mflags	C=1
f2c60e
%endif
f2c60e
f2c60e
%if %{with_debuginfo}
f2c60e
# This override tweaks the kernel makefiles so that we run debugedit on an
f2c60e
# object before embedding it.  When we later run find-debuginfo.sh, it will
f2c60e
# run debugedit again.  The edits it does change the build ID bits embedded
f2c60e
# in the stripped object, but repeating debugedit is a no-op.  We do it
f2c60e
# beforehand to get the proper final build ID bits into the embedded image.
f2c60e
# This affects the vDSO images in vmlinux, and the vmlinux image in bzImage.
f2c60e
export AFTER_LINK=\
f2c60e
'sh -xc "/usr/lib/rpm/debugedit -b $$RPM_BUILD_DIR -d /usr/src/debug \
f2c60e
                                -i $@ > $@.id"'
f2c60e
%endif
f2c60e
f2c60e
cp_vmlinux()
f2c60e
{
f2c60e
  eu-strip --remove-comment -o "$2" "$1"
f2c60e
}
f2c60e
f2c60e
BuildKernel() {
f2c60e
    MakeTarget=$1
f2c60e
    KernelImage=$2
f2c60e
    Flavour=$4
f2c60e
    DoVDSO=$3
f2c60e
    Flav=${Flavour:++${Flavour}}
f2c60e
    InstallName=${5:-vmlinuz}
f2c60e
f2c60e
    # Pick the right config file for the kernel we're building
f2c60e
    Config=kernel-%{version}-%{_target_cpu}${Flavour:+-${Flavour}}.config
f2c60e
    DevelDir=/usr/src/kernels/%{KVERREL}${Flav}
f2c60e
f2c60e
    # When the bootable image is just the ELF kernel, strip it.
f2c60e
    # We already copy the unstripped file into the debuginfo package.
f2c60e
    if [ "$KernelImage" = vmlinux ]; then
f2c60e
      CopyKernel=cp_vmlinux
f2c60e
    else
f2c60e
      CopyKernel=cp
f2c60e
    fi
f2c60e
f2c60e
    KernelVer=%{version}-%{release}.%{_target_cpu}${Flav}
f2c60e
    echo BUILDING A KERNEL FOR ${Flavour} %{_target_cpu}...
f2c60e
f2c60e
    %if 0%{?stable_update}
f2c60e
    # make sure SUBLEVEL is incremented on a stable release.  Sigh 3.x.
f2c60e
    perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{?stablerev}/" Makefile
f2c60e
    %endif
f2c60e
f2c60e
    # make sure EXTRAVERSION says what we want it to say
f2c60e
    perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.%{_target_cpu}${Flav}/" Makefile
f2c60e
f2c60e
    # if pre-rc1 devel kernel, must fix up PATCHLEVEL for our versioning scheme
f2c60e
    %if !0%{?rcrev}
f2c60e
    %if 0%{?gitrev}
f2c60e
    perl -p -i -e 's/^PATCHLEVEL.*/PATCHLEVEL = %{upstream_sublevel}/' Makefile
f2c60e
    %endif
f2c60e
    %endif
f2c60e
f2c60e
    # and now to start the build process
f2c60e
f2c60e
    make -s mrproper
f2c60e
    cp configs/$Config .config
f2c60e
f2c60e
    %if %{signkernel}%{signmodules}
f2c60e
    cp %{SOURCE11} certs/.
f2c60e
    %endif
f2c60e
f2c60e
    Arch=`head -1 .config | cut -b 3-`
f2c60e
    echo USING ARCH=$Arch
f2c60e
f2c60e
    make -s ARCH=$Arch oldnoconfig >/dev/null
f2c60e
    %{make} -s ARCH=$Arch V=1 %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags}
f2c60e
    %{make} -s ARCH=$Arch V=1 %{?_smp_mflags} modules %{?sparse_mflags} || exit 1
f2c60e
f2c60e
    mkdir -p $RPM_BUILD_ROOT/%{image_install_path}
f2c60e
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
f2c60e
%if %{with_debuginfo}
f2c60e
    mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/%{image_install_path}
f2c60e
%endif
f2c60e
f2c60e
%ifarch %{arm} aarch64
f2c60e
    %{make} -s ARCH=$Arch V=1 dtbs dtbs_install INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer
f2c60e
    cp -r $RPM_BUILD_ROOT/%{image_install_path}/dtb-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/dtb
f2c60e
    find arch/$Arch/boot/dts -name '*.dtb' -type f | xargs rm -f
f2c60e
%endif
f2c60e
f2c60e
    # Start installing the results
f2c60e
    install -m 644 .config $RPM_BUILD_ROOT/boot/config-$KernelVer
f2c60e
    install -m 644 .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/config
f2c60e
    install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-$KernelVer
f2c60e
    install -m 644 System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/System.map
f2c60e
f2c60e
    # We estimate the size of the initramfs because rpm needs to take this size
f2c60e
    # into consideration when performing disk space calculations. (See bz #530778)
f2c60e
    dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initramfs-$KernelVer.img bs=1M count=20
f2c60e
f2c60e
    if [ -f arch/$Arch/boot/zImage.stub ]; then
f2c60e
      cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/%{image_install_path}/zImage.stub-$KernelVer || :
f2c60e
      cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/lib/modules/$KernelVer/zImage.stub-$KernelVer || :
f2c60e
    fi
f2c60e
    %if %{signkernel}
f2c60e
    # Sign the image if we're using EFI
f2c60e
    %pesign -s -i $KernelImage -o vmlinuz.signed
f2c60e
    if [ ! -s vmlinuz.signed ]; then
f2c60e
        echo "pesigning failed"
f2c60e
        exit 1
f2c60e
    fi
f2c60e
    mv vmlinuz.signed $KernelImage
f2c60e
    %endif
f2c60e
    $CopyKernel $KernelImage \
f2c60e
                $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
f2c60e
    chmod 755 $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
f2c60e
    cp $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer $RPM_BUILD_ROOT/lib/modules/$KernelVer/$InstallName
f2c60e
f2c60e
    # hmac sign the kernel for FIPS
f2c60e
    echo "Creating hmac file: $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac"
f2c60e
    ls -l $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
f2c60e
    sha512hmac $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer | sed -e "s,$RPM_BUILD_ROOT,," > $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac;
f2c60e
    cp $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac $RPM_BUILD_ROOT/lib/modules/$KernelVer/.vmlinuz.hmac
f2c60e
f2c60e
    # Override $(mod-fw) because we don't want it to install any firmware
f2c60e
    # we'll get it from the linux-firmware package and we don't want conflicts
f2c60e
    %{make} -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw=
f2c60e
f2c60e
    if [ $DoVDSO -ne 0 ]; then
f2c60e
        %{make} -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer
f2c60e
        if [ ! -s ldconfig-kernel.conf ]; then
f2c60e
          echo > ldconfig-kernel.conf "\
f2c60e
    # Placeholder file, no vDSO hwcap entries used in this kernel."
f2c60e
        fi
f2c60e
        %{__install} -D -m 444 ldconfig-kernel.conf \
f2c60e
            $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-$KernelVer.conf
f2c60e
        rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/vdso/.build-id
f2c60e
    fi
f2c60e
f2c60e
    # And save the headers/makefiles etc for building modules against
f2c60e
    #
f2c60e
    # This all looks scary, but the end result is supposed to be:
f2c60e
    # * all arch relevant include/ files
f2c60e
    # * all Makefile/Kconfig files
f2c60e
    # * all script/ files
f2c60e
f2c60e
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
f2c60e
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/source
f2c60e
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
f2c60e
    (cd $RPM_BUILD_ROOT/lib/modules/$KernelVer ; ln -s build source)
f2c60e
    # dirs for additional modules per module-init-tools, kbuild/modules.txt
f2c60e
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/extra
f2c60e
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/updates
f2c60e
    # first copy everything
f2c60e
    cp --parents `find  -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
f2c60e
    cp Module.symvers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
f2c60e
    cp System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
f2c60e
    if [ -s Module.markers ]; then
f2c60e
      cp Module.markers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
f2c60e
    fi
f2c60e
    # then drop all but the needed Makefiles/Kconfig files
f2c60e
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Documentation
f2c60e
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts
f2c60e
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
f2c60e
    cp .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
f2c60e
    cp -a scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
f2c60e
    if [ -f tools/objtool/objtool ]; then
f2c60e
      cp -a tools/objtool/objtool $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/tools/objtool/ || :
f2c60e
    fi
f2c60e
    if [ -d arch/$Arch/scripts ]; then
f2c60e
      cp -a arch/$Arch/scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch} || :
f2c60e
    fi
f2c60e
    if [ -f arch/$Arch/*lds ]; then
f2c60e
      cp -a arch/$Arch/*lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch}/ || :
f2c60e
    fi
f2c60e
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*.o
f2c60e
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o
f2c60e
%ifarch %{power64}
f2c60e
    cp -a --parents arch/powerpc/lib/crtsavres.[So] $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
%endif
f2c60e
    if [ -d arch/%{asmarch}/include ]; then
f2c60e
      cp -a --parents arch/%{asmarch}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    fi
f2c60e
%ifarch aarch64
f2c60e
    # Needed for systemtap
f2c60e
    cp -a --parents arch/arm64/kernel/module.lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    # arch/arm64/include/asm/xen references arch/arm
f2c60e
    cp -a --parents arch/arm/include/asm/xen $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    # arch/arm64/include/asm/opcodes.h references arch/arm
f2c60e
    cp -a --parents arch/arm/include/asm/opcodes.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
%endif
f2c60e
    # include the machine specific headers for ARM variants, if available.
f2c60e
%ifarch %{arm}
f2c60e
    if [ -d arch/%{asmarch}/mach-${Flavour}/include ]; then
f2c60e
      cp -a --parents arch/%{asmarch}/mach-${Flavour}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    fi
f2c60e
    # include a few files for 'make prepare'
f2c60e
    cp -a --parents arch/arm/tools/gen-mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/arm/tools/mach-types $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
f2c60e
%endif
f2c60e
    cp -a include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
f2c60e
%ifarch %{ix86} x86_64
f2c60e
    # files for 'make prepare' to succeed with kernel-devel
f2c60e
    cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/entry/syscalls/syscalltbl.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/entry/syscalls/syscallhdr.sh $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/tools/relocs_32.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/tools/relocs_64.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/tools/relocs.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/tools/relocs_common.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/tools/relocs.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents tools/include/tools/le_byteshift.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/purgatory/purgatory.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/purgatory/sha256.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/purgatory/sha256.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/purgatory/stack.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/purgatory/string.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/purgatory/setup-x86_64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/purgatory/entry64.S $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/boot/string.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/boot/string.c $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
    cp -a --parents arch/x86/boot/ctype.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
f2c60e
%endif
f2c60e
    # Make sure the Makefile and version.h have a matching timestamp so that
f2c60e
    # external modules can be built
f2c60e
    touch -r $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Makefile $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/generated/uapi/linux/version.h
f2c60e
f2c60e
    # Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
f2c60e
    cp $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/.config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/config/auto.conf
f2c60e
f2c60e
%if %{with_debuginfo}
f2c60e
    if test -s vmlinux.id; then
f2c60e
      cp vmlinux.id $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/vmlinux.id
f2c60e
    else
f2c60e
      echo >&2 "*** ERROR *** no vmlinux build ID! ***"
f2c60e
      exit 1
f2c60e
    fi
f2c60e
f2c60e
    #
f2c60e
    # save the vmlinux file for kernel debugging into the kernel-debuginfo rpm
f2c60e
    #
f2c60e
    mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
f2c60e
    cp vmlinux $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
f2c60e
%endif
f2c60e
f2c60e
    find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name "*.ko" -type f >modnames
f2c60e
f2c60e
    # mark modules executable so that strip-to-file can strip them
f2c60e
    xargs --no-run-if-empty chmod u+x < modnames
f2c60e
f2c60e
    # Generate a list of modules for block and networking.
f2c60e
f2c60e
    grep -F /drivers/ modnames | xargs --no-run-if-empty nm -upA |
f2c60e
    sed -n 's,^.*/\([^/]*\.ko\):  *U \(.*\)$,\1 \2,p' > drivers.undef
f2c60e
f2c60e
    collect_modules_list()
f2c60e
    {
f2c60e
      sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef |
f2c60e
        LC_ALL=C sort -u > $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
f2c60e
      if [ ! -z "$3" ]; then
f2c60e
        sed -r -e "/^($3)\$/d" -i $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
f2c60e
      fi
f2c60e
    }
f2c60e
f2c60e
    collect_modules_list networking \
f2c60e
      'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt(l_|2x00)(pci|usb)_probe|register_netdevice'
f2c60e
    collect_modules_list block \
f2c60e
      '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'
f2c60e
    collect_modules_list drm \
f2c60e
      'drm_open|drm_init'
f2c60e
    collect_modules_list modesetting \
f2c60e
      'drm_crtc_init'
f2c60e
f2c60e
    # detect missing or incorrect license tags
f2c60e
    ( find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name '*.ko' | xargs /sbin/modinfo -l | \
f2c60e
        grep -E -v 'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' ) && exit 1
f2c60e
f2c60e
    # remove files that will be auto generated by depmod at rpm -i time
f2c60e
    pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/
f2c60e
        rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep}
f2c60e
    popd
f2c60e
f2c60e
    # Call the modules-extra script to move things around
f2c60e
    %{SOURCE17} $RPM_BUILD_ROOT/lib/modules/$KernelVer %{SOURCE16}
f2c60e
f2c60e
    #
f2c60e
    # Generate the kernel-core and kernel-modules files lists
f2c60e
    #
f2c60e
f2c60e
    # Copy the System.map file for depmod to use, and create a backup of the
f2c60e
    # full module tree so we can restore it after we're done filtering
f2c60e
    cp System.map $RPM_BUILD_ROOT/.
f2c60e
    pushd $RPM_BUILD_ROOT
f2c60e
    mkdir restore
f2c60e
    cp -r lib/modules/$KernelVer/* restore/.
f2c60e
f2c60e
    # don't include anything going into k-m-e in the file lists
f2c60e
    rm -rf lib/modules/$KernelVer/extra
f2c60e
f2c60e
    # Find all the module files and filter them out into the core and modules
f2c60e
    # lists.  This actually removes anything going into -modules from the dir.
f2c60e
    find lib/modules/$KernelVer/kernel -name *.ko | sort -n > modules.list
f2c60e
    cp $RPM_SOURCE_DIR/filter-*.sh .
f2c60e
    %{SOURCE99} modules.list %{_target_cpu}
f2c60e
    rm filter-*.sh
f2c60e
f2c60e
    # Run depmod on the resulting module tree and make sure it isn't broken
f2c60e
    depmod -b . -aeF ./System.map $KernelVer &> depmod.out
f2c60e
    if [ -s depmod.out ]; then
f2c60e
        echo "Depmod failure"
f2c60e
        cat depmod.out
f2c60e
        exit 1
f2c60e
    else
f2c60e
        rm depmod.out
f2c60e
    fi
f2c60e
    # remove files that will be auto generated by depmod at rpm -i time
f2c60e
    pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/
f2c60e
        rm -f modules.{alias*,builtin.bin,dep*,*map,symbols*,devname,softdep}
f2c60e
    popd
f2c60e
f2c60e
    # Go back and find all of the various directories in the tree.  We use this
f2c60e
    # for the dir lists in kernel-core
f2c60e
    find lib/modules/$KernelVer/kernel -mindepth 1 -type d | sort -n > module-dirs.list
f2c60e
f2c60e
    # Cleanup
f2c60e
    rm System.map
f2c60e
    cp -r restore/* lib/modules/$KernelVer/.
f2c60e
    rm -rf restore
f2c60e
    popd
f2c60e
f2c60e
    # Make sure the files lists start with absolute paths or rpmbuild fails.
f2c60e
    # Also add in the dir entries
f2c60e
    sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/k-d.list > ../kernel${Flavour:+-${Flavour}}-modules.list
f2c60e
    sed -e 's/^lib*/%dir \/lib/' %{?zipsed} $RPM_BUILD_ROOT/module-dirs.list > ../kernel${Flavour:+-${Flavour}}-core.list
f2c60e
    sed -e 's/^lib*/\/lib/' %{?zipsed} $RPM_BUILD_ROOT/modules.list >> ../kernel${Flavour:+-${Flavour}}-core.list
f2c60e
f2c60e
    # Cleanup
f2c60e
    rm -f $RPM_BUILD_ROOT/k-d.list
f2c60e
    rm -f $RPM_BUILD_ROOT/modules.list
f2c60e
    rm -f $RPM_BUILD_ROOT/module-dirs.list
f2c60e
f2c60e
%if %{signmodules}
f2c60e
    # Save the signing keys so we can sign the modules in __modsign_install_post
f2c60e
    cp certs/signing_key.pem certs/signing_key.pem.sign${Flav}
f2c60e
    cp certs/signing_key.x509 certs/signing_key.x509.sign${Flav}
f2c60e
%endif
f2c60e
f2c60e
    # Move the devel headers out of the root file system
f2c60e
    mkdir -p $RPM_BUILD_ROOT/usr/src/kernels
f2c60e
    mv $RPM_BUILD_ROOT/lib/modules/$KernelVer/build $RPM_BUILD_ROOT/$DevelDir
f2c60e
f2c60e
    # This is going to create a broken link during the build, but we don't use
f2c60e
    # it after this point.  We need the link to actually point to something
f2c60e
    # when kernel-devel is installed, and a relative link doesn't work across
f2c60e
    # the F17 UsrMove feature.
f2c60e
    ln -sf $DevelDir $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
f2c60e
f2c60e
    # prune junk from kernel-devel
f2c60e
    find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -exec rm -f {} \;
f2c60e
}
f2c60e
f2c60e
###
f2c60e
# DO it...
f2c60e
###
f2c60e
f2c60e
# prepare directories
f2c60e
rm -rf $RPM_BUILD_ROOT
f2c60e
mkdir -p $RPM_BUILD_ROOT/boot
f2c60e
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}
f2c60e
f2c60e
cd linux-%{KVERREL}
f2c60e
f2c60e
f2c60e
%if %{with_debug}
f2c60e
BuildKernel %make_target %kernel_image %{_use_vdso} debug
f2c60e
%endif
f2c60e
f2c60e
%if %{with_pae_debug}
f2c60e
BuildKernel %make_target %kernel_image %{use_vdso} %{pae}debug
f2c60e
%endif
f2c60e
f2c60e
%if %{with_pae}
f2c60e
BuildKernel %make_target %kernel_image %{use_vdso} %{pae}
f2c60e
%endif
f2c60e
f2c60e
%if %{with_up}
f2c60e
BuildKernel %make_target %kernel_image %{_use_vdso}
f2c60e
%endif
f2c60e
f2c60e
%global perf_make \
f2c60e
  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}
f2c60e
%if %{with_perf}
f2c60e
# perf
f2c60e
# make sure check-headers.sh is executable
f2c60e
chmod +x tools/perf/check-headers.sh
f2c60e
%{perf_make} DESTDIR=$RPM_BUILD_ROOT all
f2c60e
%endif
f2c60e
f2c60e
%if %{with_tools}
f2c60e
%ifarch %{cpupowerarchs}
f2c60e
# cpupower
f2c60e
# make sure version-gen.sh is executable.
f2c60e
chmod +x tools/power/cpupower/utils/version-gen.sh
f2c60e
%{make} %{?_smp_mflags} -C tools/power/cpupower CPUFREQ_BENCH=false
f2c60e
%ifarch %{ix86}
f2c60e
    pushd tools/power/cpupower/debug/i386
f2c60e
    %{make} %{?_smp_mflags} centrino-decode powernow-k8-decode
f2c60e
    popd
f2c60e
%endif
f2c60e
%ifarch x86_64
f2c60e
    pushd tools/power/cpupower/debug/x86_64
f2c60e
    %{make} %{?_smp_mflags} centrino-decode powernow-k8-decode
f2c60e
    popd
f2c60e
%endif
f2c60e
%ifarch %{ix86} x86_64
f2c60e
   pushd tools/power/x86/x86_energy_perf_policy/
f2c60e
   %{make}
f2c60e
   popd
f2c60e
   pushd tools/power/x86/turbostat
f2c60e
   %{make}
f2c60e
   popd
f2c60e
%endif #turbostat/x86_energy_perf_policy
f2c60e
%endif
f2c60e
pushd tools/thermal/tmon/
f2c60e
%{make}
f2c60e
popd
f2c60e
pushd tools/iio/
f2c60e
%{make}
f2c60e
popd
f2c60e
pushd tools/gpio/
f2c60e
%{make}
f2c60e
popd
f2c60e
%endif
f2c60e
f2c60e
# In the modsign case, we do 3 things.  1) We check the "flavour" and hard
f2c60e
# code the value in the following invocations.  This is somewhat sub-optimal
f2c60e
# but we're doing this inside of an RPM macro and it isn't as easy as it
f2c60e
# could be because of that.  2) We restore the .tmp_versions/ directory from
f2c60e
# the one we saved off in BuildKernel above.  This is to make sure we're
f2c60e
# signing the modules we actually built/installed in that flavour.  3) We
f2c60e
# grab the arch and invoke mod-sign.sh command to actually sign the modules.
f2c60e
#
f2c60e
# We have to do all of those things _after_ find-debuginfo runs, otherwise
f2c60e
# that will strip the signature off of the modules.
f2c60e
f2c60e
%define __modsign_install_post \
f2c60e
  if [ "%{signmodules}" -eq "1" ]; then \
f2c60e
    if [ "%{with_pae}" -ne "0" ]; then \
f2c60e
      %{modsign_cmd} certs/signing_key.pem.sign+%{pae} certs/signing_key.x509.sign+%{pae} $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+%{pae}/ \
f2c60e
    fi \
f2c60e
    if [ "%{with_debug}" -ne "0" ]; then \
f2c60e
      %{modsign_cmd} certs/signing_key.pem.sign+debug certs/signing_key.x509.sign+debug $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+debug/ \
f2c60e
    fi \
f2c60e
    if [ "%{with_pae_debug}" -ne "0" ]; then \
f2c60e
      %{modsign_cmd} certs/signing_key.pem.sign+%{pae}debug certs/signing_key.x509.sign+%{pae}debug $RPM_BUILD_ROOT/lib/modules/%{KVERREL}+%{pae}debug/ \
f2c60e
    fi \
f2c60e
    if [ "%{with_up}" -ne "0" ]; then \
f2c60e
      %{modsign_cmd} certs/signing_key.pem.sign certs/signing_key.x509.sign $RPM_BUILD_ROOT/lib/modules/%{KVERREL}/ \
f2c60e
    fi \
f2c60e
  fi \
f2c60e
  if [ "%{zipmodules}" -eq "1" ]; then \
f2c60e
    find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs xz; \
f2c60e
  fi \
f2c60e
%{nil}
f2c60e
f2c60e
###
f2c60e
### Special hacks for debuginfo subpackages.
f2c60e
###
f2c60e
f2c60e
# This macro is used by %%install, so we must redefine it before that.
f2c60e
%define debug_package %{nil}
f2c60e
f2c60e
%if %{with_debuginfo}
f2c60e
f2c60e
%define __debug_install_post \
f2c60e
  /usr/lib/rpm/find-debuginfo.sh %{debuginfo_args} %{_builddir}/%{?buildsubdir}\
f2c60e
%{nil}
f2c60e
f2c60e
%ifnarch noarch
f2c60e
%global __debug_package 1
f2c60e
%files -f debugfiles.list debuginfo-common-%{_target_cpu}
f2c60e
%defattr(-,root,root)
f2c60e
%endif
f2c60e
f2c60e
%endif
f2c60e
f2c60e
#
f2c60e
# Disgusting hack alert! We need to ensure we sign modules *after* all
f2c60e
# invocations of strip occur, which is in __debug_install_post if
f2c60e
# find-debuginfo.sh runs, and __os_install_post if not.
f2c60e
#
f2c60e
%define __spec_install_post \
f2c60e
  %{?__debug_package:%{__debug_install_post}}\
f2c60e
  %{__arch_install_post}\
f2c60e
  %{__os_install_post}\
f2c60e
  %{__modsign_install_post}
f2c60e
f2c60e
###
f2c60e
### install
f2c60e
###
f2c60e
f2c60e
%install
f2c60e
f2c60e
cd linux-%{KVERREL}
f2c60e
f2c60e
# We have to do the headers install before the tools install because the
f2c60e
# kernel headers_install will remove any header files in /usr/include that
f2c60e
# it doesn't install itself.
f2c60e
f2c60e
%if %{with_headers}
f2c60e
# Install kernel headers
f2c60e
make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
f2c60e
f2c60e
find $RPM_BUILD_ROOT/usr/include \
f2c60e
     \( -name .install -o -name .check -o \
f2c60e
        -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
f2c60e
f2c60e
%endif
f2c60e
f2c60e
%if %{with_cross_headers}
f2c60e
mkdir -p $RPM_BUILD_ROOT/usr/tmp-headers
f2c60e
make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/tmp-headers headers_install_all
f2c60e
f2c60e
find $RPM_BUILD_ROOT/usr/tmp-headers/include \
f2c60e
     \( -name .install -o -name .check -o \
f2c60e
        -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f
f2c60e
f2c60e
# Copy all the architectures we care about to their respective asm directories
f2c60e
for arch in arm arm64 powerpc s390 x86 ; do
f2c60e
mkdir -p $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include
f2c60e
mv $RPM_BUILD_ROOT/usr/tmp-headers/include/arch-${arch}/asm $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/
f2c60e
cp -a $RPM_BUILD_ROOT/usr/tmp-headers/include/asm-generic $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/.
f2c60e
done
f2c60e
f2c60e
# Remove the rest of the architectures
f2c60e
rm -rf $RPM_BUILD_ROOT/usr/tmp-headers/include/arch*
f2c60e
rm -rf $RPM_BUILD_ROOT/usr/tmp-headers/include/asm-*
f2c60e
f2c60e
# Copy the rest of the headers over
f2c60e
for arch in arm arm64 powerpc s390 x86 ; do
f2c60e
cp -a $RPM_BUILD_ROOT/usr/tmp-headers/include/* $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include/.
f2c60e
done
f2c60e
f2c60e
rm -rf $RPM_BUILD_ROOT/usr/tmp-headers
f2c60e
%endif
f2c60e
f2c60e
%if %{with_perf}
f2c60e
# perf tool binary and supporting scripts/binaries
f2c60e
%{perf_make} DESTDIR=$RPM_BUILD_ROOT lib=%{_lib} install-bin install-traceevent-plugins
f2c60e
# remove the 'trace' symlink.
f2c60e
rm -f %{buildroot}%{_bindir}/trace
f2c60e
# remove the perf-tips
f2c60e
rm -rf %{buildroot}%{_docdir}/perf-tip
f2c60e
f2c60e
# python-perf extension
f2c60e
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-python_ext
f2c60e
f2c60e
# perf man pages (note: implicit rpm magic compresses them later)
f2c60e
mkdir -p %{buildroot}/%{_mandir}/man1
f2c60e
pushd %{buildroot}/%{_mandir}/man1
f2c60e
tar -xf %{SOURCE10}
f2c60e
%if !%{with_tools}
f2c60e
    rm -f kvm_stat.1
f2c60e
%endif
f2c60e
popd
f2c60e
%endif
f2c60e
f2c60e
%if %{with_tools}
f2c60e
%ifarch %{cpupowerarchs}
f2c60e
%{make} -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
f2c60e
rm -f %{buildroot}%{_libdir}/*.{a,la}
f2c60e
%find_lang cpupower
f2c60e
mv cpupower.lang ../
f2c60e
%ifarch %{ix86}
f2c60e
    pushd tools/power/cpupower/debug/i386
f2c60e
    install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
f2c60e
    install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
f2c60e
    popd
f2c60e
%endif
f2c60e
%ifarch x86_64
f2c60e
    pushd tools/power/cpupower/debug/x86_64
f2c60e
    install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
f2c60e
    install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
f2c60e
    popd
f2c60e
%endif
f2c60e
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
f2c60e
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
f2c60e
install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service
f2c60e
install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
f2c60e
%endif
f2c60e
%ifarch %{ix86} x86_64
f2c60e
   mkdir -p %{buildroot}%{_mandir}/man8
f2c60e
   pushd tools/power/x86/x86_energy_perf_policy
f2c60e
   make DESTDIR=%{buildroot} install
f2c60e
   popd
f2c60e
   pushd tools/power/x86/turbostat
f2c60e
   make DESTDIR=%{buildroot} install
f2c60e
   popd
f2c60e
%endif #turbostat/x86_energy_perf_policy
f2c60e
pushd tools/thermal/tmon
f2c60e
make INSTALL_ROOT=%{buildroot} install
f2c60e
popd
f2c60e
pushd tools/iio
f2c60e
make DESTDIR=%{buildroot} install
f2c60e
popd
f2c60e
pushd tools/gpio
f2c60e
make DESTDIR=%{buildroot} install
f2c60e
popd
f2c60e
pushd tools/kvm/kvm_stat
f2c60e
make INSTALL_ROOT=%{buildroot} install-tools
f2c60e
popd
f2c60e
%endif
f2c60e
f2c60e
%if %{with_bootwrapper}
f2c60e
make DESTDIR=$RPM_BUILD_ROOT bootwrapper_install WRAPPER_OBJDIR=%{_libdir}/kernel-wrapper WRAPPER_DTSDIR=%{_libdir}/kernel-wrapper/dts
f2c60e
%endif
f2c60e
f2c60e
###
f2c60e
### clean
f2c60e
###
f2c60e
f2c60e
%clean
f2c60e
rm -rf $RPM_BUILD_ROOT
f2c60e
f2c60e
###
f2c60e
### scripts
f2c60e
###
f2c60e
f2c60e
%if %{with_tools}
f2c60e
%post -n kernel-tools-libs
f2c60e
/sbin/ldconfig
f2c60e
f2c60e
%postun -n kernel-tools-libs
f2c60e
/sbin/ldconfig
f2c60e
%endif
f2c60e
f2c60e
#
f2c60e
# This macro defines a %%post script for a kernel*-devel package.
f2c60e
#	%%kernel_devel_post [<subpackage>]
f2c60e
#
f2c60e
%define kernel_devel_post() \
f2c60e
%{expand:%%post %{?1:%{1}-}devel}\
f2c60e
if [ -f /etc/sysconfig/kernel ]\
f2c60e
then\
f2c60e
    . /etc/sysconfig/kernel || exit $?\
f2c60e
fi\
f2c60e
if [ "$HARDLINK" != "no" -a -x /usr/sbin/hardlink ]\
f2c60e
then\
f2c60e
    (cd /usr/src/kernels/%{KVERREL}%{?1:+%{1}} &&\
f2c60e
     /usr/bin/find . -type f | while read f; do\
f2c60e
       hardlink -c /usr/src/kernels/*.fc*.*/$f $f\
f2c60e
     done)\
f2c60e
fi\
f2c60e
%{nil}
f2c60e
f2c60e
#
f2c60e
# This macro defines a %%post script for a kernel*-modules-extra package.
f2c60e
# It also defines a %%postun script that does the same thing.
f2c60e
#	%%kernel_modules_extra_post [<subpackage>]
f2c60e
#
f2c60e
%define kernel_modules_extra_post() \
f2c60e
%{expand:%%post %{?1:%{1}-}modules-extra}\
f2c60e
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\
f2c60e
%{nil}\
f2c60e
%{expand:%%postun %{?1:%{1}-}modules-extra}\
f2c60e
/sbin/depmod -a %{KVERREL}%{?1:+%{1}}\