1 |
#! /bin/sh |
2 |
# |
3 |
# This is a kernel build script for CentOS 6.0'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 |
if [ ! -r kernel-2.6.32-71.14.1.el6.src.rpm ] |
14 |
then |
15 |
wget http://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/kernel-2.6.32-71.14.1.el6.src.rpm || die "Can't download source package." |
16 |
fi |
17 |
rpm --checksig kernel-2.6.32-71.14.1.el6.src.rpm || die "Can't verify signature." |
18 |
rpm -ivh kernel-2.6.32-71.14.1.el6.src.rpm || die "Can't install source package." |
19 |
|
20 |
cd /root/rpmbuild/SOURCES/ || die "Can't chdir to /root/rpmbuild/SOURCES/ ." |
21 |
if [ ! -r ccs-patch-1.8.0-20101231.tar.gz ] |
22 |
then |
23 |
wget -O ccs-patch-1.8.0-20101231.tar.gz 'http://sourceforge.jp/frs/redir.php?f=/tomoyo/49684/ccs-patch-1.8.0-20101231.tar.gz' || die "Can't download patch." |
24 |
fi |
25 |
|
26 |
if [ ! -r ccs-patch-2.6.32-centos-6.0-1.8.0-20110112.diff ] |
27 |
then |
28 |
wget -O ccs-patch-2.6.32-centos-6.0-1.8.0-20110112.diff 'http://sourceforge.jp/projects/tomoyo/svn/view/trunk/1.8.x/ccs-patch/patches/ccs-patch-2.6.32-centos-6.0.diff?root=tomoyo&revision=4346&content-type=text%2Fplain' |
29 |
fi |
30 |
|
31 |
cd /root/rpmbuild/SPECS/ || die "Can't chdir to /root/rpmbuild/SPECS/ ." |
32 |
cp -p kernel.spec ccs-kernel.spec || die "Can't copy spec file." |
33 |
patch << "EOF" || die "Can't patch spec file." |
34 |
--- ccs-kernel.spec |
35 |
+++ ccs-kernel.spec |
36 |
@@ -15,7 +15,7 @@ |
37 |
# that the kernel isn't the stock distribution kernel, for example, |
38 |
# by setting the define to ".local" or ".bz123456" |
39 |
# |
40 |
-# % define buildid .local |
41 |
+%define buildid _tomoyo_1.8.0 |
42 |
|
43 |
%define rhel 1 |
44 |
%if %{rhel} |
45 |
@@ -453,7 +453,7 @@ |
46 |
# Packages that need to be installed before the kernel is, because the %post |
47 |
# scripts use them. |
48 |
# |
49 |
-%define kernel_prereq fileutils, module-init-tools, initscripts >= 8.11.1-1, kernel-firmware >= %{rpmversion}-%{pkg_release}, grubby >= 7.0.4-1 |
50 |
+%define kernel_prereq fileutils, module-init-tools, initscripts >= 8.11.1-1, grubby >= 7.0.4-1 |
51 |
%if %{with_dracut} |
52 |
%define initrd_prereq dracut-kernel >= 002-18.git413bcf78 |
53 |
%else |
54 |
@@ -489,7 +489,7 @@ |
55 |
AutoProv: yes\ |
56 |
%{nil} |
57 |
|
58 |
-Name: kernel%{?variant} |
59 |
+Name: ccs-kernel%{?variant} |
60 |
Group: System Environment/Kernel |
61 |
License: GPLv2 |
62 |
URL: http://www.kernel.org/ |
63 |
@@ -713,7 +713,7 @@ |
64 |
Provides: kernel-devel-uname-r = %{KVERREL}%{?1:.%{1}}\ |
65 |
AutoReqProv: no\ |
66 |
Requires(pre): /usr/bin/find\ |
67 |
-%description -n kernel%{?variant}%{?1:-%{1}}-devel\ |
68 |
+%description -n ccs-kernel%{?variant}%{?1:-%{1}}-devel\ |
69 |
This package provides kernel headers and makefiles sufficient to build modules\ |
70 |
against the %{?2:%{2} }kernel package.\ |
71 |
%{nil} |
72 |
@@ -879,6 +879,10 @@ |
73 |
|
74 |
ApplyOptionalPatch linux-kernel-test.patch |
75 |
|
76 |
+# TOMOYO Linux |
77 |
+tar -zxf %_sourcedir/ccs-patch-1.8.0-20101231.tar.gz |
78 |
+patch -sp1 < %_sourcedir/ccs-patch-2.6.32-centos-6.0-1.8.0-20100112.diff |
79 |
+ |
80 |
# Any further pre-build tree manipulations happen here. |
81 |
|
82 |
chmod +x scripts/checkpatch.pl |
83 |
@@ -903,6 +907,9 @@ |
84 |
for i in *.config |
85 |
do |
86 |
mv $i .config |
87 |
+ # TOMOYO Linux |
88 |
+ cat config.ccs >> .config |
89 |
+ sed -i -e "s/CONFIG_DEBUG_INFO=.*/# CONFIG_DEBUG_INFO is not set/" -- .config |
90 |
Arch=`head -1 .config | cut -b 3-` |
91 |
make ARCH=$Arch %{oldconfig_target} > /dev/null |
92 |
echo "# $Arch" > configs/$i |
93 |
EOF |
94 |
echo "" |
95 |
echo "" |
96 |
echo "" |
97 |
echo "Edit /root/rpmbuild/SPECS/ccs-kernel.spec if needed, and run" |
98 |
echo "rpmbuild -bb /root/rpmbuild/SPECS/ccs-kernel.spec" |
99 |
echo "to build kernel rpm packages." |
100 |
echo "" |
101 |
ARCH=`uname -m` |
102 |
echo "I'll start 'rpmbuild -bb --target $ARCH --with baseonly --without debug --without debuginfo /root/rpmbuild/SPECS/ccs-kernel.spec' in 30 seconds. Press Ctrl-C to stop." |
103 |
sleep 30 |
104 |
exec rpmbuild -bb --target $ARCH --with baseonly --without debug --without debuginfo /root/rpmbuild/SPECS/ccs-kernel.spec |
105 |
exit 0 |