xuexiaolei / rpms / kernel-rt

Forked from rpms/kernel-rt 4 years ago
Clone
Blob Blame History Raw
Summary: The Linux Realtime kernel

# catch building on Fedora
%if "%{?dist}" == "" || "0%{?fedora}" != "0"
%global dist .el7
%endif

%global __spec_install_pre %{___build_pre}

# realtimeN
%global iteration 141

# major and minor kernel version
# e.g. 3.2.4 has a major_kver of 3 and a minor_kver of 2
%global major_kver	3
%global minor_kver	10.0

# RHEL7 build number
%global rhel_build %{!?_rhel_build:229}

# The preempt RT patch level
%global rttag %{!?rt_patch_version:rt56}

# conditional with/without variables
# Note that the logic here is inverted; a  bcond_without implies
# that the variable is on by default (since you use --without to turn it off)
# Likewise a bcond_with implies the variable is off by default (turned on by --with)
%bcond_without rt
%bcond_without doc
%bcond_without debug
%bcond_with    headers
%bcond_with    vanilla
%bcond_without trace
%bcond_with    perf
%bcond_with    firmware
%bcond_without virt
%bcond_without debuginfo
%bcond_without dracut

# What parts do we want to build?  We must build at least one kernel.
# These are the kernels that are built IF the architecture allows it.
# Note that these are regular macros, not the bcond macros defined above,
# so they can be reassigned inside the spec file.

%global buildrt        %{with rt}
%global builddoc       %{with doc}
%global builddebug     %{with debug}
%global buildheaders   %{with headers}
%global buildvanilla   %{with vanilla}
%global buildtrace     %{with trace}
%global buildperf      %{with perf}
%global buildfirmware  %{with firmware}
%global buildvirt      %{with virt}
%global builddebuginfo %{with debuginfo}


# Verbose output?
#%global verbose V=1

# use dracut or mkinitrd?
%global use_dracut    %{with dracut}

# Versions of various parts

# Polite request for people who spin their own kernel rpms:
# please modify the "buildid" define in a way that identifies
# that the kernel isn't the stock distribution kernel, for example,
# by setting the define to ".local" or ".bz123456"
#
# % define buildid .local

%global rhel 1
%if %{rhel}
%global distro_build  0
### %global signmodules 1
%global signmodules 1
%else
# fedora_build defines which build revision of this kernel version we're
# building. Rather than incrementing forever, as with the prior versioning
# setup, we set fedora_cvs_origin to the current cvs revision s/1.// of the
# kernel spec when the kernel is rebased, so fedora_build automatically
# works out to the offset from the rebase, so it doesn't get too ginormous.
#
# If you're building on a branch, the RCS revision will be something like
# 1.1205.1.1.  In this case we drop the initial 1, subtract fedora_cvs_origin
# from the second number, and then append the rest of the RCS string as is.
# Don't stare at the awk too long, you'll go blind.
%global fedora_cvs_origin   1462
%global fedora_cvs_revision() %2
%global distro_build %(echo %{fedora_cvs_origin}.%{fedora_cvs_revision $Revision: 1.694 $} | awk -F . '{ OFS = "."; ORS = ""; print $3 - $1 ; i = 4 ; OFS = ""; while (i <= NF) { print ".", $i ; i++} }')
%global distro_build %{fedora_build}
%global signmodules 0
%endif

# if patch fuzzy patch applying will be forbidden
%global with_fuzzy_patches 0

%global rpmversion %{major_kver}.%{minor_kver}


# What parts do we want to build?  We must build at least one kernel.
# These are the kernels that are built IF the architecture allows it.
# All should default to 1 (enabled) and be flipped to 0 (disabled)
# by later arch-specific checks.

# The following build options are enabled by default.
# Use either --without <opt> in your rpmbuild command or force values
# to 0 in here to disable them.
#
# perf noarch subpkg
%global with_vdso_install 1

# Build the kernel-doc package, but don't fail the build if it botches.
# Here "true" means "continue" and "false" means "fail the build".
%global doc_build_fail true

# Additional options for user-friendly one-off kernel building:
# Only build the base kernel (--with baseonly):
%global with_baseonly  0
# Only build the debug kernel (--with dbgonly):
%global with_dbgonly   0

# should we do C=1 builds with sparse
%global with_sparse	%{?_with_sparse:      1} %{?!_with_sparse:      0}

%global pkg_release_simple %{rhel_build}.%{rttag}.%{iteration}

%global pkg_release %{pkg_release_simple}%{?buildid}%{?dist}
%global pkg_release_simple %{pkg_release_simple}%{?dist}
%global KVERREL %{rpmversion}-%{pkg_release}.%{_target_cpu}

# The kernel tarball/base version
%global kversion %{major_kver}.%{minor_kver}

%global make_target bzImage

%global hdrarch %_target_cpu
%global asmarch %_target_cpu

%if !%{builddebuginfo}
%global _enable_debug_packages 0
%global fancy_debuginfo 0
%else
%global _enable_debug_packages 1
%global fancy_debuginfo 1
%endif
%global debuginfodir /usr/lib/debug

# if requested, only build base kernel
%if %{with_baseonly}
%global builddebug 0
%global buildtrace 0
%global buildvanilla 0
%global buildvirt 0
%global buildperf 0
%global buildheaders 0
%global builddebuginfo 0
%endif

# if requested, only build debug kernel
%if %{with_dbgonly}
%if %{debugbuildsenabled}
%global buildrt 0
%endif
%global buildperf 0
%endif

%global all_x86 i386 i686

%if %{with_vdso_install}
# These arches install vdso/ directories.
%global vdso_arches %{all_x86} x86_64
%endif


# don't do debug builds on anything but i686 and x86_64
%ifnarch i686 x86_64
%global builddebug 0
%endif

# only package docs if we're noarch
%ifnarch noarch
%global builddoc 0
%global buildfirmware 0
%endif

# don't build noarch kernels or headers (duh)
%ifarch noarch
%global buildrt 0
%global buildheaders 0
%global buildperf 0
%global buildvirt 0
%global buildtrace 0
%global buildvanilla 0
%global all_arch_configs kernel-%{version}-*.config
%endif

# Per-arch tweaks

%global asmarch x86
%global image_install_path boot
%global kernel_image arch/x86/boot/bzImage

%ifarch %{all_x86}
%global hdrarch i386
%global all_arch_configs kernel-%{rpmversion}-i?86-rt*.config
%endif

%ifarch x86_64
%global all_arch_configs kernel-%{rpmversion}-x86_64-rt*.config
%endif

%global oldconfig_target oldconfig

# To temporarily exclude an architecture from being built, add it to
# %nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we
# don't build kernel-headers then the new build system will no longer let
# us use the previous build of that package -- it'll just be completely AWOL.
# Which is a BadThing(tm).

# We don't build a kernel on i386; we only do kernel-headers there,
# and we no longer build for 31bit S390. Same for 32bit sparc and arm.
%global nobuildarches i386 i586 i686 s390 sparc sparc64 ppc ia64 %{arm} noarch

%ifarch %nobuildarches
%global buildrt 0
%global builddebug 0
%global buildvanilla 0
%global buildtrace 0
%global buildvirt 0
%global builddebuginfo 0
%global buildperf 0
%global _enable_debug_packages 0
%endif

#
# Three sets of minimum package version requirements in the form of Conflicts:
# to versions below the minimum
#

#
# First the general kernel 3.0 required versions as per
# Documentation/Changes
#
%global kernel_dot_org_conflicts  ppp < 2.4.3-3, isdn4k-utils < 3.2-32, nfs-utils < 1.0.7-12, e2fsprogs < 1.37-4, util-linux < 2.12, jfsutils < 1.1.7-2, reiserfs-utils < 3.6.19-2, xfsprogs < 2.6.13-4, procps < 3.2.5-6.3, oprofile < 0.9.1-2, device-mapper-libs < 1.02.63-2, mdadm < 3.2.1-5

#
# Then a series of requirements that are distribution specific, either
# because we add patches for something, or the older versions have
# problems with the newer kernel or lack certain things that make
# integration in the distro harder than needed.
#
%global package_conflicts initscripts < 7.23, udev < 145-11, iptables < 1.3.2-1, ipw2200-firmware < 2.4, iwl4965-firmware < 228.57.2, selinux-policy-targeted < 1.25.3-14, squashfs-tools < 4.0, wireless-tools < 29-3

# We moved the drm include files into kernel-headers, make sure there's
# a recent enough libdrm-devel on the system that doesn't have those.
%global kernel_headers_conflicts libdrm-devel < 2.4.0-0.15

#
# Packages that need to be installed before the kernel is, because the %%post
# scripts use them.
#
%global kernel_prereq  fileutils, module-init-tools >= 3.16-2, initscripts >= 8.11.1-1, grubby >= 8.28-2, rt-setup >= 1.55

%if %{use_dracut}
%global initrd_prereq  dracut-kernel >= 001-7
%else
%global initrd_prereq  mkinitrd >= 6.0.61-1
%endif

