1 |
#! /bin/sh |
2 |
# |
3 |
# This is a kernel build script for CentOS 3.9's 2.4.21 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.4.21-60.EL.src.rpm ] |
14 |
then |
15 |
wget http://ftp.riken.jp/Linux/centos/3.9/updates/SRPMS/kernel-2.4.21-60.EL.src.rpm || die "Can't download source package." |
16 |
fi |
17 |
rpm -ivh kernel-2.4.21-60.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.0-20090903.tar.gz ] |
21 |
then |
22 |
wget http://osdn.dl.sourceforge.jp/tomoyo/43375/ccs-patch-1.7.0-20090903.tar.gz || die "Can't download patch." |
23 |
fi |
24 |
|
25 |
cd /tmp/ || die "Can't chdir to /tmp/ ." |
26 |
cp -p /usr/src/redhat/SPECS/kernel-2.4.spec . || die "Can't copy spec file." |
27 |
patch << "EOF" || die "Can't patch spec file." |
28 |
--- kernel-2.4.spec 2008-05-07 18:06:28.000000000 +0900 |
29 |
+++ kernel-2.4.spec 2008-12-10 10:45:59.000000000 +0900 |
30 |
@@ -20,7 +20,7 @@ |
31 |
# that the kernel isn't the stock RHL kernel, for example by |
32 |
# adding some text to the end of the version number. |
33 |
# |
34 |
-%define release 60.EL |
35 |
+%define release 60.EL_tomoyo_1.7.0 |
36 |
%define sublevel 21 |
37 |
%define kversion 2.4.%{sublevel} |
38 |
# /usr/src/%{kslnk} -> /usr/src/linux-%{KVERREL} |
39 |
@@ -133,7 +133,7 @@ |
40 |
%define kernel_prereq fileutils, modutils >= 2.4.18, initscripts >= 5.83, mkinitrd >= 3.2.6 |
41 |
|
42 |
|
43 |
-Name: kernel |
44 |
+Name: ccs-kernel |
45 |
Group: System Environment/Kernel |
46 |
License: GPLv2 |
47 |
Version: %{kversion} |
48 |
@@ -1890,6 +1890,10 @@ |
49 |
|
50 |
# END OF PATCH APPLICATIONS |
51 |
|
52 |
+# TOMOYO Linux |
53 |
+tar -zxf %_sourcedir/ccs-patch-1.7.0-20090903.tar.gz |
54 |
+patch -sp1 < patches/ccs-patch-2.4.21-centos-3.9.diff |
55 |
+ |
56 |
cp %{SOURCE10} Documentation/ |
57 |
|
58 |
mkdir configs |
59 |
@@ -1945,6 +1949,8 @@ |
60 |
# since make mrproper wants to wipe out .config files, we move our mrproper |
61 |
# up before we copy the config files around. |
62 |
cp configs/kernel-%{kversion}-$Config.config .config |
63 |
+ # TOMOYO Linux |
64 |
+ cat config.ccs >> .config |
65 |
# make sure EXTRAVERSION says what we want it to say |
66 |
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}$2/" Makefile |
67 |
|
68 |
EOF |
69 |
mv kernel-2.4.spec ccs-kernel.spec || die "Can't rename spec file." |
70 |
echo "" |
71 |
echo "" |
72 |
echo "" |
73 |
echo "Edit /tmp/ccs-kernel.spec if needed, and run" |
74 |
echo "rpmbuild -bb /tmp/ccs-kernel.spec" |
75 |
echo "to build kernel rpm packages." |
76 |
exit 0 |