kernel/kernel-std/centos/meta_patches/Build-logic-and-sources-for...

180 lines
5.8 KiB
Diff

From ab74a468c73dc364eccba5e8200e31a7638534d4 Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Fri, 20 Apr 2018 14:51:56 -0400
Subject: [PATCH 1/3] Build logic and sources for TiC
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: zhao.shuai <zhaos@neusoft.com>
Signed-off-by: Zhang Zhiguo <zhangzhg@neusoft.com>
Signed-off-by: Robin Lu <bin1.lu@intel.com>
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
---
SPECS/kernel.spec | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 56 insertions(+), 4 deletions(-)
diff --git a/SPECS/kernel.spec b/SPECS/kernel.spec
index 2755684..adc3580 100644
--- a/SPECS/kernel.spec
+++ b/SPECS/kernel.spec
@@ -12,6 +12,8 @@
# change below to w4T.xzdio):
%define _binary_payload w3T.xzdio
+%define dist .el8_1
+
# For a kernel released for public testing, released_kernel should be 1.
# For internal testing builds during development, it should be 0.
%global released_kernel 1
@@ -40,14 +42,18 @@
%endif
# define buildid .local
+# This is the STX patch release
+%define buildid .%{tis_patch_ver}.tis
+
%define rpmversion 4.18.0
-%define pkgrelease 147.3.1.el8_1
+%define _pkgrelease 147.3.1
+%define pkgrelease %{_pkgrelease}.el8_1
# allow pkg_release to have configurable %%{?dist} tag
%define specrelease 147.3.1%{?dist}
-%define pkg_release %{specrelease}%{?buildid}
+%define pkg_release %{specrelease}%{buildid}
# 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.
@@ -92,9 +98,9 @@
# Only build the debug kernel (--with dbgonly):
%define with_dbgonly %{?_with_dbgonly: 1} %{?!_with_dbgonly: 0}
# Control whether we perform a compat. check against published ABI.
-%define with_kabichk %{?_without_kabichk: 0} %{?!_without_kabichk: 1}
+%define with_kabichk 0
# Control whether we perform a compat. check against DUP ABI.
-%define with_kabidupchk %{?_with_kabidupchk: 1} %{?!_with_kabidupchk: 0}
+%define with_kabidupchk 1
#
# Control whether to run an extensive DWARF based kABI check.
# Note that this option needs to have baseline setup in SOURCE300.
@@ -372,6 +378,7 @@ BuildRequires: xmlto
%if %{with_perf} || %{with_tools}
BuildRequires: asciidoc
%endif
+BuildRequires: util-linux
Source0: linux-%{rpmversion}-%{pkgrelease}.tar.xz
@@ -456,6 +463,12 @@ Source2001: cpupower.config
# Sources for CentOS debranding
Source9000: centos.pem
+# StarlingX Cloud sources here.
+# Not sure if we need to worry about numerical collisions between
+# SourceX and PatchX, so let's not risk it
+Source30000: ima_signing_key.pub
+Source30001: kernel-4.18.0-x86_64.config.tis_extra
+
## Patches needed for building this package
Patch1000: debrand-single-cpu.patch
@@ -699,6 +712,13 @@ Kernel sample programs and selftests.
%endif # with_selftests
+%ifarch x86_64
+%package unsigned
+Summary: Unsigned build of the Linux kernel
+%description unsigned
+Contains an unsigned version of the Linux kernel
+%endif # x86_64
+
%if %{with_gcov}
%package gcov
Summary: gcov graph and source files for coverage data collection.
@@ -1018,6 +1038,8 @@ cd configs
# Drop some necessary files from the source dir into the buildroot
cp $RPM_SOURCE_DIR/kernel-*.config .
+# Copy any TiS-specific config changes
+cp $RPM_SOURCE_DIR/kernel-*.config.tis_extra .
cp %{SOURCE41} .
VERSION=%{version} ./generate_all_configs.sh
@@ -1037,6 +1059,18 @@ do
done
%endif
+# Handle StarlingX Cloud customizations. Use -n to match oldnoconfig below. We want this before
+# the make line below so that the one below removes any dependencies of ones that we
+# turn off here. We also want it before "make listnewconfig" so that we can set the
+# config option for new configs introduced in the StarlingX Cloud patches.
+for i in *.config
+do
+ if [ -f ${i}.tis_extra ]; then
+ ../scripts/kconfig/merge_config.sh -m -n ${i} ${i}.tis_extra
+ mv .config ${i}
+ fi
+done
+
cp %{SOURCE42} .
./process_configs.sh -w -c kernel %{rpmversion}
@@ -1102,6 +1136,7 @@ BuildKernel() {
# and now to start the build process
%{make} -s %{?_smp_mflags} mrproper
+ cp %{SOURCE30000} certs/. # ima_signing_key.pub
cp configs/$Config .config
%if %{signkernel}%{signmodules}
@@ -1188,6 +1223,8 @@ BuildKernel() {
echo "pesigning failed"
exit 1
fi
+ cp $KernelImage vmlinuz.unsigned
+ $CopyKernel vmlinuz.unsigned $RPM_BUILD_ROOT/%{image_install_path}/vmlinuz.unsigned
mv vmlinuz.signed $SignImage
if [ "$KernelExtension" == "gz" ]; then
gzip -f9 $SignImage
@@ -1529,6 +1566,12 @@ BuildKernel() {
# Save the signing keys so we can sign the modules in __modsign_install_post
cp certs/signing_key.pem certs/signing_key.pem.sign${Flav}
cp certs/signing_key.x509 certs/signing_key.x509.sign${Flav}
+ # STX: Copy these keys as part of the devel package
+ # The Module signing keys are to ensure that only Out-of-tree
+ # built against the StarlingX Kernel get signed and loaded sans warnings
+ cp certs/signing_key.pem ${RPM_BUILD_ROOT}/lib/modules/${KernelVer}/build/
+ chmod 755 ${RPM_BUILD_ROOT}/lib/modules/${KernelVer}/build/signing_key.pem
+ cp certs/signing_key.x509 ${RPM_BUILD_ROOT}/lib/modules/${KernelVer}/build/
fi
%endif
@@ -2017,6 +2060,10 @@ fi\
#
%define kernel_variant_posttrans() \
%{expand:%%posttrans %{?1:%{1}-}core}\
+# If this is a pkg upgrade (ie installed as a patch), set the reboot flag\
+if [ $1 -gt 1 ] ; then\
+ touch /var/run/node_is_patched_rr\
+fi\
if [ -x %{_sbindir}/weak-modules ]\
then\
%{_sbindir}/weak-modules --add-kernel %{KVERREL}%{?1:+%{1}} || exit $?\
@@ -2315,6 +2362,11 @@ fi
%kernel_variant_ipaclones %{with_up}
+%ifarch x86_64
+%files unsigned
+/boot/vmlinuz.unsigned
+%endif
+
# plz don't put in a version string unless you're going to tag
# and build.
#
--
2.7.4