#
# This macro does requires, provides, conflicts, obsoletes for a kernel package.
#	%%kernel_reqprovconf <subpackage>
# It uses any kernel_<subpackage>_conflicts and kernel_<subpackage>_obsoletes
# macros defined above.
#
%define kernel_reqprovconf \
Provides: kernel = %{rpmversion}-%{pkg_release}\
Provides: kernel-%{_target_cpu} = %{rpmversion}-%{pkg_release}%{?1:.%{1}}\
Provides: kernel-drm = 4.3.0\
Provides: kernel-drm-nouveau = 16\
Provides: kernel-modeset = 1\
Provides: kernel-uname-r = %{KVERREL}%{?1:.%{1}}\
Requires(pre): %{kernel_prereq}\
Requires(pre): %{initrd_prereq}\
Requires(pre): linux-firmware >= 20100806-2\
#Requires(pre): linux-firmware >= 20140911\
Requires(post): %{_sbindir}/new-kernel-pkg\
Requires(preun): %{_sbindir}/new-kernel-pkg\
Conflicts: %{kernel_dot_org_conflicts}\
Conflicts: %{package_conflicts}\
%{expand:%%{?kernel%{?1:_%{1}}_conflicts:Conflicts: %%{kernel%{?1:_%{1}}_conflicts}}}\
%{expand:%%{?kernel%{?1:_%{1}}_obsoletes:Obsoletes: %%{kernel%{?1:_%{1}}_obsoletes}}}\
%{expand:%%{?kernel%{?1:_%{1}}_provides:Provides: %%{kernel%{?1:_%{1}}_provides}}}\
# We can't let RPM do the dependencies automatic because it'll then pick up\
# a correct but undesirable perl dependency from the module headers which\
# isn't required for the kernel proper to function\
AutoReq: no\
AutoProv: yes\
%{nil}

Name: kernel-rt
Group: System Environment/Kernel
License: GPLv2
URL: http://www.kernel.org/
Version: %{rpmversion}
Release: %{pkg_release}
# DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD.
# SET %%nobuildarches (ABOVE) INSTEAD
ExclusiveArch: noarch x86_64
ExclusiveOS: Linux
Provides: kernel-rt = %{rpmversion}
Provides: kernel-rt-drm = 4.3.0
Provides: kernel-rt-%{_target_cpu} = %{rpmversion}-%{pkg_release}

%kernel_reqprovconf
%ifarch x86_64
Obsoletes: kernel-smp
%endif

#
# List the packages used during the kernel build
#
BuildRequires: module-init-tools, patch >= 2.5.4, bash >= 2.03, sh-utils, tar
BuildRequires: bzip2, findutils, gzip, m4, perl, make >= 3.78, diffutils, gawk
BuildRequires: gcc >= 3.4.2, binutils >= 2.12, redhat-rpm-config
BuildRequires: hostname, net-tools, patchutils, rpm-build >= 4.8.0-7, bc
BuildRequires: openssl
BuildRequires: hmaccalc
%ifarch x86_64
BuildRequires: pesign >= 0.109-4
%endif
Buildrequires: xz
%if %{builddoc}
BuildRequires: xmlto
BuildRequires: asciidoc
%endif
%if %{with_sparse}
BuildRequires: sparse >= 0.4.1
%endif
%if %{buildrt}
%if %{buildperf}
BuildRequires: elfutils-libelf-devel zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed)
BuildRequires: elfutils-devel asciidoc xmlto
BuildRequires: audit-libs-devel
%endif
%endif
%if %{signmodules}
BuildRequires: gnupg
%endif
BuildRequires: python

BuildConflicts: rhbuildsys(DiskFree) < 7Gb

%if %{fancy_debuginfo}
# Fancy new debuginfo generation introduced in Fedora 8.
# Note this must be a define since it needs to be overridden in some macro
# expansions
%define debuginfo_args --strict-build-id
%endif

Source0: %{name}-%{rpmversion}-%{pkg_release_simple}.tar.xz

Source10: sign-modules
%define modsign_cmd %{SOURCE10}
Source11: genkey
Source12: perf
Source13: perf-archive
Source14: find-provides
Source15: merge.pl
Source17: sanity_check.py
Source19: extrakeys.pub

Source31: x509.genkey
Source32: extra_certificates
Source33: securebootca.cer
Source34: secureboot.cer
Source35: rheldup3.x509
Source36: rhelkpatch1.x509

### Started using a unified SRPM


# empty final patch file to facilitate testing of kernel patches
Patch999999: linux-kernel-test.patch

BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root

# Override find_provides to use a script that provides "kernel(symbol) = hash".
# Pass path of the RPM temp dir containing kabideps to find-provides script.
# %global _use_internal_dependency_generator 0
# %global __find_provides %_sourcedir/find-provides %{_tmppath}
# %global __find_requires /usr/lib/rpm/redhat/find-requires kernel

%description
The kernel-rt package contains the Linux kernel (vmlinuz), the core of any
Linux operating system.  The kernel handles the basic functions
of the operating system: memory allocation, process allocation, device
input and output, etc.

This kernel has been compiled withe the RT patch applied and is intended
for use in deterministic response-time situations


%package doc
Summary: Various documentation bits found in the kernel source
Group: Documentation
%description doc
This package contains documentation files from the kernel
source. Various bits of information about the Linux kernel and the
device drivers shipped with it are documented in these files.

You will want to install this package if you need a reference to the
options that can be passed to Linux kernel modules at load time.


%package headers
Summary: Header files for the Linux kernel for use by glibc
Group: Development/System
Obsoletes: glibc-kernheaders
Provides: glibc-kernheaders = 3.0-46
%description headers
Kernel-headers includes the C header files that specify the interface
between the Linux kernel and userspace libraries and programs.  The
header files define structures and constants that are needed for
building most standard programs and are also needed for rebuilding the
glibc package.

%package firmware
Summary: Firmware files used by the Linux kernel
Group: Development/System
# This is... complicated.
# Look at the WHENCE file.
License: GPL+ and GPLv2+ and MIT and Redistributable, no modification permitted
Provides: kernel-firmware = %{rpmversion}-%{pkg_release}
Provides: kernel-rt-firmware = %{rpmversion}-%{pkg_release}
%description firmware
Kernel-firmware includes firmware files required for some devices to
operate.

%if %{builddebuginfo}
%package debuginfo-common-%{_target_cpu}
Summary: Kernel source files used by %{name}-debuginfo packages
Group: Development/Debug
%description debuginfo-common-%{_target_cpu}
This package is required by %{name}-debuginfo subpackages.
It provides the kernel source files common to all builds.
%endif

%if %{buildrt}
%if %{buildperf}
%package -n perf-rt
Summary: Performance monitoring for the Linux kernel
Group: Development/System
Provides: perl(Perf::Trace::Context), perl(Perf::Trace::Core), perl(Perf::Trace::Util)
License: GPLv2
Obsoletes: perf
%description -n perf-rt
This package provides the supporting documentation for the perf tool
shipped in each kernel image subpackage.
%endif
%endif

#
# This macro creates a kernel-<subpackage>-debuginfo package.
#	%%kernel_debuginfo_package <subpackage>
#
%define kernel_debuginfo_package() \
%package %{?1:%{1}-}debuginfo\
Summary: Debug information for package %{name}%{?1:-%{1}}\
Group: Development/Debug\
Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}\
Provides: %{name}%{?1:-%{1}}-debuginfo-%{_target_cpu} = %{version}-%{release}\
AutoReqProv: no\
%description -n %{name}%{?1:-%{1}}-debuginfo\
This package provides debug information for package %{name}%{?1:-%{1}}.\
This is required to use SystemTap with %{name}%{?1:%{1}}-%{KVERREL}.\
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '/.*/%%{KVERREL}%{?1:\.%{1}}/.*|/.*%%{KVERREL}%{?1:\.%{1}}(\.debug)?' -o debuginfo%{?1}.list}\
%{nil}

#
# This macro creates a kernel-<subpackage>-devel package.
#	%%kernel_devel_package <subpackage> <pretty-name>
#
%define kernel_devel_package() \
%package %{?1:%{1}-}devel\
Summary: Development package for building kernel modules to match the %{?2:%{2} }kernel\
Group: System Environment/Kernel\
Provides: kernel-rt%{?1:-%{1}}-devel-%{_target_cpu} = %{version}-%{release}\
Provides: kernel-rt-devel-%{_target_cpu} = %{version}-%{release}%{?1:.%{1}}\
Provides: kernel-rt-devel = %{version}-%{release}%{?1:.%{1}}\
Provides: kernel-rt-devel-uname-r = %{KVERREL}%{?1:.%{1}}\
AutoReqProv: no\
Requires(pre): /usr/bin/find\
%description -n kernel-rt%{?variant}%{?1:-%{1}}-devel\
This package provides kernel headers and makefiles sufficient to build modules\
against the %{?2:%{2} }kernel package.\
%{nil}

#
# This macro creates a kernel-<subpackage> and its -devel and -debuginfo too.
#	%%define variant_summary The Linux kernel compiled for <configuration>
#	%%kernel_variant_package [-n <pretty-name>] <subpackage>
#
%define kernel_variant_package(n:) \
%package %1\
Summary: %{variant_summary}\
Group: System Environment/Kernel\
%kernel_reqprovconf\
%{expand:%%kernel_devel_package %1 %{!?-n:%1}%{?-n:%{-n*}}}\
%{expand:%%kernel_debuginfo_package %1}\
%{nil}


# First the auxiliary packages of the main kernel package.
%kernel_devel_package
%kernel_debuginfo_package

%if %{signmodules}
cp %{SOURCE19} .
cat <<EOF
###
### Now generating a PGP key pair to be used for signing modules.
###
### If this takes a long time, you might wish to run rngd in the background to
### keep the supply of entropy topped up.  It needs to be run as root, and
### should use a hardware random number generator if one is available, eg:
###
###     rngd -r /dev/hwrandom
###
### If one isn't available, the pseudo-random number generator can be used:
###
###     rngd -r /dev/urandom
###
EOF
gpg --homedir . --batch --gen-key %{SOURCE31}
cat <<EOF
###
### Key pair generated.
###
EOF
# if there're external keys to be included
if [ -s %{SOURCE19} ]; then
	gpg --homedir . --no-default-keyring --keyring kernel.pub --import %{SOURCE19}
fi
gpg --homedir . --export --keyring ./kernel.pub Red > extract.pub
gcc -o scripts/bin2c scripts/bin2c.c
mkdir crypto/signature
scripts/bin2c ksign_def_public_key __initdata <extract.pub >crypto/signature/key.h
%endif

