summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel.spec58
1 files changed, 58 insertions, 0 deletions
diff --git a/kernel.spec b/kernel.spec
index 47fdd82f2..9ad95794c 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -133,6 +133,11 @@ Summary: The Linux kernel
# gcov support
%define with_gcov %{?_with_gcov: 1} %{?!_with_gcov: 0}
+#
+# ipa_clone support
+%define with_ipaclones %{?_without_ipaclones: 0} %{?!_without_ipaclones: 1}
+
+
# Set debugbuildsenabled to 1 for production (build separate debug kernels)
# and 0 for rawhide (all kernels are debug kernels).
# See also 'make debug' and 'make release'.
@@ -144,6 +149,8 @@ Summary: The Linux kernel
%define with_cross_headers 0
# no selftests for now
%define with_selftests 0
+# no ipa_clone for now
+%define with_ipaclones 0
%endif
%if %{with_verbose}
@@ -189,6 +196,16 @@ Summary: The Linux kernel
%define with_kabidwchk 0
%endif
+# kpatch_kcflags are extra compiler flags applied to base kernel
+# -fdump-ipa-clones is enabled only for base kernels on selected arches
+%if %{with_ipaclones}
+%ifarch x86_64 ppc64le
+%define kpatch_kcflags -fdump-ipa-clones
+%else
+%define with_ipaclones 0
+%endif
+%endif
+
%define make_target bzImage
%define image_install_path boot
@@ -751,6 +768,18 @@ against the %{?2:%{2} }kernel package.\
%{nil}
#
+# kernel-<variant>-ipaclones-internal package
+#
+%define kernel_ipaclones_package() \
+%package %{?1:%{1}-}ipaclones-internal\
+Summary: *.ipa-clones files generated by -fdump-ipa-clones for kernel%{?1:-%{1}}\
+Group: System Environment/Kernel\
+AutoReqProv: no\
+%description %{?1:%{1}-}ipaclones-internal\
+This package provides *.ipa-clones files.\
+%{nil}
+
+#
# This macro creates a kernel-<subpackage>-modules-extra package.
# %%kernel_modules_extra_package <subpackage> <pretty-name>
#
@@ -858,6 +887,10 @@ Linux operating system. The kernel handles the basic functions
of the operating system: memory allocation, process allocation, device
input and output, etc.
+%if %{with_ipaclones}
+%kernel_ipaclones_package
+%endif
+
%prep
# do a few sanity-checks for --with *only builds
%if %{with_baseonly}
@@ -1574,6 +1607,18 @@ BuildKernel() {
# build a BLS config for this kernel
%{SOURCE43} "$KernelVer" "$RPM_BUILD_ROOT" "%{?variant}"
+
+%if %{with_ipaclones}
+ MAXPROCS=$(echo %{?_smp_mflags} | sed -n 's/-j\s*\([0-9]\+\)/\1/p')
+ if [ -z "$MAXPROCS" ]; then
+ MAXPROCS=1
+ fi
+ if [ "$Flavour" == "" ]; then
+ mkdir -p $RPM_BUILD_ROOT/$DevelDir-ipaclones
+ find . -name '*.ipa-clones' | xargs -i{} -r -n 1 -P $MAXPROCS install -m 644 -D "{}" "$RPM_BUILD_ROOT/$DevelDir-ipaclones/{}"
+ fi
+%endif
+
}
###
@@ -1985,6 +2030,19 @@ fi
%kernel_variant_files %{_use_vdso} %{with_debug} debug
%kernel_variant_files %{use_vdso} %{with_pae} lpae
+%define kernel_variant_ipaclones(k:) \
+%if %{1}\
+%if %{with_ipaclones}\
+%{expand:%%files %{?2:%{2}-}ipaclones-internal}\
+%defattr(-,root,root)\
+%defverify(not mtime)\
+/usr/src/kernels/%{KVERREL}%{?2:+%{2}}-ipaclones\
+%endif\
+%endif\
+%{nil}
+
+%kernel_variant_ipaclones %{with_up}
+
# plz don't put in a version string unless you're going to tag
# and build.
#