1 |
#! /bin/sh |
2 |
# |
3 |
# This is a kernel build script for CentOS 3'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-63.EL.src.rpm ] |
14 |
then |
15 |
wget http://vault.centos.org/3.9/updates/SRPMS/kernel-2.4.21-63.EL.src.rpm || die "Can't download source package." |
16 |
fi |
17 |
LANG=C rpm --checksig kernel-2.4.21-63.EL.src.rpm | grep -F ': (sha1) dsa sha1 md5 gpg OK' || die "Can't verify signature." |
18 |
rpm -ivh kernel-2.4.21-63.EL.src.rpm || die "Can't install source package." |
19 |
|
20 |
cd /usr/src/redhat/SOURCES/ || die "Can't chdir to /usr/src/redhat/SOURCES/ ." |
21 |
if [ ! -r ccs-patch-1.8.3-20150421.tar.gz ] |
22 |
then |
23 |
wget -O ccs-patch-1.8.3-20150421.tar.gz 'http://sourceforge.jp/frs/redir.php?f=/tomoyo/49684/ccs-patch-1.8.3-20150421.tar.gz' || die "Can't download patch." |
24 |
fi |
25 |
|
26 |
cd /tmp/ || die "Can't chdir to /tmp/ ." |
27 |
cp -p /usr/src/redhat/SPECS/kernel-2.4.spec . || die "Can't copy spec file." |
28 |
patch << "EOF" || die "Can't patch spec file." |
29 |
--- kernel-2.4.spec |
30 |
+++ kernel-2.4.spec |
31 |
@@ -20,7 +20,7 @@ |
32 |
# that the kernel isn't the stock RHL kernel, for example by |
33 |
# adding some text to the end of the version number. |
34 |
# |
35 |
-%define release 63.EL |
36 |
+%define release 63.EL_tomoyo_1.8.3p10 |
37 |
%define sublevel 21 |
38 |
%define kversion 2.4.%{sublevel} |
39 |
# /usr/src/%{kslnk} -> /usr/src/linux-%{KVERREL} |
40 |
@@ -133,7 +133,7 @@ |
41 |
%define kernel_prereq fileutils, modutils >= 2.4.18, initscripts >= 5.83, mkinitrd >= 3.2.6 |
42 |
|
43 |
|
44 |
-Name: kernel |
45 |
+Name: ccs-kernel |
46 |
Group: System Environment/Kernel |
47 |
License: GPLv2 |
48 |
Version: %{kversion} |
49 |
@@ -1921,6 +1921,10 @@ |
50 |
|
51 |
# END OF PATCH APPLICATIONS |
52 |
|
53 |
+# TOMOYO Linux |
54 |
+tar -zxf %_sourcedir/ccs-patch-1.8.3-20150421.tar.gz |
55 |
+patch -sp1 < patches/ccs-patch-2.4.21-centos-3.diff |
56 |
+ |
57 |
cp %{SOURCE10} Documentation/ |
58 |
|
59 |
mkdir configs |
60 |
@@ -1976,6 +1980,8 @@ |
61 |
# since make mrproper wants to wipe out .config files, we move our mrproper |
62 |
# up before we copy the config files around. |
63 |
cp configs/kernel-%{kversion}-$Config.config .config |
64 |
+ # TOMOYO Linux |
65 |
+ cat config.ccs >> .config |
66 |
# make sure EXTRAVERSION says what we want it to say |
67 |
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}$2/" Makefile |
68 |
|
69 |
EOF |
70 |
mv kernel-2.4.spec ccs-kernel.spec || die "Can't rename spec file." |
71 |
echo "" |
72 |
echo "" |
73 |
echo "" |
74 |
echo "Edit /tmp/ccs-kernel.spec if needed, and run" |
75 |
echo "rpmbuild -bb /tmp/ccs-kernel.spec" |
76 |
echo "to build kernel rpm packages." |
77 |
echo "" |
78 |
ARCH=`uname -m` |
79 |
echo "I'll start 'rpmbuild -bb --target $ARCH /tmp/ccs-kernel.spec' in 30 seconds. Press Ctrl-C to stop." |
80 |
sleep 30 |
81 |
patch << "EOF" || die "Can't patch spec file." |
82 |
--- /tmp/ccs-kernel.spec |
83 |
+++ /tmp/ccs-kernel.spec |
84 |
@@ -4,11 +4,11 @@ |
85 |
# These are the kernels that are built IF the architecture allows and |
86 |
# no contrary --with/--without arguments are given on the command line. |
87 |
|
88 |
-%define buildup 1 |
89 |
+%define buildup 0 |
90 |
%define buildsmp 1 |
91 |
-%define buildBOOT 1 |
92 |
-%define buildhugemem 1 |
93 |
-%define buildsource 1 |
94 |
+%define buildBOOT 0 |
95 |
+%define buildhugemem 0 |
96 |
+%define buildsource 0 |
97 |
|
98 |
# Versions of various parts |
99 |
%define rh_release_major 3 |
100 |
EOF |
101 |
exec rpmbuild -bb --target $ARCH /tmp/ccs-kernel.spec |
102 |
exit 0 |