# Now, each variant package.

%if %{with debug}
# kernel-rt-debug
%define variant_summary The Linux kernel compiled with extra debugging enabled
%kernel_variant_package debug
%description debug
The kernel package contains the Linux kernel (vmlinuz), the core of any
Linux operating system.  The kernel handles the basic functions
of the operating system:  memory allocation, process allocation, device
input and output, etc.

This variant of the kernel has numerous debugging options enabled.
It should only be installed when trying to gather additional information
on kernel bugs, as some of these options impact performance noticably.
%endif

%if %{with trace}
# kernel-rt-trace
%define variant_summary The Linux kernel compiled with extra tracing options enabled
%kernel_variant_package trace
%description trace
The kernel package contains the Linux kernel (vmlinuz), the core of any
Linux operating system.  The kernel handles the basic functions
of the operating system:  memory allocation, process allocation, device
input and output, etc.

This variant of the kernel has numerous tracing options enabled.
It should only be installed when trying to gather additional information
on kernel bugs, as some of these options impact performance noticably.
%endif

%if %{with vanilla}
# kernel-rt-vanilla
%define variant_summary The Linux kernel compiled without RT capabilities for debugging
%kernel_variant_package vanilla
%description vanilla
The kernel package contains the Linux kernel (vmlinuz), the core of any
Linux operating system.  The kernel handles the basic functions
of the operating system:  memory allocation, process allocation, device
input and output, etc.

This variant of the kernel has the realtime capabilities disabled, but
has a configuration close to the one used in the realtime kernel.
It should only be installed when trying to gather additional information
on kernel bugs.
%endif

%if %{with virt}
# kernel-rt-virt
%define variant_summary The Linux kernel compiled with RT and virtualization
%kernel_variant_package virt
%description virt
The kernel package contains the Linux kernel (vmlinuz), the core of any
Linux operating system.  The kernel handles the basic functions
of the operating system:  memory allocation, process allocation, device
input and output, etc.

This variant of the kernel has both RT and virtualization options turned on.
It is strictly for internal testing and should never be delivered to a
customer.
%endif

%prep
## ApplyPatch routine
patch_command='patch -p1 -F1 -s'
ApplyPatch()
{
local patch=$1
shift
if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
echo "Can't find $RPM_SOURCE_DIR/$patch"
exit 1;
fi
case "$patch" in
*.bz2) bunzip2 < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
*.gz) gunzip < "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
*.xz) unxz <  "$RPM_SOURCE_DIR/$patch" | $patch_command ${1+"$@"} ;;
*) $patch_command ${1+"$@"} < "$RPM_SOURCE_DIR/$patch" ;;
esac
}

# we don't want a .config file when building firmware: it just confuses the build system
%define build_firmware \
   # mv .config .config.firmware_save \
   make INSTALL_FW_PATH=$RPM_BUILD_ROOT/lib/firmware/%{rpmversion}-%{pkg_release} firmware_install \
   # mv .config.firmware_save .config \
   ln -s /lib/firmware/%{rpmversion}-%{pkg_release} $RPM_BUILD_ROOT/lib/firmware/%{rpmversion}-%{pkg_release}.i686 \
   ln -s /lib/firmware/%{rpmversion}-%{pkg_release} $RPM_BUILD_ROOT/lib/firmware/%{rpmversion}-%{pkg_release}.x86_64 \
   for kvname in debug trace; do \
      ln -s /lib/firmware/%{rpmversion}-%{pkg_release} $RPM_BUILD_ROOT/lib/firmware/%{rpmversion}-%{pkg_release}.i686.$kvname \
      ln -s /lib/firmware/%{rpmversion}-%{pkg_release} $RPM_BUILD_ROOT/lib/firmware/%{rpmversion}-%{pkg_release}.x86_64.$kvname \
   done \
   # install firmware files for bfa 3.1.2.1 \
   pushd $RPM_BUILD_ROOT/lib/firmware/%{rpmversion}-%{pkg_release} \
   popd


if [ ! -d kernel-%{kversion}/vanilla-%{kversion}/ ]; then
	rm -f pax_global_header;
%setup -q -n kernel-%{kversion} -c
	mv %{name}-%{rpmversion}-%{pkg_release_simple} vanilla-%{kversion};
else
	cd kernel-%{kversion}/;
fi

if [ -d linux-%{kversion}.%{_target_cpu} ]; then
  # Just in case we ctrl-c'd a prep already
  rm -rf deleteme.%{_target_cpu}
  # Move away the stale away, and delete in background.
  mv linux-%{kversion}.%{_target_cpu} deleteme.%{_target_cpu}
  rm -rf deleteme.%{_target_cpu} &
fi

cp -rl vanilla-%{kversion} linux-%{kversion}.%{_target_cpu}

cd linux-%{kversion}.%{_target_cpu}

## Apply Patches here
ApplyPatch linux-kernel-test.patch

# move off upstream version mechanism
if [ -e localversion-rt ]; then
   mv -f localversion-rt upstream-localversion-rt
fi

# Any further pre-build tree manipulations happen here.

chmod +x scripts/checkpatch.pl

# only deal with configs if we are going to build for the arch
%ifnarch %nobuildarches

# generate configs using RHEL directory
pushd redhat/configs
for i in  x86_64 x86_64-rt x86_64-rt-debug x86_64-rt-trace x86_64-rt-virt
do
    sh build_configs.sh $i
done
# use the RHEL config as our "vanilla" configuration
mv kernel-%{kversion}-x86_64.config kernel-%{kversion}-x86_64-rt-vanilla.config
mv *.config ../..
popd


%if !%{builddebug}
rm -f kernel-%{kversion}-*debug.config
%endif

%if !%{buildtrace}
rm -f kernel-%{kversion}-*trace.config
%endif

%if !%{buildvirt}
rm -f kernel-%{kversion}-*virt.config
%endif

# now run oldconfig over all the config files
for i in *.config
do
  echo running oldconfig on $i
  mv $i .config
  Arch=`head -1 .config | cut -b 3-`
  ls -ls .config
  make ARCH=$Arch %{oldconfig_target} >/dev/null
  echo "# $Arch" > configs/$i
  cat .config >> configs/$i
  rm -f include/generated/kernel.arch
  rm -f include/generated/kernel.cross
done
# end of kernel config
%endif

# get rid of unwanted files resulting from patch fuzz
find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null

# remove unnecessary SCM files
find . -name .gitignore -exec rm -f {} \; >/dev/null

cd ..

###
### build
###
%build

%if %{with_sparse}
%global sparse_mflags	C=1
%endif

%if %{fancy_debuginfo}
# This override tweaks the kernel makefiles so that we run debugedit on an
# object before embedding it.  When we later run find-debuginfo.sh, it will
# run debugedit again.  The edits it does change the build ID bits embedded
# in the stripped object, but repeating debugedit is a no-op.  We do it
# beforehand to get the proper final build ID bits into the embedded image.
# This affects the vDSO images in vmlinux, and the vmlinux image in bzImage.
export AFTER_LINK=\
'sh -xc "/usr/lib/rpm/debugedit -b $$RPM_BUILD_DIR -d /usr/src/debug \
				-i $@ > $@.id"'
%endif

cp_vmlinux()
{
  eu-strip --remove-comment -o "$2" "$1"
}

