39 |
beyerle@PS |
1 |
# -------------------------------------------------------------------------------------------
|
|
|
2 |
#
|
|
|
3 |
# How to build for normal kernel
|
|
|
4 |
#
|
|
|
5 |
# rpmbuild -ba --target i686 --define 'kernel 2.6.18-1.2747.el5' aufs.spec
|
|
|
6 |
# rpmbuild -ba --target x86_64 --define 'kernel 2.6.18-1.2747.el5' aufs.spec
|
|
|
7 |
#
|
|
|
8 |
# How to build for normal kernel and XEN kernel
|
|
|
9 |
#
|
|
|
10 |
# rpmbuild -ba --target i686 --define 'kernel 2.6.18-1.2747.el5' --define 'buildxen 1' aufs.spec
|
|
|
11 |
# rpmbuild -ba --target x86_64 --define 'kernel 2.6.18-1.2747.el5' --define 'buildxen 1' aufs.spec
|
|
|
12 |
#
|
|
|
13 |
# How to build for normal kernel and PAE kernel
|
|
|
14 |
#
|
|
|
15 |
# rpmbuild -ba --target i686 --define 'kernel 2.6.18-1.2747.el5' --define 'buildPAE 1' aufs.spec
|
|
|
16 |
# rpmbuild -ba --target x86_64 --define 'kernel 2.6.18-1.2747.el5' --define 'buildPAE 1' aufs.spec
|
|
|
17 |
#
|
|
|
18 |
# How to build for all kernel (normal, xen, PAE)
|
|
|
19 |
#
|
|
|
20 |
# rpmbuild -ba --target i686 --define 'kernel 2.6.18-1.2747.el5' --define 'buildall 1' aufs.spec
|
|
|
21 |
# rpmbuild -ba --target x86_64 --define 'kernel 2.6.18-1.2747.el5' --define 'buildall 1' aufs.spec
|
|
|
22 |
#
|
|
|
23 |
#
|
|
|
24 |
# How to build for the running kernel:
|
|
|
25 |
#
|
|
|
26 |
# rpmbuild -ba --target i686 aufs.spec
|
|
|
27 |
# rpmbuild -ba --target x86_64 aufs.spec
|
|
|
28 |
#
|
|
|
29 |
# -------------------------------------------------------------------------------------------
|
|
|
30 |
|
|
|
31 |
%{!?buildxen:%define buildxen 0}
|
|
|
32 |
%{!?buildPAE:%define buildPAE 0}
|
|
|
33 |
|
|
|
34 |
%{?buildall:%define buildxen 1}
|
|
|
35 |
%{?buildall:%define buildPAE 1}
|
|
|
36 |
|
|
|
37 |
%{?!kernel:%define kernel %(rpm -q kernel-devel | tail -1 | sed -e 's|kernel-devel-||')}
|
|
|
38 |
|
|
|
39 |
%define kversion %(echo "%{kernel}" | sed -e 's|-.*||')
|
|
|
40 |
%define krelease %(echo "%{kernel}" | sed -e 's|.*-||')
|
|
|
41 |
|
|
|
42 |
%define kernel_src_path %{_usrsrc}/kernels/%{kernel}-%{_target_cpu}
|
|
|
43 |
%define kernel_xen_src_path %{_usrsrc}/kernels/%{kernel}-xen-%{_target_cpu}
|
|
|
44 |
%define kernel_PAE_src_path %{_usrsrc}/kernels/%{kernel}-PAE-%{_target_cpu}
|
|
|
45 |
|
|
|
46 |
%define kernel_moduledir /lib/modules/%{kernel}
|
|
|
47 |
%define kernel_xen_moduledir /lib/modules/%{kernel}xen
|
|
|
48 |
%define kernel_PAE_moduledir /lib/modules/%{kernel}PAE
|
|
|
49 |
|
|
|
50 |
%define pkg_name aufs
|
|
|
51 |
%define kmdl_name kernel-module-%{pkg_name}-%{kernel}
|
|
|
52 |
|
|
|
53 |
# -------------------------------------------------------------------------------------------
|
|
|
54 |
|
|
|
55 |
### CVS Download
|
|
|
56 |
# cvs -d :pserver:anonymous@aufs.cvs.sourceforge.net:/cvsroot/aufs login
|
|
|
57 |
# cvs -z3 -d :pserver:anonymous@aufs.cvs.sourceforge.net:/cvsroot/aufs co -P aufs
|
|
|
58 |
# find aufs -name "CVS" | xargs rm -rf
|
|
|
59 |
#
|
|
|
60 |
# CVS checkout date
|
|
|
61 |
|
|
|
62 |
%define cvs_date 20070210
|
|
|
63 |
|
|
|
64 |
Summary: Another Unionfs
|
|
|
65 |
Name: %{pkg_name}
|
|
|
66 |
Version: 0.%{cvs_date}.cvs
|
|
|
67 |
Release: 2.sl5.psi
|
|
|
68 |
Epoch: 0
|
|
|
69 |
Packager: Urs Beyerle <urs.beyerle@psi.ch>
|
|
|
70 |
License: GPL
|
|
|
71 |
Group: System Environment/Kernel
|
|
|
72 |
Source0: aufs-cvs-%{cvs_date}.tar.gz
|
40 |
beyerle@PS |
73 |
Source1: aufs-unionctl.static
|
39 |
beyerle@PS |
74 |
Patch0: aufs-cpup_blksize.patch
|
|
|
75 |
URL: http://aufs.sourceforge.net
|
|
|
76 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
|
|
77 |
Requires: kernel-module-%{pkg_name} >= %{version}-%{release}
|
|
|
78 |
BuildRequires: kernel-devel = %{kernel}
|
|
|
79 |
%if %{buildxen}
|
|
|
80 |
BuildRequires: kernel-xen-devel = %{kernel}
|
|
|
81 |
%endif
|
|
|
82 |
%if %{buildPAE}
|
|
|
83 |
BuildRequires: kernel-PAE-devel = %{kernel}
|
|
|
84 |
%endif
|
|
|
85 |
|
|
|
86 |
%description
|
|
|
87 |
Aufs is a stackable unification filesystem such as Unionfs,
|
|
|
88 |
which unifies several directories and provides a merged single
|
|
|
89 |
directory. Aufs was entirely re-designed and re-implemented
|
|
|
90 |
Unionfs. After many original ideas, approaches and improvements,
|
|
|
91 |
it becomes totally different from Unionfs while keeping the
|
|
|
92 |
basic features. See Unionfs for the basic features.
|
|
|
93 |
|
|
|
94 |
Kernel modules for aufs are in kernel-module-%{pkg_name} rpms.
|
|
|
95 |
|
|
|
96 |
%package -n %{kmdl_name}
|
|
|
97 |
Summary: kernel modules for %{name}.
|
|
|
98 |
Group: System Environment/Kernel
|
|
|
99 |
License: GPL
|
|
|
100 |
Provides: kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
|
|
|
101 |
Requires: %{pkg_name}
|
|
|
102 |
|
|
|
103 |
%description -n %{kmdl_name}
|
|
|
104 |
Kernel modules for %{name}.
|
|
|
105 |
|
|
|
106 |
%if %{buildxen}
|
|
|
107 |
%package -n %{kmdl_name}xen
|
|
|
108 |
Summary: xen kernel modules for %{name}.
|
|
|
109 |
Group: System Environment/Kernel
|
|
|
110 |
License: GPL
|
|
|
111 |
Provides: kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
|
|
|
112 |
Requires: %{pkg_name}
|
|
|
113 |
|
|
|
114 |
%description -n %{kmdl_name}xen
|
|
|
115 |
XEN kernel modules for %{name}.
|
|
|
116 |
%endif
|
|
|
117 |
|
|
|
118 |
%if %{buildPAE}
|
|
|
119 |
%package -n %{kmdl_name}PAE
|
|
|
120 |
Summary: PAE kernel modules for %{name}.
|
|
|
121 |
Group: System Environment/Kernel
|
|
|
122 |
License: GPL
|
|
|
123 |
Provides: kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
|
|
|
124 |
Requires: %{pkg_name}
|
|
|
125 |
|
|
|
126 |
%description -n %{kmdl_name}PAE
|
|
|
127 |
PAE kernel modules for %{name}.
|
|
|
128 |
%endif
|
|
|
129 |
|
|
|
130 |
%prep
|
|
|
131 |
%setup -q -n aufs-cvs-%{cvs_date}
|
|
|
132 |
|
|
|
133 |
%patch0 -p1 -b .cpup.h
|
|
|
134 |
|
|
|
135 |
%build
|
|
|
136 |
echo -e "\nDriver version: %{version}\nKernel version: %{kernel}\n"
|
|
|
137 |
|
|
|
138 |
### kernel
|
|
|
139 |
make clean -f local.mk
|
|
|
140 |
make KDIR=%{kernel_src_path} -f local.mk
|
|
|
141 |
INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kernel}/kernel"
|
|
|
142 |
mkdir -p "${INST_MODLIB}/fs/aufs"
|
|
|
143 |
install -p -m 744 fs/aufs/aufs.ko "${INST_MODLIB}/fs/aufs/"
|
|
|
144 |
|
|
|
145 |
### install util and man page
|
|
|
146 |
mkdir -p ${RPM_BUILD_ROOT}/%{_prefix}/sbin
|
|
|
147 |
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man5
|
|
|
148 |
|
|
|
149 |
cp -a util/aufind.sh ${RPM_BUILD_ROOT}/%{_prefix}/sbin
|
|
|
150 |
cp -a util/aulchown ${RPM_BUILD_ROOT}/%{_prefix}/sbin
|
|
|
151 |
cp -a util/auplink ${RPM_BUILD_ROOT}/%{_prefix}/sbin
|
|
|
152 |
cp -a util/mount.aufs ${RPM_BUILD_ROOT}/%{_prefix}/sbin
|
|
|
153 |
cp -a util/umount.aufs ${RPM_BUILD_ROOT}/%{_prefix}/sbin
|
|
|
154 |
cp -a util/unionctl ${RPM_BUILD_ROOT}/%{_prefix}/sbin
|
|
|
155 |
|
|
|
156 |
cp -a util/aufs.5 ${RPM_BUILD_ROOT}/%{_mandir}/man5
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
### XEN kernel
|
|
|
160 |
%if %{buildxen}
|
|
|
161 |
|
|
|
162 |
make clean -f local.mk
|
|
|
163 |
make KDIR=%{kernel_xen_src_path} -f local.mk
|
|
|
164 |
INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kernel}xen/kernel"
|
|
|
165 |
mkdir -p "${INST_MODLIB}/fs/aufs"
|
|
|
166 |
install -p -m 744 fs/aufs/aufs.ko "${INST_MODLIB}/fs/aufs/"
|
|
|
167 |
|
|
|
168 |
%endif
|
|
|
169 |
|
|
|
170 |
### PAE kernel
|
|
|
171 |
%if %{buildPAE}
|
|
|
172 |
|
|
|
173 |
make clean -f local.mk
|
|
|
174 |
make KDIR=%{kernel_PAE_src_path} -f local.mk
|
|
|
175 |
INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kernel}PAE/kernel"
|
|
|
176 |
mkdir -p "${INST_MODLIB}/fs/aufs"
|
|
|
177 |
install -p -m 744 fs/aufs/aufs.ko "${INST_MODLIB}/fs/aufs/"
|
|
|
178 |
|
|
|
179 |
%endif
|
|
|
180 |
|
|
|
181 |
### build statically linked unionctl (for LiveCD with busybox)
|
|
|
182 |
# unionctl is a script - no statically linked version needed
|
|
|
183 |
# re-wrote unionctl in order that it works in busybox
|
|
|
184 |
# command rev is needed
|
|
|
185 |
|
|
|
186 |
cp -a %{SOURCE1} ${RPM_BUILD_ROOT}/%{_prefix}/sbin/unionctl.static
|
|
|
187 |
|
|
|
188 |
# make clean -f local.mk
|
|
|
189 |
# rm -f util/unionctl
|
|
|
190 |
# cp -a util/Makefile util/Makefile.ori
|
|
|
191 |
# sed -i "s|^CFLAGS += *.|CFLAGS += -O2 -Wall -static'|" util/Makefile
|
|
|
192 |
# make util/* -f local.mk
|
|
|
193 |
# mv -f util/unionctl util/unionctl.static
|
|
|
194 |
# mv -f util/Makefile.ori util/Makefile
|
|
|
195 |
# cp -a util/unionctl.static ${RPM_BUILD_ROOT}/%{_prefix}/sbin
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
%install
|
|
|
199 |
echo
|
|
|
200 |
|
|
|
201 |
|
|
|
202 |
%clean
|
|
|
203 |
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
|
|
204 |
|
|
|
205 |
%postun -n %{kmdl_name}
|
|
|
206 |
depmod -a %{kernel} >/dev/null 2>&1 || :
|
|
|
207 |
|
|
|
208 |
%post -n %{kmdl_name}
|
|
|
209 |
depmod -a %{kernel} >/dev/null 2>&1 || :
|
|
|
210 |
|
|
|
211 |
%if %{buildxen}
|
|
|
212 |
%postun -n %{kmdl_name}xen
|
|
|
213 |
depmod -a %{kernel}xen >/dev/null 2>&1 || :
|
|
|
214 |
|
|
|
215 |
%post -n %{kmdl_name}xen
|
|
|
216 |
depmod -a %{kernel}xen >/dev/null 2>&1 || :
|
|
|
217 |
%endif
|
|
|
218 |
|
|
|
219 |
%if %{buildPAE}
|
|
|
220 |
%postun -n %{kmdl_name}PAE
|
|
|
221 |
depmod -a %{kernel}PAE >/dev/null 2>&1 || :
|
|
|
222 |
|
|
|
223 |
%post -n %{kmdl_name}PAE
|
|
|
224 |
depmod -a %{kernel}PAE >/dev/null 2>&1 || :
|
|
|
225 |
%endif
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
%files
|
|
|
229 |
%defattr(-,root,root,-)
|
|
|
230 |
%doc COPYING History README
|
|
|
231 |
%{_prefix}/sbin/*
|
|
|
232 |
%{_mandir}/man5/*
|
|
|
233 |
|
|
|
234 |
%files -n %{kmdl_name}
|
|
|
235 |
%defattr(-,root,root,-)
|
|
|
236 |
/lib/modules/%{kernel}/kernel/fs/aufs
|
|
|
237 |
|
|
|
238 |
%if %{buildxen}
|
|
|
239 |
%files -n %{kmdl_name}xen
|
|
|
240 |
%defattr(-,root,root,-)
|
|
|
241 |
/lib/modules/%{kernel}xen/kernel/fs/aufs
|
|
|
242 |
%endif
|
|
|
243 |
|
|
|
244 |
%if %{buildPAE}
|
|
|
245 |
%files -n %{kmdl_name}PAE
|
|
|
246 |
%defattr(-,root,root,-)
|
|
|
247 |
/lib/modules/%{kernel}PAE/kernel/fs/aufs
|
|
|
248 |
%endif
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
%changelog
|
|
|
252 |
* Mon Feb 12 2007 Urs Beyerle <urs.beyerle@psi.ch> 0.20070210.cvs-2.sl5.psi
|
|
|
253 |
- add unionctl.static as SOURCE2
|
|
|
254 |
unionctl which runs inside busybox
|
|
|
255 |
|
|
|
256 |
* Sat Feb 10 2007 Urs Beyerle <urs.beyerle@psi.ch> 0.20070210.cvs-1.sl5.psi
|
|
|
257 |
- intial build
|