1 |
kumaneko |
4107 |
#! /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 |
kumaneko |
4976 |
if [ ! -r kernel-2.6.32-71.29.1.el6.src.rpm ] |
14 |
kumaneko |
4107 |
then |
15 |
kumaneko |
5252 |
wget http://ftp.riken.jp/Linux/centos/6.0/updates/SRPMS/kernel-2.6.32-71.29.1.el6.src.rpm || die "Can't download source package." |
16 |
kumaneko |
4107 |
fi |
17 |
kumaneko |
4976 |
rpm --checksig kernel-2.6.32-71.29.1.el6.src.rpm || die "Can't verify signature." |
18 |
|
|
rpm -ivh kernel-2.6.32-71.29.1.el6.src.rpm || die "Can't install source package." |
19 |
kumaneko |
4107 |
|
20 |
|
|
cd /root/rpmbuild/SOURCES/ || die "Can't chdir to /root/rpmbuild/SOURCES/ ." |
21 |
kumaneko |
5400 |
if [ ! -r ccs-patch-1.8.2-20110903.tar.gz ] |
22 |
kumaneko |
4107 |
then |
23 |
kumaneko |
5400 |
wget -O ccs-patch-1.8.2-20110903.tar.gz 'http://sourceforge.jp/frs/redir.php?f=/tomoyo/49684/ccs-patch-1.8.2-20110903.tar.gz' || die "Can't download patch." |
24 |
kumaneko |
4107 |
fi |
25 |
|
|
|
26 |
|
|
cd /root/rpmbuild/SPECS/ || die "Can't chdir to /root/rpmbuild/SPECS/ ." |
27 |
|
|
cp -p kernel.spec ccs-kernel.spec || die "Can't copy spec file." |
28 |
|
|
patch << "EOF" || die "Can't patch spec file." |
29 |
|
|
--- ccs-kernel.spec |
30 |
|
|
+++ ccs-kernel.spec |
31 |
kumaneko |
4175 |
@@ -15,7 +15,7 @@ |
32 |
kumaneko |
4107 |
# 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 |
5269 |
+%define buildid _tomoyo_1.8.2p2 |
37 |
kumaneko |
4107 |
|
38 |
|
|
%define rhel 1 |
39 |
|
|
%if %{rhel} |
40 |
kumaneko |
4175 |
@@ -453,7 +453,7 @@ |
41 |
|
|
# 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 |
|
|
%define initrd_prereq dracut-kernel >= 002-18.git413bcf78 |
48 |
|
|
%else |
49 |
|
|
@@ -489,7 +489,7 @@ |
50 |
kumaneko |
4107 |
AutoProv: yes\ |
51 |
|
|
%{nil} |
52 |
|
|
|
53 |
|
|
-Name: kernel%{?variant} |
54 |
|
|
+Name: ccs-kernel%{?variant} |
55 |
|
|
Group: System Environment/Kernel |
56 |
|
|
License: GPLv2 |
57 |
|
|
URL: http://www.kernel.org/ |
58 |
kumaneko |
4847 |
@@ -715,7 +715,7 @@ |
59 |
kumaneko |
4107 |
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 ccs-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 |
4847 |
@@ -881,6 +881,10 @@ |
68 |
kumaneko |
4107 |
|
69 |
|
|
ApplyOptionalPatch linux-kernel-test.patch |
70 |
|
|
|
71 |
|
|
+# TOMOYO Linux |
72 |
kumaneko |
5400 |
+tar -zxf %_sourcedir/ccs-patch-1.8.2-20110903.tar.gz |
73 |
kumaneko |
4400 |
+patch -sp1 < patches/ccs-patch-2.6.32-centos-6.0.diff |
74 |
kumaneko |
4107 |
+ |
75 |
|
|
# Any further pre-build tree manipulations happen here. |
76 |
|
|
|
77 |
|
|
chmod +x scripts/checkpatch.pl |
78 |
kumaneko |
4847 |
@@ -905,6 +909,9 @@ |
79 |
kumaneko |
4107 |
for i in *.config |
80 |
|
|
do |
81 |
|
|
mv $i .config |
82 |
|
|
+ # TOMOYO Linux |
83 |
|
|
+ cat config.ccs >> .config |
84 |
|
|
+ sed -i -e "s/CONFIG_DEBUG_INFO=.*/# CONFIG_DEBUG_INFO is not set/" -- .config |
85 |
|
|
Arch=`head -1 .config | cut -b 3-` |
86 |
|
|
make ARCH=$Arch %{oldconfig_target} > /dev/null |
87 |
|
|
echo "# $Arch" > configs/$i |
88 |
|
|
EOF |
89 |
|
|
echo "" |
90 |
|
|
echo "" |
91 |
|
|
echo "" |
92 |
|
|
echo "Edit /root/rpmbuild/SPECS/ccs-kernel.spec if needed, and run" |
93 |
|
|
echo "rpmbuild -bb /root/rpmbuild/SPECS/ccs-kernel.spec" |
94 |
|
|
echo "to build kernel rpm packages." |
95 |
|
|
echo "" |
96 |
|
|
ARCH=`uname -m` |
97 |
|
|
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." |
98 |
|
|
sleep 30 |
99 |
|
|
exec rpmbuild -bb --target $ARCH --with baseonly --without debug --without debuginfo /root/rpmbuild/SPECS/ccs-kernel.spec |
100 |
|
|
exit 0 |