BuildKernel() {
    MakeTarget=$1
    KernelImage=$2
    Flavour=$3
    InstallName=${4:-vmlinuz}

    # Pick the right config file for the kernel we're building
    suffix=
    if [ "$Flavour" != "" ]
    then
	suffix="-${Flavour}"
    fi
    Config=kernel-%{kversion}-%{_target_cpu}-rt${suffix}.config
    DevelDir=/usr/src/kernels/%{KVERREL}${Flavour:+.${Flavour}}

    # When the bootable image is just the ELF kernel, strip it.
    # We already copy the unstripped file into the debuginfo package.
    if [ "$KernelImage" = vmlinux ]; then
      CopyKernel=cp_vmlinux
    else
      CopyKernel=cp
    fi

    KernelVer=%{version}-%{release}.%{_target_cpu}${Flavour:+.${Flavour}}
    echo BUILDING A KERNEL FOR ${Flavour} %{_target_cpu}...

    # make sure EXTRAVERSION says what we want it to say
    perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.%{_target_cpu}${Flavour:+.${Flavour}}/" Makefile

    # if pre-rc1 devel kernel, must fix up SUBLEVEL for our versioning scheme
    %if !0%{?rcrev}
    %if 0%{?gitrev}
    perl -p -i -e 's/^SUBLEVEL.*/SUBLEVEL = %{upstream_sublevel}/' Makefile
    %endif
    %endif

    # and now to start the build process

    make -s mrproper

    cp configs/$Config .config
    echo USING CONFIG configs/$Config

    Arch=`head -1 .config | cut -b 3-`
    echo USING ARCH=$Arch

    make -s ARCH=$Arch %{oldconfig_target} > /dev/null
    make -s ARCH=$Arch %{?verbose} %{?_smp_mflags} $MakeTarget %{?sparse_mflags}
    make -s ARCH=$Arch %{?verbose} %{?_smp_mflags} modules %{?sparse_mflags} || exit 1

%if %{buildrt}
%if %{buildperf}
    if [ -z "$Flavour" ]; then
        pushd tools/perf
        chmod +x util/generate-cmdlist.sh util/PERF-VERSION-GEN
        ### make -s %{?_smp_mflags} %{?verbose} DESTDIR=$RPM_BUILD_ROOT prefix=/usr install
        make -s %{?verbose} %{?_smp_mflags} NO_DEMANGLE=1 perf
        mkdir -p $RPM_BUILD_ROOT/usr/libexec/
        install -m 755 perf $RPM_BUILD_ROOT/usr/libexec/perf.%{KVERREL}%{?Flavour:+.%{Flavour}}
        popd
    fi
%endif
%endif

    # Start installing the results
%if %{builddebuginfo}
    mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/boot
    mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/%{image_install_path}
    install -m 644 System.map $RPM_BUILD_ROOT/%{debuginfodir}/boot/System.map-$KernelVer
%endif
    mkdir -p $RPM_BUILD_ROOT/%{image_install_path}
    install -m 644 .config $RPM_BUILD_ROOT/boot/config-$KernelVer
    install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-$KernelVer
%if %{use_dracut}
    # We estimate the size of the initramfs because rpm needs to take this size
    # into consideration when performing disk space calculations. (See bz #530778)
    dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initramfs-$KernelVer.img bs=1M count=20
%else
    dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initrd-$KernelVer.img bs=1M count=5
%endif
    if [ -f arch/$Arch/boot/zImage.stub ]; then
      cp arch/$Arch/boot/zImage.stub $RPM_BUILD_ROOT/%{image_install_path}/zImage.stub-$KernelVer || :
    fi
# EFI SecureBoot signing, x86_64-only
%ifarch x86_64
    %pesign -s -i $KernelImage -o $KernelImage.signed -a %{SOURCE33} -c %{SOURCE34} -n redhatsecureboot301
    mv $KernelImage.signed $KernelImage
%endif
    $CopyKernel $KernelImage $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
    chmod 755 $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer

    # hmac sign the kernel for FIPS
    echo "Creating hmac file: $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac"
    ls -l $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
    sha512hmac $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer | sed -e "s,$RPM_BUILD_ROOT,," > $RPM_BUILD_ROOT/%{image_install_path}/.vmlinuz-$KernelVer.hmac;

    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/kernel
    if [ "$Flavour" != "kdump" ]; then
        # Override $(mod-fw) because we don't want it to install any firmware
        # we'll get it from the linux-firmware package and we don't want conflicts
        make -s %{?cross_opts} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw=
    fi
%ifarch %{vdso_arches}
    make -s %{?cross_opts} ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer
    if [ ! -s ldconfig-kernel.conf ]; then
      echo > ldconfig-kernel.conf "\
# Placeholder file, no vDSO hwcap entries used in this kernel."
    fi
    %{__install} -D -m 444 ldconfig-kernel.conf \
        $RPM_BUILD_ROOT/etc/ld.so.conf.d/kernel-rt-$KernelVer.conf
%endif

    # And save the headers/makefiles etc for building modules against
    #
    # This all looks scary, but the end result is supposed to be:
    # * all arch relevant include/ files
    # * all Makefile/Kconfig files
    # * all script/ files

    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/source
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
    (cd $RPM_BUILD_ROOT/lib/modules/$KernelVer ; ln -s build source)
    # dirs for additional modules per module-init-tools, kbuild/modules.txt
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/extra
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/updates
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/weak-updates
    # first copy everything
    cp --parents `find  -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
    # now nuke the MRG directory
    # TODO: figure out of we need this or not
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/MRG

    cp System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
    if [ -s Module.markers ]; then
      cp Module.markers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
    fi

    # then drop all but the needed Makefiles/Kconfig files
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Documentation
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts
    rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
    cp .config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
    cp -a scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
    if [ -d arch/$Arch/scripts ]; then
      cp -a arch/$Arch/scripts $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch} || :
    fi
    if [ -f arch/$Arch/*lds ]; then
      cp -a arch/$Arch/*lds $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/arch/%{_arch}/ || :
    fi
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*.o
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o

    # hack to remove .build-id conflict with RHEL kernel debuginfo
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/conmakehash
    rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/pnmtologo

    if [ -d arch/%{asmarch}/include ]; then
          cp -a --parents arch/%{asmarch}/include $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/
    fi
    mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
    cd include
    cp -a $(echo * | sed -e 's/^asm$//') $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
    #cp -a acpi config crypto keys linux math-emu media mtd net pcmcia rdma rxrpc scsi sound trace video drm asm-generic generated xen $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
    if [ -L asm ]; then
      asmdir=$(readlink asm)
      cp -a $asmdir $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/
      pushd $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
      ln -s $asmdir asm
      popd
    fi
    # Make sure the Makefile and vermagic.h have a matching timestamp so that
    # external modules can be built
    touch -r $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Makefile $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/linux/vermagic.h
    touch -r $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/.config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/linux/autoconf.h
    # Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
    cp $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/.config $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/config/auto.conf
    cd ..

    #
    # save the vmlinux file for kernel debugging into the kernel-debuginfo rpm
    #
%if %{builddebuginfo}
    mkdir -p $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
    cp vmlinux $RPM_BUILD_ROOT%{debuginfodir}/lib/modules/$KernelVer
%endif

    find $RPM_BUILD_ROOT/lib/modules/$KernelVer -name "*.ko" -type f >modnames

    # mark modules executable so that strip-to-file can strip them
    xargs --no-run-if-empty chmod u+x < modnames

    # Generate a list of modules for block and networking.

    grep -F /drivers/ modnames | xargs --no-run-if-empty nm -upA |
    sed -n 's,^.*/\([^/]*\.ko\):  *U \(.*\)$,\1 \2,p' > drivers.undef

    collect_modules_list()
    {
      sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef |
      LC_ALL=C sort -u > $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
      if [ ! -z "$3" ]; then
        sed -r -e "/^($3)\$/d" -i $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$1
      fi
    }

    collect_modules_list networking 'register_netdev|ieee80211_register_hw|usbnet_probe|phy_driver_register|rt2x00(pci|usb)_probe|register_netdevice'
    collect_modules_list block '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'
    collect_modules_list drm 'drm_open|drm_init'
    collect_modules_list modesetting 'drm_crtc_init'

    # detect missing or incorrect license tags
    rm -f modinfo
    while read i
    do
      echo -n "${i#$RPM_BUILD_ROOT/lib/modules/$KernelVer/} " >> modinfo
      /sbin/modinfo -l $i >> modinfo
    done < modnames

    egrep -v \
    	  'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' \
	  modinfo && exit 1

    rm -f modinfo modnames

    # Save off the .tmp_versions/ directory.  We'll use it in the
    # __debug_install_post macro below to sign the right things
    # Also save the signing keys so we actually sign the modules with the
    # right key.
    cp -r .tmp_versions .tmp_versions.sign${Flavour:+.${Flavour}}
    cp signing_key.priv signing_key.priv.sign${Flavour:+.${Flavour}}
    cp signing_key.x509 signing_key.x509.sign${Flavour:+.${Flavour}}

    # remove files that will be auto generated by depmod at rpm -i time
    for i in alias alias.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap
    do
      rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/modules.$i
    done

    # Move the devel headers out of the root file system
    mkdir -p $RPM_BUILD_ROOT/usr/src/kernels
    mv $RPM_BUILD_ROOT/lib/modules/$KernelVer/build $RPM_BUILD_ROOT/$DevelDir
    ln -sf ../../../..$DevelDir $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
    # copy Module.symvers
    cp Module.symvers $RPM_BUILD_ROOT/$DevelDir
}

###
# DO it...
###

# prepare directories
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/boot

cd linux-%{kversion}.%{_target_cpu}

%if %{builddebug}
BuildKernel %make_target %kernel_image debug
%endif

%if %{buildtrace}
BuildKernel %make_target %kernel_image trace
%endif

%if %{buildvanilla}
BuildKernel %make_target %kernel_image vanilla
%endif

%if %{buildvirt}
BuildKernel %make_target %kernel_image virt
%endif

# maybe %if %{buildrt}
%if %{buildrt}
BuildKernel %make_target %kernel_image
%endif

%if %{builddoc}
# Make the HTML and man pages.
make -j1 htmldocs mandocs || %{doc_build_fail}

# sometimes non-world-readable files sneak into the kernel source tree
chmod -R a=rX Documentation
find Documentation -type d | xargs chmod u+w
%endif

%if %{buildrt}
%if %{buildperf}
pushd tools/perf
make %{?_smp_mflags} man || %{doc_build_fail}
popd
%endif
%endif
# In the modsign case, we do 3 things.  1) We check the "flavour" and hard
# code the value in the following invocations.  This is somewhat sub-optimal
# but we're doing this inside of an RPM macro and it isn't as easy as it
# could be because of that.  2) We restore the .tmp_versions/ directory from
# the one we saved off in BuildKernel above.  This is to make sure we're
# signing the modules we actually built/installed in that flavour.  3) We
# grab the arch and invoke 'make modules_sign' and the mod-extra-sign.sh
# commands to actually sign the modules.
#
# We have to do all of those things _after_ find-debuginfo runs, otherwise
# that will strip the signature off of the modules.
#
# Finally, pick a module at random and check that it's signed and fail the build
# if it isn't.

%ifnarch noarch
%define __modsign_install_post \
   if [ "%{with_rt}" -ne "0" ]; then \
      Arch=`head -1 configs/kernel-%{version}-%{_target_cpu}-rt.config | cut -b 3-` \
      rm -rf .tmp_versions \
      mv .tmp_versions.sign .tmp_versions \
      mv signing_key.priv.sign signing_key.priv \
      mv signing_key.x509.sign signing_key.x509 \
      %{modsign_cmd} $RPM_BUILD_ROOT/lib/modules/%{KVERREL} || exit 1 \
   fi\
   for AAA in %{?with_trace:trace} %{?with_debug:debug} %{?with_vanilla:vanilla} %{?with_virt:virt}; do \
      Arch=`head -1 configs/kernel-rt-%{version}-%{_target_cpu}-rt-${AAA}.config | cut -b 3-` \
      rm -rf .tmp_versions \
      mv .tmp_versions.sign.${AAA} .tmp_versions \
      mv signing_key.priv.sign.${AAA} signing_key.priv \
      mv signing_key.x509.sign.${AAA} signing_key.x509 \
      %{modsign_cmd} $RPM_BUILD_ROOT/lib/modules/%{KVERREL}.${AAA} || exit 1 \
   done \
%{nil}
%endif

###
### Special hacks for debuginfo subpackages.
###

# This macro is used by %%install, so we must redefine it before that.
%global debug_package %{nil}

%if %{fancy_debuginfo}
%define __debug_install_post \
  /usr/lib/rpm/find-debuginfo.sh %{debuginfo_args} %{_builddir}/%{?buildsubdir}\
%{nil}
%endif

%if %{builddebuginfo}
%ifnarch noarch
%global __debug_package 1
%files -f debugfiles.list debuginfo-common-%{_target_cpu}
%defattr(-,root,root)
%endif
%endif

#
# Disgusting hack alert! We need to ensure we sign modules *after* all
# invocations of strip occur, which is in __debug_install_post if
# find-debuginfo.sh runs, and __os_install_post if not.
#
%ifnarch noarch
%define __spec_install_post \
  %{?__debug_package:%{__debug_install_post}}\
  %{__arch_install_post}\
  %{__os_install_post}\
  %{__modsign_install_post}\
%{nil}
%endif

###
### install
###

%install
# for some reason, on RHEL-5 RPM_BUILD_ROOT doesn't get set
if [ -z "$RPM_BUILD_ROOT" ]; then
	export RPM_BUILD_ROOT="%{buildroot}";
fi

cd linux-%{kversion}.%{_target_cpu}

%if %{builddoc}
docdir=$RPM_BUILD_ROOT%{_datadir}/doc/kernel-rt-doc-%{rpmversion}
man9dir=$RPM_BUILD_ROOT%{_datadir}/man/man9rt

# copy the source over
mkdir -p $docdir
tar -f - --exclude=man --exclude='.*' --exclude=*.xml --exclude=*.tmpl -c Documentation | tar xf - -C $docdir

# Install man pages for the kernel API.
mkdir -p $man9dir
find Documentation/DocBook/man -name '*.9.gz' -print0 |
xargs -0 --no-run-if-empty %{__install} -m 444 -t $man9dir $m
ls $man9dir | grep -q '' || > $man9dir/BROKEN
%endif # builddoc

# perf docs
%if %{buildrt}
%if %{buildperf}
mandir=$RPM_BUILD_ROOT%{_datadir}/man
man1dir=$mandir/man1
pushd tools/perf/Documentation
make install-man mandir=$mandir
popd

pushd $man1dir
for d in *.1; do
 gzip $d;
done
popd

# perf shell wrapper
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
cp $RPM_SOURCE_DIR/perf $RPM_BUILD_ROOT/usr/sbin/perf
chmod 0755 $RPM_BUILD_ROOT/usr/sbin/perf
cp $RPM_SOURCE_DIR/perf-archive $RPM_BUILD_ROOT/usr/sbin/perf-archive
chmod 0755 $RPM_BUILD_ROOT/usr/sbin/perf-archive
mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/perf
%endif # buildperf
%endif

%if %{buildheaders}
# Install kernel headers
make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install

# Do headers_check but don't die if it fails.
make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_check \
     > hdrwarnings.txt || :
if grep -q exist hdrwarnings.txt; then
   sed s:^$RPM_BUILD_ROOT/usr/include/:: hdrwarnings.txt
   # Temporarily cause a build failure if header inconsistencies.
   # exit 1
fi

find $RPM_BUILD_ROOT/usr/include \
     \( -name .install -o -name .check -o \
     	-name ..install.cmd -o -name ..check.cmd \) | xargs rm -f

# glibc provides scsi headers for itself, for now
rm -rf $RPM_BUILD_ROOT/usr/include/scsi
rm -f $RPM_BUILD_ROOT/usr/include/asm*/atomic.h
rm -f $RPM_BUILD_ROOT/usr/include/asm*/io.h
rm -f $RPM_BUILD_ROOT/usr/include/asm*/irq.h
%endif

%if %{buildfirmware}
%{build_firmware}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/kernel-rt-%{rpmversion}-%{pkg_release}/firmware
cp firmware/WHENCE $RPM_BUILD_ROOT%{_datadir}/doc/kernel-rt-%{rpmversion}-%{pkg_release}/firmware
%endif

###
### clean
###

%clean
rm -rf $RPM_BUILD_ROOT

###
### scripts
###

#
# This macro defines a %%post script for a kernel*-devel package.
#	%%kernel_devel_post [<subpackage>]
#
%define kernel_devel_post() \
%{expand:%%post %{?1:%{1}-}devel}\
if [ -f /etc/sysconfig/kernel ]\
then\
    . /etc/sysconfig/kernel || exit $?\
fi\
if [ "$HARDLINK" != "no" -a -x /usr/sbin/hardlink ]\
then\
    (cd /usr/src/kernels/%{KVERREL}%{?1:.%{1}} &&\
     /usr/bin/find . -type f | while read f; do\
       hardlink -c /usr/src/kernels/*.fc*.*/$f $f\
     done)\
fi\
%{nil}

# This macro defines a %%posttrans script for a kernel package.
#	%%kernel_variant_posttrans [<subpackage>]
# More text can follow to go at the end of this variant's %%post.
#
# grubby might be called during installation when a boot loader configuration
# file is not present, so just drop any error messages. See BZ#610813 for
# more details.
%define kernel_variant_posttrans() \
%{expand:%%posttrans %{?1}}\
%{expand:\
NEWKERNARGS=""\
(/sbin/grubby --info=`/sbin/grubby --default-kernel`) 2>/dev/null | grep -q crashkernel\
if [ $? -ne 0 ]\
then\
	NEWKERNARGS="--kernel-args=\"crashkernel=auto\""\
fi\
NKPARGS="--mkinitrd --depmod --update"\
%if %{use_dracut}\
NKPARGS="$NKPARGS --dracut"\
%endif\
/sbin/new-kernel-pkg --package kernel-rt $NKPARGS %{KVERREL}%{?1:.%{1}} $NEWKERNARGS || exit $?\
}\
/sbin/new-kernel-pkg --package kernel-rt --rpmposttrans %{KVERREL}%{?1:.%{1}} || exit $?\
%{nil}

#
# This macro defines a %%post script for a kernel package and its devel package.
#	%%kernel_variant_post [-v <subpackage>] [-r <replace>]
# More text can follow to go at the end of this variant's %%post.
#
%define kernel_variant_post(v:r:) \
%{expand:%%kernel_devel_post %{?-v*}}\
%{expand:%%kernel_variant_posttrans %{?-v*}}\
%{expand:%%post %{?-v*}}\
%{expand:\
/sbin/new-kernel-pkg --package kernel-rt %{!?-v:--make-default} --install %{KVERREL}%{?-v:.%{-v*}} || exit $?\
}\
[ -d /lib/firmware/updates ] || mkdir -p /lib/firmware/updates\
ln -sf /lib/firmware/mrg-rt-firmware /lib/firmware/updates/%{KVERREL}%{?1:.%{1}}\
%{nil}


# This macro defines a %%preun script for a kernel package.
#	%%kernel_variant_preun <subpackage>
#
%define kernel_variant_preun() \
%{expand:%%preun %{?1}}\
/sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}%{?1:.%{1}} || exit $?\
%{nil}

# kernel-rt %post script
%kernel_variant_preun
%kernel_variant_post

%if %{with debug}
# kernel-rt-debug %post script
%kernel_variant_preun debug
%kernel_variant_post -v debug
%endif

%if %{with trace}
# kernel-rt-trace %post script
%kernel_variant_preun trace
%kernel_variant_post -v trace
%endif

%if %{with vanilla}
# kernel-rt-vanilla %post script
%kernel_variant_preun vanilla
%kernel_variant_post -v vanilla
%endif

%if %{with virt}
# kernel-rt-virt %post script
%kernel_variant_preun virt
%kernel_variant_post -v virt
%endif

if [ -x /sbin/ldconfig ]
then
    /sbin/ldconfig -X || exit $?
fi

###
### file lists
###

%if %{buildheaders}
%files headers
%defattr(-,root,root)
/usr/include/*
%endif

%if %{buildfirmware}
%files firmware
%defattr(-,root,root)
/lib/firmware/*
%doc %{_datadir}/doc/kernel-rt-%{rpmversion}-%{pkg_release}/firmware/WHENCE
%endif

# only some architecture builds need kernel-doc
%if %{builddoc}
%files doc
%defattr(-,root,root)
%{_datadir}/doc/kernel-rt-doc-%{rpmversion}/Documentation/*
%dir %{_datadir}/doc/kernel-rt-doc-%{rpmversion}/Documentation
%dir %{_datadir}/doc/kernel-rt-doc-%{rpmversion}
%{_datadir}/man/man9rt/*
%endif

%if %{buildrt}
%if %{buildperf}
%files -n perf-rt
%defattr(-,root,root)
/usr/sbin/perf
/usr/sbin/perf-archive
/usr/libexec/*
%{_datadir}/man/man1/*
%{_datadir}/doc/perf
%endif
%endif

# This is %{image_install_path} on an arch where that includes ELF files,
# or empty otherwise.
%global elf_image_install_path %{?kernel_image_elf:%{image_install_path}}

#
# This macro defines the %%files sections for a kernel package
# and its devel and debuginfo packages.
#	%%kernel_variant_files [-k vmlinux] <condition> <subpackage>
#
%define kernel_variant_files(k:) \
%if %{1}\
%{expand:%%files %{?2}}\
%defattr(-,root,root)\
/%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?2:.%{2}}\
/%{image_install_path}/.vmlinuz-%{KVERREL}%{?2:.%{2}}.hmac\
/boot/System.map-%{KVERREL}%{?2:.%{2}}\
/boot/config-%{KVERREL}%{?2:.%{2}}\
%dir /lib/modules/%{KVERREL}%{?2:.%{2}}\
/lib/modules/%{KVERREL}%{?2:.%{2}}/kernel\
/lib/modules/%{KVERREL}%{?2:.%{2}}/extra\
/lib/modules/%{KVERREL}%{?2:.%{2}}/build\
/lib/modules/%{KVERREL}%{?2:.%{2}}/source\
/lib/modules/%{KVERREL}%{?2:.%{2}}/updates\
/lib/modules/%{KVERREL}%{?2:.%{2}}/weak-updates\
%ifarch %{vdso_arches}\
/lib/modules/%{KVERREL}%{?2:.%{2}}/vdso\
/etc/ld.so.conf.d/kernel-rt-%{KVERREL}%{?2:.%{2}}.conf\
%endif\
/lib/modules/%{KVERREL}%{?2:.%{2}}/modules.*\
%if %{use_dracut}\
%ghost /boot/initramfs-%{KVERREL}%{?2:.%{2}}.img\
%else\
%ghost /boot/initrd-%{KVERREL}%{?2:.%{2}}.img\
%endif\
%{expand:%%files %{?2:%{2}-}devel}\
%defattr(-,root,root)\
%dir /usr/src/kernels\
/usr/src/kernels/%{KVERREL}%{?2:.%{2}}\
%if %{builddebuginfo}\
%ifnarch noarch\
%if %{builddebuginfo}\
%if %{fancy_debuginfo}\
%{expand:%%files -f debuginfo%{?2}.list %{?2:%{2}-}debuginfo}\
%{debuginfodir}/boot/System.map-%{KVERREL}%{?2:.%{2}}\
%else\
%{expand:%%files %{?2:%{2}-}debuginfo}\
%endif\
%endif\
%defattr(-,root,root)\
%if %{builddebuginfo}\
%if !%{fancy_debuginfo}\
%if "%{elf_image_install_path}" != ""\
%{debuginfodir}/%{elf_image_install_path}/*-%{KVERREL}%{?2:.%{2}}.debug\
%endif\
%endif\
%{debuginfodir}/lib/modules/%{KVERREL}%{?2:.%{2}}\
%{debuginfodir}/usr/src/kernels/%{KVERREL}%{?2:.%{2}}\
%{debuginfodir}/boot/System.map-%{KVERREL}%{?2:.%{2}}\
%endif\
%endif\
%endif\
%endif\
%{nil}

%kernel_variant_files %{buildrt}

%if %{builddebug}
%kernel_variant_files %{builddebug} debug
%endif

%if %{buildtrace}
%kernel_variant_files %{buildtrace} trace
%endif

%if %{buildvanilla}
%kernel_variant_files %{buildvanilla} vanilla
%endif

%if %{with virt}
%kernel_variant_files %{buildvirt} virt
%endif

%changelog
* Wed Feb 11 2015 Clark Williams <williams@redhat.com>  [3.10.0-229.rt56.141]
- [rt] mce: fixed RHEL-RT mis-merge with mce cleanup commit [1191668]

* Thu Jan 29 2015 Clark Williams <williams@redhat.com>  [3.10.0-229.rt56.140]
- rebased to rhel build 229 [1160430]

* Tue Jan 27 2015 Clark Williams <williams@redhat.com>  [3.10.0-227.rt56.139]
- rebased to rhel build 227 [1160430]

* Mon Jan 26 2015 Clark Williams <williams@redhat.com>  [3.10.0-226.rt56.138]
- rebased to rhel build 226 [1160430]

* Fri Jan 23 2015 Clark Williams <williams@redhat.com>  [3.10.0-225.rt56.137]
- rebased to rhel build 225 [1160430]

* Mon Jan 19 2015 Clark Williams <williams@redhat.com>  [3.10.0-224.rt56.136]
- rebased to rhel build 224 [1160430]

* Tue Jan 13 2015 Clark Williams <williams@redhat.com>  [3.10.0-223.rt56.135]
- rebased to rhel build 223 [1160430]

* Mon Jan 12 2015 Clark Williams <williams@redhat.com>  [3.10.0-222.rt56.134]
- rebased to rhel build 222 [1160430]
- net: iwlwifi: driver fails to initialize on RHEL-RT 3.10.0-220.rt56.el7 [1178919]

* Thu Jan  8 2015 Clark Williams <williams@redhat.com>  [3.10.0-221.rt56.133]
-  Setting up the function tracer hardlocks the machine [1172823]

* Wed Jan  7 2015 Clark Williams <williams@redhat.com>  [3.10.0-221.rt56.132]
- rebased to rhel build 221 [1160430]
- Performance problems with 3.10 LAZY_PREEMPT on Realtime kernel [1179371]

* Mon Jan  5 2015 Clark Williams <williams@redhat.com>  [3.10.0-220.rt56.131]
- net: iwlwifi: request only a threaded handler for interrupts [1178919]

* Tue Dec 23 2014 Clark Williams <williams@redhat.com>  [3.10.0-220.rt56.130]
- rebased to rhel build 220 [1160430]

* Thu Dec 18 2014 Clark Williams <williams@redhat.com>  [3.10.0-219.rt56.129]
- rebased to rhel build 219 [1160430]

* Thu Dec 18 2014 Clark Williams <williams@redhat.com>  [3.10.0-218.rt56.128]
- rebased to rhel build 218 [1160430]

* Mon Dec 15 2014 Clark Williams <williams@redhat.com>  [3.10.0-217.rt56.127]
- rebased to rhel build 217 [1160430]

* Tue Dec  9 2014 Clark Williams <williams@redhat.com>  [3.10.0-216.rt56.126]
- rebased to rhel build 216 [1160430]
- mm: Remove open coded local_irq_{enable,disable}() [1167452]

* Fri Dec  5 2014 Clark Williams <williams@redhat.com>  [3.10.0-213.rt56.125]
- rebased to rhel build 213 [1160430]

* Wed Dec  3 2014 Clark Williams <williams@redhat.com>  [3.10.0-212.rt56.124]
- rebased to rhel build 212 [1160430]

* Tue Dec  2 2014 Clark Williams <williams@redhat.com>  [3.10.0-211.rt56.123]
- rebased to rhel build 211 [1160430]

* Mon Nov 24 2014 Clark Williams <williams@redhat.com>  [3.10.0-210.rt56.122]
- rebased to rhel build 210 [1160430]

* Mon Nov 24 2014 Clark Williams <williams@redhat.com>  [3.10.0-209.rt56.121]
- rebased to rhel build 209 [1160430]

* Mon Nov 24 2014 Clark Williams <williams@redhat.com>  [3.10.0-206.rt56.120]
- rebased to rhel build 206 [1160430]

* Thu Nov 20 2014 Clark Williams <williams@redhat.com>  [3.10.0-205.rt56.119]
- rebased to rhel build 205 [1160430]

* Wed Nov 19 2014 Clark Williams <williams@redhat.com>  [3.10.0-204.rt56.118]
- ftrace/x86: Add frames pointers to trampoline as necessary [1161760]

* Tue Nov 18 2014 Clark Williams <williams@redhat.com>  [3.10.0-204.rt56.117]
- Fix scheduling while atomic in ring buffer for PREEMPT_RT [1161760]

* Mon Nov 17 2014 Clark Williams <williams@redhat.com>  [3.10.0-204.rt56.116]
- rebased to rhel build 204 [1160430]

* Fri Nov 14 2014 Clark Williams <williams@redhat.com>  [3.10.0-203.rt56.115]
- rebased to rhel build 203 [1160430]

* Tue Nov 11 2014 Clark Williams <williams@redhat.com>  [3.10.0-201.rt56.114]
- rebased to rhel build 201 [1160430]

* Mon Nov 10 2014 Clark Williams <williams@redhat.com> - 3.10.0-200.rt56.113
- rebased to rhel build 200 [1160430]
- apply blk_mq patches to avoid "scheduling while atomic" [1162253]

* Wed Nov  5 2014 Clark Williams <williams@redhat.com> - 3.10.0-198.rt56.112
- rebased to rhel build 198 [1160430]
- kernel: zero the cpumask before running sched_getaffinity [1158225]

* Tue Nov  4 2014 Clark Williams <williams@redhat.com> - 3.10.0-196.rt56.111
- corrected build and commit syntax for dist-git [1151560]

* Tue Oct 28 2014 Clark Williams <williams@redhat.com> - 3.10.0-196.rt56.110
- initial rhel-7.1 build [1151560]
- rebased to rhel build 196 [1159388]

* Tue Oct 28 2014 Clark Williams <williams@redhat.com> - 3.10.0-193.rt56.109
- virt: reverted blk-mq commits in virtio-blk due to 'scheduling while atomic' errors

* Fri Oct 24 2014 Clark Williams <williams@redhat.com> - 3.10.0-193.rt56.108
- configs: turned on CONFIG_VIRT_DRIVERS for virt config on RHEL7
- configs: turned on CONFIG_VIRTIO_MMIO for virt config on RHEL7
- configs: turned on CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES for virt configs on RHEL7
- configs: turned on CONFIG_PARAVIRT_DEBUG for virt config on RHEL7
- configs: turned on CONFIG_PARAVIRT_TIME_ACCOUNTING for virt config on RHEL7
- configs: turned on CONFIG_DEBUG_VIRTUAL for virt config on RHEL7

* Fri Oct 24 2014 Clark Williams <williams@redhat.com> - 3.10.0-193.rt56.107
- rebased to rhel build 193

* Wed Oct 22 2014 Clark Williams <williams@redhat.com> - 3.10.0-191.rt56.106
- rebased to rhel build 191

* Wed Oct 22 2014 Clark Williams <williams@redhat.com> - 3.10.0-190.rt56.105
- cpumask: set nr_cpumask_bits to nr_cpu_ids on PREEMPT_RT

* Tue Oct 21 2014 Clark Williams <williams@redhat.com> - 3.10.0-190.rt56.104
- rebased to rhel build 190

* Thu Oct 16 2014 Clark Williams <williams@redhat.com> - 3.10.0-188.rt56.103
- configs: turned off CONFIG_MIGRATION and CONFIG_CMA due to latency spikes

* Tue Oct 14 2014 Clark Williams <williams@redhat.com> - 3.10.0-188.rt56.102
- turned on -virt sub-package build for el7rt

* Mon Oct 13 2014 Clark Williams <williams@redhat.com> - 3.10.0-188.rt56.101
- rebased to rhel build 188

* Fri Oct 10 2014 Clark Williams <williams@redhat.com> - 3.10.0-186.rt56.100
- turned off default build of -virt and -vanilla kernel packages
- rebased to rhel build 186

* Thu Oct  9 2014 Clark Williams <williams@redhat.com> - 3.10.0-185.rt56.99
- configs: modified virt configs to match RHEL7 configs
- configs: turned on CONFIG_FAIR_GROUP_SCHED and CFS_BANDWIDTH
- rebased to rhel build 185

* Wed Oct  8 2014 Clark Williams <williams@redhat.com> - 3.10.0-183.rt56.98
- rebased to rhel build 183

* Tue Oct  7 2014 Clark Williams <williams@redhat.com> - 3.10.0-182.rt56.97
- configs: Turned on CONFIG_MIGRATION and CONFIG_CMA (left COMPACTION off)
- x86: updated arch/x86/boot/tools/build.c to use unified types.h
- rebased to rhel build 182

* Mon Oct  6 2014 Clark Williams <williams@redhat.com> - 3.10.0-179.rt56.96
- configs: turn off CONFIG_PARAVIRT_SPINLOCKS for virt config
- configs: turn off CONFIG_PARAVIRT_TIME_ACCOUNTING for virt config

* Sun Oct  5 2014 Clark Williams <williams@redhat.com> - 3.10.0-179.rt56.95
- specfile: fixed bogus path for new-kernel-pkg
- specfile: removed incorrect linux-firmware version

* Sun Oct  5 2014 Clark Williams <williams@redhat.com> - 3.10.0-179.rt56.94
- mm: move clear_hwpoisoned_pages under CONFIG_MEMORY_HOTREMOVE
- configs: handle unknown configs for el6rt

* Sun Oct  5 2014 Clark Williams <williams@redhat.com> - 3.10.0-179.rt56.93
- specfile: require new linux-firmware version (match RHEL)
- configs: Turned off CONFIG_MIGRATION and related configs
- rebased to rhel build 179

* Fri Oct  3 2014 Clark Williams <williams@redhat.com> - 3.10.0-178.rt56.92
- tracing: Disable tracing on warning
- rebased to rhel build 178

* Fri Oct  3 2014 Clark Williams <williams@redhat.com> - 3.10.0-177.rt56.91
- rebased to rhel build 177

* Tue Sep 30 2014 Clark Williams <williams@redhat.com> - 3.10.0-176.rt56.90
- rebased to rhel build 176

* Tue Sep 30 2014 Clark Williams <williams@redhat.com> - 3.10.0-174.rt56.89
- rebased to rhel build 174

* Mon Sep 29 2014 Clark Williams <williams@redhat.com> - 3.10.0-171.rt56.88
- rebased to rhel build 171

* Wed Sep 24 2014 Clark Williams <williams@redhat.com> - 3.10.0-170.rt56.87
- rebased to rhel build 170

* Tue Sep 23 2014 Clark Williams <williams@redhat.com> - 3.10.0-168.rt56.86
- rebased to rhel build 168

* Tue Sep 23 2014 Clark Williams <williams@redhat.com> - 3.10.0-167.rt56.85
- rebased to rhel build 167

* Fri Sep 19 2014 Clark Williams <williams@redhat.com> - 3.10.0-163.rt56.84
- rebased to rhel build 163

* Tue Sep 16 2014 Clark Williams <williams@redhat.com> - 3.10.0-161.rt56.83
- rebased to rhel build 161

* Tue Sep 16 2014 Clark Williams <williams@redhat.com> - 3.10.0-160.rt56.82
- rebased to rhel build 160

* Mon Sep 15 2014 Clark Williams <williams@redhat.com> - 3.10.0-158.rt56.81
- rebased to rhel build 158

* Mon Sep 15 2014 Clark Williams <williams@redhat.com> - 3.10.0-155.rt56.80
- rcu: unify boost and kthread priorities then make it boot time settable
- configs: added RCU_KTHREAD_PRIO and removed RCU_BOOST_PRIO

* Fri Sep 12 2014 Clark Williams <williams@redhat.com> - 3.10.0-155.rt56.79
- rebased to rhel build 155
- removed CONFIG_RCU_NOCB_CPU_* overrides in rt tree to use RHEL values
- changed CONFIG_RCU_BOOST_PRIO to 2 for realtime

* Thu Sep 11 2014 Clark Williams <williams@redhat.com> - 3.10.0-154.rt56.78
- rebased to rhel build 154

* Thu Sep  4 2014 Clark Williams <williams@redhat.com> - 3.10.0-152.rt56.77
- rebased to rhel build 152

* Tue Sep  2 2014 Clark Williams <williams@redhat.com> - 3.10.0-150.rt56.76
- rebased to rhel build 150

* Tue Sep  2 2014 Clark Williams <williams@redhat.com> - 3.10.0-147.rt56.75
- rebased to rhel build 147

* Wed Aug 27 2014 Clark Williams <williams@redhat.com> - 3.10.0-144.rt56.74
- brought RT patch up to current 3.10 level (-rt56)
  - Fix latency histogram after "hrtimer: Set expiry time before switch_hrtimer_base()"
  - timer: do not spin_trylock() on UP
  - rcu: make RCU_BOOST default on RT
  - net: gianfar: do not disable interrupts
  - net: gianfar: do not try to cleanup TX packets if they are not done

* Wed Aug 13 2014 Clark Williams <williams@redhat.com> - 3.10.0-144.rt34.73
- rebased to rhel build 144

* Thu Aug  7 2014 Clark Williams <williams@redhat.com> - 3.10.0-143.rt34.72
- rebased to rhel build 143

* Tue Aug  5 2014 Clark Williams <williams@redhat.com> - 3.10.0-142.rt34.71
- add the .virt variant modules to the signing pass loop
- turn off lockdep in main rt kernel
- x86: MCE: Add raw_lock conversion again

* Mon Aug  4 2014 Clark Williams <williams@redhat.com> - 3.10.0-142.rt34.70
- rebased to rhel build 142

* Thu Jul 31 2014 Clark Williams <williams@redhat.com> - 3.10.0-140.rt34.69
- fix cpu hotplug commit error

* Tue Jul 29 2014 Clark Williams <williams@redhat.com> - 3.10.0-140.rt34.68
- rebased to rhel build 140

* Fri Jul 25 2014 Clark Williams <williams@redhat.com> - 3.10.0-138.rt34.67
- debugging: turn on lockdep in main rt kernel for beaker tests
- from Luis Claudio R. Goncalves <lgoncalv@redhat.com>:
  - redhat: remove leftover from old specfile
  - redhat: fixed version and changelog on the specfile
  - redhat: fix the logi fir defining TOPDIR, RTDIR and RHDIR
  - redhat: fix a typo in the MRG Makefiles
  - redhat: use bz2 for the tarball instead of xz
  - redhat:  prepared specfile for rhel7-rt-on-rhel6 (with old style module signing)
  - redhat: remove unused config file
  - redhat: add the config files for rhel7-rt-on-rhel6
  - redhat-rt: patch required for rhel7-rt-on-rhel6

* Mon Jul 21 2014 Clark Williams <williams@redhat.com> - 3.10.0-138.rt34.66
- rebased to rhel build 138

* Sun Jul 20 2014 Clark Williams <williams@redhat.com> - 3.10.0-137.rt34.65
- rebased to rhel build 137

* Thu Jul 17 2014 Clark Williams <williams@redhat.com> - 3.10.0-136.rt34.64
- rebased to rhel build 136

* Wed Jul 16 2014 Clark Williams <williams@redhat.com> - 3.10.0-135.rt34.63
- rebased to rhel build 135

* Thu Jul 10 2014 Clark Williams <williams@redhat.com> - 3.10.0-133.rt34.62
- rebased to rhel build 133

* Thu Jul 10 2014 Clark Williams <williams@redhat.com> - 3.10.0-132.rt34.61
- rebased to rhel build 132
- workqueue: Prevent deadlock/stall on RT

* Wed Jul  2 2014 Clark Williams <williams@redhat.com> - 3.10.0-130.rt34.60
- hcd: change local_irq_* functions in URB completion to be nort variants

* Tue Jul  1 2014 Clark Williams <williams@redhat.com> - 3.10.0-130.rt34.59
- rebased to rhel build 130

* Mon Jun 30 2014 Clark Williams <williams@redhat.com> - 3.10.0-128.rt34.58
- nfnetlink_log: unset nf_loggers for net namespace when unload nfnetlink_log

* Wed Jun 25 2014 Clark Williams <williams@redhat.com> - 3.10.0-128.rt34.57
- netconsole: enable netconsole on PREEMPT_RT

* Tue Jun 24 2014 Clark Williams <williams@redhat.com> - 3.10.0-128.rt34.56
- sched: Do not clear PF_NO_SETAFFINITY flag in select_fallback_rq()

* Thu Jun 19 2014 Clark Williams <williams@redhat.com> - 3.10.0-128.rt34.55
- rebased to rhel build 128
- added tglx patch to rtmutex to fix slow path race

* Wed Jun 18 2014 Clark Williams <williams@redhat.com> - 3.10.0-127.rt34.54
- add code to drivers/cpufreq/powernow-k8.c to prevent panic on boot

* Tue Jun 17 2014 Clark Williams <williams@redhat.com> - 3.10.0-127.rt34.53
- turned on CONFIG_NO_HZ_FULL
- turned off CONFIG_NO_HZ_IDLE
- turned on CONFIG_FAIR_GROUP_SCHED
- turned off CONFIG_IRQ_TIME_ACCOUNTING
- turned off CONFIG_

* Mon Jun 16 2014 Clark Williams <williams@redhat.com> - 3.10.0-127.rt34.52
- turned on specfile logic to build virt subpackage

* Thu Jun 12 2014 Clark Williams <williams@redhat.com> - 3.10.0-127.rt34.51
- rebased to rhel build 127

* Fri Jun  6 2014 Clark Williams <williams@redhat.com> - 3.10.0-126.rt34.50
- rebased to rhel build 126
- moved RHEL7 RT infrastructure to redhat/realtime
- added RHEL6 RT infrastructure to redhat/MRG

* Tue Jun  3 2014 Clark Williams <williams@redhat.com> - 3.10.0-124.rt34.49
- rebased to rhel build 124
- futex: Prevent attaching to kernel threads
- futex: Add another early deadlock detection check
- more spefile changes for module signing
- removed sighand debugging patch
- reverted RT commit 'slub: delay ctor until the object is requested'

* Fri May 30 2014 Clark Williams <williams@redhat.com> - 3.10.0-123.rt34.48
- enable module signing

* Thu May 29 2014 Clark Williams <williams@redhat.com> - 3.10.0-123.rt34.47
- debugging patch for sighand from rostedt

* Fri May  9 2014 Clark Williams <williams@redhat.com> - 3.10.0-123.rt34.46
- rt,blk,mq: Make blk_mq_cpu_notify_lock a raw spinlock

* Fri May  9 2014 Clark Williams <williams@redhat.com> - 3.10.0-123.rt34.45
- rt: Move migrate_disable() up in trylocks

* Tue May  6 2014 Clark Williams <williams@redhat.com> - 3.10.0-123.rt34.44
- rebased to rhel build 123

* Mon May  5 2014 Clark Williams <williams@redhat.com> - 3.10.0-122.rt34.43
- rebased to rhel build 122

* Wed Apr  9 2014 Clark Williams <williams@redhat.com> - 3.10.0-121.rt34.42
- rebased to rhel build 121

* Tue Apr  8 2014 Clark Williams <williams@redhat.com> - 3.10.0-120.rt34.41
- rebased to rhel build 120
- synced with upstream 3.10.34-rt34 quilt queue

* Wed Apr  2 2014 Clark Williams <williams@redhat.com> - 3.10.0-118.rt33.40
- rebased to rhel build 118
- modified specfile to use xz compression
- modified config system to turn off CGROUP group schedulers

* Tue Apr  1 2014 Clark Williams <williams@redhat.com> - 3.10.0-117.rt33.39
- rebased to rhel build 117
- from Luis Claudio R. Goncalves <lgoncalv@redhat.com>:
  - spec: do not create an empty include/linux/version.h
  - spec: added ApplyPatch and the support for linux-kernel-test.patch
  - spec: fix the buildid usage on the specfile

* Mon Mar 31 2014 Clark Williams <williams@redhat.com> - 3.10.0-116.rt33.38
- rebased to rhel build 116

* Wed Mar 26 2014 Clark Williams <williams@redhat.com> - 3.10.0-114.rt33.37
- rebased to rhel build 114

* Fri Mar 21 2014 Clark Williams <williams@redhat.com> - 3.10.0-113.rt33.36
- rebased to rhel build 113

* Wed Mar 19 2014 Clark Williams <williams@redhat.com> - 3.10.0-112.rt33.35
- rebased to rhel build 112
- picked up 3.10-rt33 commit:
  - crypto: Reduce preempt disabled regions, more algos
- updated realtime version to -rt33

* Mon Mar 17 2014 Clark Williams <williams@redhat.com> - 3.10.0-111.rt32.34
- rebased to rhel build 111

* Wed Mar 12 2014 Clark Williams <williams@redhat.com> - 3.10.0-109.rt32.33
- rebased to rhel build 109

* Mon Mar 10 2014 Clark Williams <williams@redhat.com> - 3.10.0-107.rt32.32
- pulled new rt-specific patches from latest RT series, updated to -rt32
  - fs: jbd2: pull your plug when waiting for space
  - net: sched: dev_deactivate_many(): use msleep(1) instead of yield()

* Mon Mar 10 2014 Clark Williams <williams@redhat.com> - 3.10.0-107.rt31.31
- rebased to rhel build 107

* Fri Mar  7 2014 Clark Williams <williams@redhat.com> - 3.10.0-106.rt31.30
- rebased to rhel build 106
- reverted removal of stop_cpus_lock in kernel/stop_machine.c

* Wed Mar  5 2014 Clark Williams <williams@redhat.com> - 3.10.0-105.rt31.29
- rebased to rhel build 105

* Tue Mar  4 2014 Clark Williams <williams@redhat.com> - 3.10.0-102.rt31.28
- rebased to rhel build 102

* Tue Mar  4 2014 Clark Williams <williams@redhat.com> - 3.10.0-99.rt31.27
- added rostedt cpu_chill() patch to prevent live-lock

* Mon Mar  3 2014 Clark Williams <williams@redhat.com> - 3.10.0-99.rt31.26
- cherry-picked new RT patches from 3.10.12-rt31 series

* Fri Feb 28 2014 Clark Williams <williams@redhat.com> - 3.10.0-99.rt30.25
- rebased to rhel build 99

* Fri Feb 28 2014 Clark Williams <williams@redhat.com> - 3.10.0-98.rt30.24
- rebased to rhel build 98

* Thu Feb 27 2014 Clark Williams <williams@redhat.com> - 3.10.0-97.rt30.23
- synced with latest 3.10 rt patchset (3.10.32-rt30)

* Wed Feb 26 2014 Clark Williams <williams@redhat.com> - 3.10.0-97.rt25.22
- rebased to rhel build 97

* Wed Feb 26 2014 Clark Williams <williams@redhat.com> - 3.10.0-93.rt25.21
- reworked rebase to use hotplug function from RT patchset

* Mon Feb 24 2014 Clark Williams <williams@redhat.com> - 3.10.0-93.rt25.20
- rebased to rhel build 93
- switched to rhel7 hotplug mechanism in _cpu_down() (kernel/cpu.c)

* Fri Feb 21 2014 Clark Williams <williams@redhat.com> - 3.10.0-90.rt25.19
- rebased to rhel build 90

* Wed Feb 19 2014 Clark Williams <williams@redhat.com> - 3.10.0-89.rt25.18
- added cpu_chill() patch from Sebastian Andrzej Siewior <bigeasy@linutronix.de>

* Tue Feb 18 2014 Clark Williams <williams@redhat.com> - 3.10.0-89.rt25.17
- rebased to rhel build 89
- added 3.12-rt17 series patch to disable cmpxchg for lockref

* Thu Feb 13 2014 Clark Williams <williams@redhat.com> - 3.10.0-87.rt25.16
- rebased to rhel build 87

* Tue Feb 11 2014 Clark Williams <williams@redhat.com> - 3.10.0-86.rt25.15
- rebased to rhel build 86

* Tue Feb 11 2014 Clark Williams <williams@redhat.com> - 3.10.0-85.rt25.14
- rebased to rhel build 85

* Mon Feb 10 2014 Clark Williams <williams@redhat.com> - 3.10.0-84.rt25.13
- rebased to rhel build 84

* Tue Feb  4 2014 Clark Williams <williams@redhat.com> - 3.10.0-82.rt25.12
- fixup mismerge of mm/swap.c

* Tue Feb  4 2014 Clark Williams <williams@redhat.com> - 3.10.0-82.rt25.11
- rebased to rhel build 82

* Wed Jan 22 2014 Clark Williams <williams@redhat.com> - 3.10.0-76.rt25.10
- updated Makefile and kernel-rt.spec to use new versioning scheme

* Wed Jan 15 2014 Clark Williams <williams@redhat.com> - 3.10.0-rt23.9
- change specfile to not build firmware package kernel-rt-firmware

* Tue Jan 14 2014 Clark Williams <williams@redhat.com> - 3.10.0-rt23.8
- rebased to rhel build 68

* Mon Jan 13 2014 Clark Williams <williams@redhat.com> - 3.10.0-rt23.7
- fixed stop_machine issue that prevented system boot

* Wed Jan  8 2014 Clark Williams <williams@redhat.com> - 3.10.0-rt23.6
- remove dependency on rt-firmware package

* Tue Jan  7 2014 Clark Williams <williams@redhat.com> - 3.10.0-rt23.5
- rebased to rhel build 65
- applied sit fix from Willem de Bruijn <willemb@google.com>

* Tue Dec 17 2013 Clark Williams <williams@redhat.com> - 3.10.0-rt19.4
- applied ip6_tunnel fix from Nicolas Dichtel <nicolas.dichtel@6wind.com>

* Tue Dec 17 2013 Clark Williams <williams@redhat.com> - 3.10.0-rt19.3
- rebased to rhel build 62
- added Johannes Berg patch for iwlwifi on RT

* Mon Dec 16 2013 Clark Williams <williams@redhat.com> - 3.10.0-rt19.2
- rebased to 3.10.22-rt19 patchset

* Wed Oct 30 2013 Clark Williams <williams@redhat.com> - 3.10.0-rt18.1
- initial build