| 1 |
kumaneko |
155 |
#! /bin/sh |
| 2 |
|
|
# |
| 3 |
|
|
# This is a kernel build script for CentOS 6's 2.6.32 kernel. |
| 4 |
|
|
# |
| 5 |
|
|
|
| 6 |
|
|
die () { |
| 7 |
|
|
echo $1 |
| 8 |
|
|
exit 1 |
| 9 |
|
|
} |
| 10 |
|
|
|
| 11 |
|
|
cd /tmp/ || die "Can't chdir to /tmp/ ." |
| 12 |
|
|
|
| 13 |
kumaneko |
243 |
if [ ! -r kernel-2.6.32-696.3.2.el6.src.rpm ] |
| 14 |
kumaneko |
155 |
then |
| 15 |
kumaneko |
243 |
wget http://vault.centos.org/6.9/updates/Source/SPackages/kernel-2.6.32-696.3.2.el6.src.rpm || die "Can't download source package." |
| 16 |
kumaneko |
155 |
fi |
| 17 |
kumaneko |
243 |
LANG=C rpm --checksig kernel-2.6.32-696.3.2.el6.src.rpm | grep -F ': rsa sha1 (md5) pgp md5 OK' || die "Can't verify signature." |
| 18 |
|
|
rpm -ivh kernel-2.6.32-696.3.2.el6.src.rpm || die "Can't install source package." |
| 19 |
kumaneko |
155 |
|
| 20 |
kumaneko |
203 |
cd ~/rpmbuild/SOURCES/ || die "Can't chdir to ~/rpmbuild/SOURCES/ ." |
| 21 |
kumaneko |
241 |
if [ ! -r caitsith-patch-0.2-20170515.tar.gz ] |
| 22 |
kumaneko |
155 |
then |
| 23 |
kumaneko |
241 |
wget -O caitsith-patch-0.2-20170515.tar.gz 'http://osdn.jp/frs/redir.php?f=/caitsith/66537/caitsith-patch-0.2-20170515.tar.gz' || die "Can't download patch." |
| 24 |
kumaneko |
155 |
fi |
| 25 |
|
|
|
| 26 |
kumaneko |
203 |
cd ~/rpmbuild/SPECS/ || die "Can't chdir to ~/rpmbuild/SPECS/ ." |
| 27 |
kumaneko |
155 |
cp -p kernel.spec cs-kernel.spec || die "Can't copy spec file." |
| 28 |
|
|
patch << "EOF" || die "Can't patch spec file." |
| 29 |
|
|
--- cs-kernel.spec |
| 30 |
|
|
+++ cs-kernel.spec |
| 31 |
kumaneko |
237 |
@@ -15,7 +15,7 @@ |
| 32 |
kumaneko |
155 |
# that the kernel isn't the stock distribution kernel, for example, |
| 33 |
|
|
# by setting the define to ".local" or ".bz123456" |
| 34 |
|
|
# |
| 35 |
|
|
-# % define buildid .local |
| 36 |
kumaneko |
230 |
+%define buildid _caitsith_0.2.1 |
| 37 |
kumaneko |
155 |
|
| 38 |
kumaneko |
243 |
%define distro_build 696.3.2 |
| 39 |
kumaneko |
155 |
%define signmodules 1 |
| 40 |
kumaneko |
237 |
@@ -437,7 +437,7 @@ |
| 41 |
kumaneko |
155 |
# Packages that need to be installed before the kernel is, because the %post |
| 42 |
|
|
# scripts use them. |
| 43 |
|
|
# |
| 44 |
|
|
-%define kernel_prereq fileutils, module-init-tools, initscripts >= 8.11.1-1, kernel-firmware >= %{rpmversion}-%{pkg_release}, grubby >= 7.0.4-1 |
| 45 |
|
|
+%define kernel_prereq fileutils, module-init-tools, initscripts >= 8.11.1-1, grubby >= 7.0.4-1 |
| 46 |
|
|
%if %{with_dracut} |
| 47 |
kumaneko |
195 |
%define initrd_prereq dracut-kernel >= 004-408.el6 |
| 48 |
kumaneko |
155 |
%else |
| 49 |
kumaneko |
237 |
@@ -473,7 +473,7 @@ |
| 50 |
kumaneko |
155 |
AutoProv: yes\ |
| 51 |
|
|
%{nil} |
| 52 |
|
|
|
| 53 |
|
|
-Name: kernel%{?variant} |
| 54 |
|
|
+Name: cs-kernel%{?variant} |
| 55 |
|
|
Group: System Environment/Kernel |
| 56 |
|
|
License: GPLv2 |
| 57 |
|
|
URL: http://www.kernel.org/ |
| 58 |
kumaneko |
237 |
@@ -771,7 +771,7 @@ |
| 59 |
kumaneko |
155 |
Provides: kernel-devel-uname-r = %{KVERREL}%{?1:.%{1}}\ |
| 60 |
|
|
AutoReqProv: no\ |
| 61 |
|
|
Requires(pre): /usr/bin/find\ |
| 62 |
|
|
-%description -n kernel%{?variant}%{?1:-%{1}}-devel\ |
| 63 |
|
|
+%description -n cs-kernel%{?variant}%{?1:-%{1}}-devel\ |
| 64 |
|
|
This package provides kernel headers and makefiles sufficient to build modules\ |
| 65 |
|
|
against the %{?2:%{2} }kernel package.\ |
| 66 |
|
|
%{nil} |
| 67 |
kumaneko |
237 |
@@ -937,6 +937,10 @@ |
| 68 |
kumaneko |
155 |
|
| 69 |
|
|
ApplyOptionalPatch linux-kernel-test.patch |
| 70 |
|
|
|
| 71 |
|
|
+# CaitSith |
| 72 |
kumaneko |
241 |
+tar -zxf %_sourcedir/caitsith-patch-0.2-20170515.tar.gz |
| 73 |
kumaneko |
166 |
+sed -i -e 's/CCSECURITY/CAITSITH/g' -e 's/ccsecurity/caitsith/g' -e 's/ccs_domain_info/cs_domain_info/g' -e 's/ccs_flags/cs_flags/g' patches/ccs-patch-*.diff |
| 74 |
kumaneko |
155 |
+patch -sp1 < patches/ccs-patch-2.6.32-centos-6.diff |
| 75 |
|
|
# Any further pre-build tree manipulations happen here. |
| 76 |
|
|
|
| 77 |
|
|
chmod +x scripts/checkpatch.pl |
| 78 |
kumaneko |
237 |
@@ -961,6 +965,8 @@ |
| 79 |
kumaneko |
155 |
for i in *.config |
| 80 |
|
|
do |
| 81 |
|
|
mv $i .config |
| 82 |
|
|
+ # CaitSith |
| 83 |
|
|
+ cat config.caitsith >> .config |
| 84 |
|
|
Arch=`head -1 .config | cut -b 3-` |
| 85 |
|
|
make ARCH=$Arch %{oldconfig_target} > /dev/null |
| 86 |
|
|
echo "# $Arch" > configs/$i |
| 87 |
|
|
EOF |
| 88 |
|
|
echo "" |
| 89 |
|
|
echo "" |
| 90 |
|
|
echo "" |
| 91 |
kumaneko |
203 |
echo "Edit ~/rpmbuild/SPECS/cs-kernel.spec if needed, and run" |
| 92 |
|
|
echo "rpmbuild -bb ~/rpmbuild/SPECS/cs-kernel.spec" |
| 93 |
kumaneko |
155 |
echo "to build kernel rpm packages." |
| 94 |
|
|
echo "" |
| 95 |
|
|
ARCH=`uname -m` |
| 96 |
kumaneko |
203 |
echo "I'll start 'rpmbuild -bb --target $ARCH --with baseonly --without debug --without debuginfo ~/rpmbuild/SPECS/cs-kernel.spec' in 30 seconds. Press Ctrl-C to stop." |
| 97 |
kumaneko |
155 |
sleep 30 |
| 98 |
kumaneko |
203 |
exec rpmbuild -bb --target $ARCH --with baseonly --without debug --without debuginfo ~/rpmbuild/SPECS/cs-kernel.spec |
| 99 |
kumaneko |
155 |
exit 0 |