1 |
#! /bin/sh |
2 |
# |
3 |
# This is a kernel build script for CentOS 4.8's 2.6.9 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.9-89.0.18.EL.src.rpm ] |
14 |
then |
15 |
wget http://ftp.riken.jp/Linux/centos/4.8/updates/SRPMS/kernel-2.6.9-89.0.18.EL.src.rpm || die "Can't download source package." |
16 |
fi |
17 |
rpm -ivh kernel-2.6.9-89.0.18.EL.src.rpm || die "Can't install source package." |
18 |
|
19 |
cd /usr/src/redhat/SOURCES/ || die "Can't chdir to /usr/src/redhat/SOURCES/ ." |
20 |
if [ ! -r ccs-patch-1.7.1-20091111.tar.gz ] |
21 |
then |
22 |
wget http://osdn.dl.sourceforge.jp/tomoyo/43375/ccs-patch-1.7.1-20091111.tar.gz || die "Can't download patch." |
23 |
fi |
24 |
|
25 |
if [ ! -r ccs-patch-1.7.1-20091208.tar.gz ] |
26 |
then |
27 |
mkdir -p ccs-patch.tmp || die "Can't create directory." |
28 |
cd ccs-patch.tmp/ || die "Can't change directory." |
29 |
wget -O hotfix.patch 'http://sourceforge.jp/projects/tomoyo/svn/view/trunk/1.7.x/ccs-patch/patches/hotfix.patch?revision=3240&root=tomoyo' || die "Can't download hotfix." |
30 |
tar -zxf ../ccs-patch-1.7.1-20091111.tar.gz || die "Can't extract tar ball." |
31 |
patch -p1 < hotfix.patch || die "Can't apply hotfix." |
32 |
rm -f hotfix.patch || die "Can't delete hotfix." |
33 |
tar -zcf ../ccs-patch-1.7.1-20091208.tar.gz -- * || die "Can't create tar ball." |
34 |
cd ../ || die "Can't change directory." |
35 |
rm -fR ccs-patch.tmp || die "Can't delete directory." |
36 |
fi |
37 |
|
38 |
cd /tmp/ || die "Can't chdir to /tmp/ ." |
39 |
cp -p /usr/src/redhat/SPECS/kernel-2.6.spec . || die "Can't copy spec file." |
40 |
patch << "EOF" || die "Can't patch spec file." |
41 |
--- kernel-2.6.spec 2009-12-16 03:49:04.000000000 +0900 |
42 |
+++ kernel-2.6.spec 2009-12-17 09:26:23.000000000 +0900 |
43 |
@@ -27,7 +27,7 @@ |
44 |
# that the kernel isn't the stock distribution kernel, for example by |
45 |
# adding some text to the end of the version number. |
46 |
# |
47 |
-%define release 89.0.18.EL |
48 |
+%define release 89.0.18.EL_tomoyo_1.7.1 |
49 |
%define sublevel 9 |
50 |
%define kversion 2.6.%{sublevel} |
51 |
%define rpmversion 2.6.%{sublevel} |
52 |
@@ -140,6 +140,9 @@ |
53 |
# to versions below the minimum |
54 |
# |
55 |
|
56 |
+# TOMOYO Linux |
57 |
+%define signmodules 0 |
58 |
+ |
59 |
# |
60 |
# First the general kernel 2.6 required versions as per |
61 |
# Documentation/Changes |
62 |
@@ -176,7 +179,7 @@ |
63 |
%define __find_provides /usr/lib/rpm/redhat/find-kmod-provides.sh |
64 |
%define __find_requires %{nil} |
65 |
|
66 |
-Name: kernel |
67 |
+Name: ccs-kernel |
68 |
Group: System Environment/Kernel |
69 |
License: GPLv2 |
70 |
Version: %{rpmversion} |
71 |
@@ -5539,6 +5542,10 @@ |
72 |
|
73 |
# END OF PATCH APPLICATIONS |
74 |
|
75 |
+# TOMOYO Linux |
76 |
+tar -zxf %_sourcedir/ccs-patch-1.7.1-20091208.tar.gz |
77 |
+patch -sp1 < patches/ccs-patch-2.6.9-centos-4.8.diff |
78 |
+ |
79 |
cp %{SOURCE10} Documentation/ |
80 |
|
81 |
mkdir configs |
82 |
@@ -5550,6 +5557,9 @@ |
83 |
for i in *.config |
84 |
do |
85 |
mv $i .config |
86 |
+ # TOMOYO Linux |
87 |
+ cat config.ccs >> .config |
88 |
+ sed -i -e "s/^CONFIG_DEBUG_INFO=.*/# CONFIG_DEBUG_INFO is not set/" -- .config |
89 |
make ARCH=`echo $i | cut -d"-" -f3 | cut -d"." -f1 | sed -e s/i.86/i386/ -e s/s390x/s390/ -e s/ppc64.series/ppc64/ ` nonint_oldconfig > /dev/null |
90 |
cp .config configs/$i |
91 |
done |
92 |
EOF |
93 |
mv kernel-2.6.spec ccs-kernel.spec || die "Can't rename spec file." |
94 |
echo "" |
95 |
echo "" |
96 |
echo "" |
97 |
echo "Edit /tmp/ccs-kernel.spec if needed, and run" |
98 |
echo "rpmbuild -bb /tmp/ccs-kernel.spec" |
99 |
echo "to build kernel rpm packages." |
100 |
exit 0 |