1 |
kumaneko |
6360 |
#! /bin/sh |
2 |
|
|
# |
3 |
|
|
# This is a kernel build script for Fedora 20's 3.17 kernel. |
4 |
|
|
# |
5 |
|
|
|
6 |
|
|
die () { |
7 |
|
|
echo $1 |
8 |
|
|
exit 1 |
9 |
|
|
} |
10 |
|
|
|
11 |
|
|
yum -y install tar wget rpm-build make gcc patch redhat-rpm-config xmlto asciidoc gnupg elfutils-devel zlib-devel binutils-devel newt-devel python-devel perl-ExtUtils-Embed pciutils-devel hmaccalc bison net-tools audit-libs-devel pesign bc ncurses-devel |
12 |
|
|
|
13 |
|
|
cd /tmp/ || die "Can't chdir to /tmp/ ." |
14 |
|
|
|
15 |
kumaneko |
6362 |
if [ ! -r kernel-3.17.3-200.fc20.src.rpm ] |
16 |
kumaneko |
6360 |
then |
17 |
kumaneko |
6362 |
wget http://ftp.riken.jp/Linux/fedora/updates/20/SRPMS/kernel-3.17.3-200.fc20.src.rpm || die "Can't download source package." |
18 |
kumaneko |
6360 |
fi |
19 |
kumaneko |
6362 |
rpm --checksig kernel-3.17.3-200.fc20.src.rpm || die "Can't verify signature." |
20 |
|
|
rpm -ivh kernel-3.17.3-200.fc20.src.rpm || die "Can't install source package." |
21 |
kumaneko |
6360 |
|
22 |
|
|
cd /root/rpmbuild/SOURCES/ || die "Can't chdir to /root/rpmbuild/SOURCES/ ." |
23 |
|
|
if [ ! -r ccs-patch-1.8.3-20140915.tar.gz ] |
24 |
|
|
then |
25 |
|
|
wget -O ccs-patch-1.8.3-20140915.tar.gz 'http://sourceforge.jp/frs/redir.php?f=/tomoyo/49684/ccs-patch-1.8.3-20140915.tar.gz' || die "Can't download patch." |
26 |
|
|
fi |
27 |
|
|
|
28 |
|
|
cd /root/rpmbuild/SPECS/ || die "Can't chdir to /root/rpmbuild/SPECS/ ." |
29 |
|
|
cp -p kernel.spec ccs-kernel.spec || die "Can't copy spec file." |
30 |
|
|
patch << "EOF" || die "Can't patch spec file." |
31 |
|
|
--- ccs-kernel.spec |
32 |
|
|
+++ ccs-kernel.spec |
33 |
|
|
@@ -31,7 +31,7 @@ |
34 |
|
|
# |
35 |
|
|
# (Uncomment the '#' and both spaces below to set the buildid.) |
36 |
|
|
# |
37 |
|
|
-# % define buildid .local |
38 |
|
|
+%define buildid _tomoyo_1.8.3p7 |
39 |
|
|
################################################################### |
40 |
|
|
|
41 |
|
|
# The buildid can also be specified on the rpmbuild command line |
42 |
|
|
@@ -477,7 +477,7 @@ |
43 |
|
|
AutoProv: yes\ |
44 |
|
|
%{nil} |
45 |
|
|
|
46 |
|
|
-Name: kernel%{?variant} |
47 |
|
|
+Name: ccs-kernel%{?variant} |
48 |
|
|
Group: System Environment/Kernel |
49 |
|
|
License: GPLv2 and Redistributable, no modification permitted |
50 |
|
|
URL: http://www.kernel.org/ |
51 |
kumaneko |
6362 |
@@ -959,7 +959,7 @@ |
52 |
kumaneko |
6360 |
AutoReqProv: no\ |
53 |
|
|
Requires(pre): /usr/bin/find\ |
54 |
|
|
Requires: perl\ |
55 |
|
|
-%description -n kernel%{?variant}%{?1:-%{1}}-devel\ |
56 |
|
|
+%description -n ccs-kernel%{?variant}%{?1:-%{1}}-devel\ |
57 |
|
|
This package provides kernel headers and makefiles sufficient to build modules\ |
58 |
|
|
against the %{?2:%{2} }kernel package.\ |
59 |
|
|
%{nil} |
60 |
kumaneko |
6362 |
@@ -979,7 +979,7 @@ |
61 |
kumaneko |
6360 |
Provides: kernel%{?1:-%{1}}-modules-extra-uname-r = %{KVERREL}%{?1:+%{1}}\ |
62 |
|
|
Requires: kernel-uname-r = %{KVERREL}%{?1:+%{1}}\ |
63 |
|
|
AutoReqProv: no\ |
64 |
|
|
-%description -n kernel%{?variant}%{?1:-%{1}}-modules-extra\ |
65 |
|
|
+%description -n ccs-kernel%{?variant}%{?1:-%{1}}-modules-extra\ |
66 |
|
|
This package provides less commonly used kernel modules for the %{?2:%{2} }kernel package.\ |
67 |
|
|
%{nil} |
68 |
|
|
|
69 |
kumaneko |
6362 |
@@ -1521,6 +1521,10 @@ |
70 |
kumaneko |
6360 |
|
71 |
|
|
# END OF PATCH APPLICATIONS |
72 |
|
|
|
73 |
|
|
+# TOMOYO Linux |
74 |
|
|
+tar -zxf %_sourcedir/ccs-patch-1.8.3-20140915.tar.gz |
75 |
kumaneko |
6361 |
+patch -sp1 < patches/ccs-patch-3.17-fedora-20.diff |
76 |
kumaneko |
6360 |
+ |
77 |
|
|
%endif |
78 |
|
|
|
79 |
|
|
# Any further pre-build tree manipulations happen here. |
80 |
kumaneko |
6362 |
@@ -1545,6 +1549,17 @@ |
81 |
kumaneko |
6360 |
for i in *.config |
82 |
|
|
do |
83 |
|
|
mv $i .config |
84 |
|
|
+ # TOMOYO Linux 2.5 |
85 |
|
|
+ sed -i -e 's/# CONFIG_SECURITY_PATH is not set/CONFIG_SECURITY_PATH=y/' -- .config |
86 |
|
|
+ sed -i -e 's/# CONFIG_SECURITY_TOMOYO is not set/CONFIG_SECURITY_TOMOYO=y/' -- .config |
87 |
|
|
+ echo 'CONFIG_SECURITY_TOMOYO_MAX_ACCEPT_ENTRY=2048' >> .config |
88 |
|
|
+ echo 'CONFIG_SECURITY_TOMOYO_MAX_AUDIT_LOG=1024' >> .config |
89 |
|
|
+ echo '# CONFIG_SECURITY_TOMOYO_OMIT_USERSPACE_LOADER is not set' >> .config |
90 |
|
|
+ echo 'CONFIG_SECURITY_TOMOYO_POLICY_LOADER="/sbin/tomoyo-init"' >> .config |
91 |
|
|
+ echo 'CONFIG_SECURITY_TOMOYO_ACTIVATION_TRIGGER="/sbin/init"' >> .config |
92 |
|
|
+ echo '# CONFIG_DEFAULT_SECURITY_TOMOYO is not set' >> .config |
93 |
|
|
+ # TOMOYO Linux 1.8 |
94 |
|
|
+ cat config.ccs >> .config |
95 |
|
|
Arch=`head -1 .config | cut -b 3-` |
96 |
|
|
make ARCH=$Arch listnewconfig | grep -E '^CONFIG_' >.newoptions || true |
97 |
|
|
%if %{listnewconfig_fail} |
98 |
|
|
EOF |
99 |
|
|
echo "" |
100 |
|
|
echo "" |
101 |
|
|
echo "" |
102 |
|
|
echo "Edit /root/rpmbuild/SPECS/ccs-kernel.spec if needed, and run" |
103 |
|
|
echo "rpmbuild -bb /root/rpmbuild/SPECS/ccs-kernel.spec" |
104 |
|
|
echo "to build kernel rpm packages." |
105 |
|
|
echo "" |
106 |
|
|
ARCH=`uname -m` |
107 |
|
|
echo "I'll start 'rpmbuild -bb --target $ARCH --without debug --without debuginfo /root/rpmbuild/SPECS/ccs-kernel.spec' in 30 seconds. Press Ctrl-C to stop." |
108 |
|
|
sleep 30 |
109 |
|
|
exec rpmbuild -bb --target $ARCH --without debug --without debuginfo /root/rpmbuild/SPECS/ccs-kernel.spec |
110 |
|
|
exit 0 |