1 |
# kernel version |
2 |
%define kernelversion 3 |
3 |
%define patchlevel 0 |
4 |
# sublevel is now used for -stable patches |
5 |
%define sublevel 9 |
6 |
|
7 |
# kernel Makefile extraversion is substituted by |
8 |
# kpatch/kgit wich are either 0 (empty), rc (kpatch), git (kgit) |
9 |
%define kpatch 0 |
10 |
|
11 |
# kernel.org -gitX patch (only the number after "git") |
12 |
%define kgit 0 |
13 |
|
14 |
# this is the releaseversion |
15 |
%define mgarelease 1 |
16 |
|
17 |
# this is the -rt release |
18 |
%define rt_rel rt25 |
19 |
|
20 |
# This is only to make life easier for people that creates derivated kernels |
21 |
# a.k.a name it kernel-tmb :) |
22 |
%define kname kernel-rt |
23 |
|
24 |
%define rpmtag %{distsuffix}%{mgaver} |
25 |
%if %kpatch |
26 |
%if %kgit |
27 |
%define rpmrel %mkrel 0.%{kpatch}.%{kgit}.%{rt_rel}.%{mgarelease} |
28 |
%else |
29 |
%define rpmrel %mkrel 0.%{kpatch}.%{rt_rel}.%{mgarelease} |
30 |
%endif |
31 |
%else |
32 |
%define rpmrel %mkrel 0.%{rt_rel}.%{mgarelease} |
33 |
%endif |
34 |
|
35 |
# theese two never change, they are used to fool rpm/urpmi/smart |
36 |
%define fakever 1 |
37 |
%define fakerel %mkrel 1 |
38 |
|
39 |
# When we are using a pre/rc patch, the tarball is a sublevel -1 |
40 |
%if %kpatch |
41 |
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel} |
42 |
%define tar_ver %{kernelversion}.%(expr %{patchlevel} - 1) |
43 |
%else |
44 |
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel} |
45 |
%define tar_ver %{kernelversion}.%{patchlevel} |
46 |
%endif |
47 |
%define kverrel %{kversion}-%{rpmrel} |
48 |
|
49 |
# used for not making too long names for rpms or search paths |
50 |
%if %kpatch |
51 |
%if %kgit |
52 |
%define buildrpmrel 0.%{kpatch}.%{kgit}.%{rt_rel}.%{mgarelease}%{rpmtag} |
53 |
%else |
54 |
%define buildrpmrel 0.%{kpatch}.%{rt_rel}.%{mgarelease}%{rpmtag} |
55 |
%endif |
56 |
%else |
57 |
%define buildrpmrel 0.%{rt_rel}.%{mgarelease}%{rpmtag} |
58 |
%endif |
59 |
|
60 |
%define buildrel %{kversion}-%{buildrpmrel} |
61 |
|
62 |
%define rt_notice NOTE: This kernel has no Mageia patches besides the -rt patch and no third-party drivers. |
63 |
|
64 |
# having different top level names for packges means that you have to remove them by hard :( |
65 |
%define top_dir_name %{kname}-%{_arch} |
66 |
|
67 |
%define build_dir ${RPM_BUILD_DIR}/%{top_dir_name} |
68 |
%define src_dir %{build_dir}/linux-%{tar_ver} |
69 |
|
70 |
# disable useless debug rpms... |
71 |
%define _enable_debug_packages %{nil} |
72 |
%define debug_package %{nil} |
73 |
|
74 |
# build defines |
75 |
%define build_doc 1 |
76 |
%define build_source 1 |
77 |
%define build_devel 1 |
78 |
|
79 |
%define build_kernel 1 |
80 |
|
81 |
%define distro_branch %(perl -pe '/(\\d+)\\.(\\d)\\.?(\\d)?/; $_="$1.$2"' /etc/mageia-release) |
82 |
|
83 |
# End of user definitions |
84 |
%{?_without_kernel: %global build_kernel 0} |
85 |
%{?_without_doc: %global build_doc 0} |
86 |
%{?_without_source: %global build_source 0} |
87 |
%{?_without_devel: %global build_devel 0} |
88 |
|
89 |
%{?_with_kernel: %global build_kernel 1} |
90 |
%{?_with_doc: %global build_doc 1} |
91 |
%{?_with_source: %global build_source 1} |
92 |
%{?_with_devel: %global build_devel 1} |
93 |
|
94 |
%if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi) |
95 |
%define kmake %make CC="$CC" |
96 |
%else |
97 |
%define kmake %make |
98 |
%endif |
99 |
# there are places where parallel make don't work |
100 |
%define smake make |
101 |
|
102 |
# Parallelize xargs invocations on smp machines |
103 |
%define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\ |
104 |
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ |
105 |
[ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS") |
106 |
|
107 |
# Aliases for amd64 builds (better make source links?) |
108 |
%define target_cpu %(echo %{_target_cpu} | sed -e "s/amd64/x86_64/") |
109 |
%define target_arch %(echo %{_arch} | sed -e "s/amd64/x86_64/" -e 's/arm.*/arm/') |
110 |
|
111 |
# src.rpm description |
112 |
Summary: The Linux kernel (the core of the Linux operating system) |
113 |
Name: %{kname} |
114 |
Version: %{kversion} |
115 |
Release: %{rpmrel} |
116 |
License: GPLv2 |
117 |
Group: System/Kernel and hardware |
118 |
ExclusiveArch: %{ix86} x86_64 %{arm} |
119 |
ExclusiveOS: Linux |
120 |
URL: https://rt.wiki.kernel.org/ |
121 |
|
122 |
#################################################################### |
123 |
# |
124 |
# Sources |
125 |
# |
126 |
### This is for full SRC RPM |
127 |
Source0: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.bz2 |
128 |
Source1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.bz2.sign |
129 |
|
130 |
# This is for disabling mrproper and other targets on -devel rpms |
131 |
Source2: disable-mrproper-in-devel-rpms.patch |
132 |
|
133 |
Source4: README.kernel-sources |
134 |
|
135 |
# Kernel defconfigs |
136 |
Source20: i386_defconfig |
137 |
Source21: x86_64_defconfig |
138 |
Source22: arm_defconfig |
139 |
|
140 |
#################################################################### |
141 |
# |
142 |
# Patches |
143 |
|
144 |
# |
145 |
# Patch0 to Patch100 are for core kernel upgrades. |
146 |
# |
147 |
|
148 |
# Pre linus patch: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing |
149 |
|
150 |
%if %kpatch |
151 |
Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.bz2 |
152 |
Source10: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.bz2.sign |
153 |
%endif |
154 |
%if %sublevel |
155 |
Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kversion}.xz |
156 |
Source10: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kversion}.sign |
157 |
%endif |
158 |
# kernel.org -git |
159 |
%if %kgit |
160 |
Patch2: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/snapshots/patch-%{kernelversion}.%{patchlevel}-%{kpatch}-git%{kgit}.bz2 |
161 |
Source11: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/snapshots/patch-%{kernelversion}.%{patchlevel}-%{kpatch}-git%{kgit}.bz2.sign |
162 |
%endif |
163 |
|
164 |
# -rt patches |
165 |
Patch101: ftp://ftp.kernel.org/pub/linux/kernel/projects/rt/patch-%{kversion}-%{rt_rel}.patch.gz |
166 |
#Source101: ftp://ftp.kernel.org/pub/linux/kernel/projects/rt/patch-%{kversion}-%{rt_rel}.patch.xz.sign |
167 |
|
168 |
|
169 |
#END |
170 |
#################################################################### |
171 |
|
172 |
# Defines for the things that are needed for all the kernels |
173 |
%define requires1 module-init-tools >= 3.6-10 |
174 |
%define requires2 mkinitrd >= 3.4.43-10 |
175 |
%define requires3 bootloader-utils >= 1.9 |
176 |
%define requires4 sysfsutils |
177 |
%define requires5 kernel-firmware >= 20101024 |
178 |
|
179 |
%define kprovides kernel = %{tar_ver}, alsa |
180 |
|
181 |
BuildRoot: %{_tmppath}/%{name}-%{kversion}-build-%{_arch} |
182 |
Autoreqprov: no |
183 |
BuildRequires: gcc module-init-tools >= 0.9.15 |
184 |
%ifarch %{arm} |
185 |
BuildRequires: uboot-mkimage |
186 |
%endif |
187 |
|
188 |
%description |
189 |
Source package to build the Linux kernel. |
190 |
|
191 |
%{rt_notice} |
192 |
|
193 |
|
194 |
# |
195 |
# kernel: Symmetric MultiProcessing kernel |
196 |
# |
197 |
%if %build_kernel |
198 |
%package -n %{kname}-%{buildrel} |
199 |
Version: %{fakever} |
200 |
Release: %{fakerel} |
201 |
%ifarch %{ix86} |
202 |
Summary: Linux realtime kernel for desktop use with i686 & 4GB RAM |
203 |
%else |
204 |
%ifarch %{arm} |
205 |
Linux realtime kernel for Arm machines based on Kirkwood |
206 |
%else |
207 |
Summary: Linux realtime kernel for desktop use with %{_arch} |
208 |
%endif |
209 |
%endif |
210 |
Group: System/Kernel and hardware |
211 |
Provides: %kprovides |
212 |
Provides: should-restart = system |
213 |
Requires: %requires1 |
214 |
Requires: %requires2 |
215 |
Requires: %requires3 |
216 |
Requires: %requires4 |
217 |
Requires: %requires5 |
218 |
|
219 |
%ifarch %{ix86} |
220 |
Conflicts: arch(x86_64) |
221 |
%endif |
222 |
|
223 |
%description -n %{kname}-%{buildrel} |
224 |
%ifarch %{ix86} |
225 |
This kernel is compiled for desktop use, single or multiple i686 |
226 |
processor(s)/core(s) and less than 4GB RAM, using HZ_1000, realtime |
227 |
preempt, CFS cpu scheduler and cfq i/o scheduler. |
228 |
This kernel relies on in-kernel smp alternatives to switch between |
229 |
up & smp mode depending on detected hardware. To force the kernel |
230 |
to boot in single processor mode, use the "nosmp" boot parameter. |
231 |
%else |
232 |
%ifarch %{arm} |
233 |
This kernel is compiled for Arm Kirkwood boxes. It will run on openrd |
234 |
boards. It's configured using HZ_100, realtime preempt, CFS cpu scheduler |
235 |
and cfq i/o scheduler. |
236 |
This kernel relies on in-kernel smp alternatives to switch between |
237 |
up & smp mode depending on detected hardware. To force the kernel |
238 |
to boot in single processor mode, use the "nosmp" boot parameter. |
239 |
%else |
240 |
This kernel is compiled for desktop use, single or multiple %{_arch} |
241 |
processor(s)/core(s), using HZ_1000, realtime preempt, CFS cpu |
242 |
scheduler and cfq i/o scheduler. |
243 |
This kernel relies on in-kernel smp alternatives to switch between |
244 |
up & smp mode depending on detected hardware. To force the kernel |
245 |
to boot in single processor mode, use the "nosmp" boot parameter. |
246 |
%endif |
247 |
%endif |
248 |
|
249 |
%{rt_notice} |
250 |
%endif # build_kernel |
251 |
|
252 |
|
253 |
# |
254 |
# kernel-source: kernel sources |
255 |
# |
256 |
%if %build_source |
257 |
%package -n %{kname}-source-%{buildrel} |
258 |
Version: %{fakever} |
259 |
Release: %{fakerel} |
260 |
Provides: %{kname}-source, kernel-source = %{kverrel} |
261 |
Provides: %{kname}-source-%{kernelversion}.%{patchlevel} |
262 |
Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils |
263 |
Summary: The source code for the Linux kernel |
264 |
Group: Development/Kernel |
265 |
Autoreqprov: no |
266 |
Buildarch: noarch |
267 |
|
268 |
%description -n %{kname}-source-%{buildrel} |
269 |
The %{kname}-source package contains the source code files for the |
270 |
Linux kernel. Theese source files are only needed if you want to build |
271 |
your own custom kernel that is better tuned to your particular hardware. |
272 |
|
273 |
If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...) |
274 |
drivers against, install the *-devel-* rpm that is matching your kernel. |
275 |
|
276 |
%{rt_notice} |
277 |
%endif #build_source |
278 |
|
279 |
|
280 |
# |
281 |
# kernel-devel: stripped kernel sources |
282 |
# |
283 |
%if %build_devel |
284 |
%package -n %{kname}-devel-%{buildrel} |
285 |
Version: %{fakever} |
286 |
Release: %{fakerel} |
287 |
Provides: kernel-devel = %{kverrel} |
288 |
Summary: The %{kname} devel files for 3rdparty modules build |
289 |
Group: Development/Kernel |
290 |
Autoreqprov: no |
291 |
Requires: glibc-devel, ncurses-devel, make, gcc, perl |
292 |
%ifarch %{ix86} |
293 |
Conflicts: arch(x86_64) |
294 |
%endif |
295 |
|
296 |
%description -n %{kname}-devel-%{buildrel} |
297 |
This package contains the kernel-devel files that should be enough to build |
298 |
3rdparty drivers against for use with the %{kname}-%{buildrel}. |
299 |
|
300 |
If you want to build your own kernel, you need to install the full |
301 |
%{kname}-source-%{buildrel} rpm. |
302 |
|
303 |
%{rt_notice} |
304 |
%endif #build_devel |
305 |
|
306 |
|
307 |
# |
308 |
# kernel-doc: documentation for the Linux kernel |
309 |
# |
310 |
%if %build_doc |
311 |
%package -n %{kname}-doc |
312 |
Version: %{kversion} |
313 |
Release: %{rpmrel} |
314 |
Summary: Various documentation bits found in the kernel source |
315 |
Group: Books/Computer books |
316 |
Buildarch: noarch |
317 |
|
318 |
%description -n %{kname}-doc |
319 |
This package contains documentation files form the kernel source. Various |
320 |
bits of information about the Linux kernel and the device drivers shipped |
321 |
with it are documented in these files. You also might want install this |
322 |
package if you need a reference to the options that can be passed to Linux |
323 |
kernel modules at load time. |
324 |
|
325 |
%{rt_notice} |
326 |
%endif #build_doc |
327 |
|
328 |
|
329 |
# |
330 |
# kernel-latest: virtual rpm |
331 |
# |
332 |
%if %build_kernel |
333 |
%package -n %{kname}-latest |
334 |
Version: %{kversion} |
335 |
Release: %{rpmrel} |
336 |
Summary: Virtual rpm for latest %{kname} |
337 |
Group: System/Kernel and hardware |
338 |
Requires: %{kname}-%{buildrel} |
339 |
%ifarch %{ix86} |
340 |
Conflicts: arch(x86_64) |
341 |
%endif |
342 |
|
343 |
%description -n %{kname}-latest |
344 |
This package is a virtual rpm that aims to make sure you always have the |
345 |
latest %{kname} installed... |
346 |
|
347 |
%{rt_notice} |
348 |
%endif #build_kernel |
349 |
|
350 |
|
351 |
# |
352 |
# kernel-source-latest: virtual rpm |
353 |
# |
354 |
%if %build_source |
355 |
%package -n %{kname}-source-latest |
356 |
Version: %{kversion} |
357 |
Release: %{rpmrel} |
358 |
Summary: Virtual rpm for latest %{kname}-source |
359 |
Group: System/Kernel and hardware |
360 |
Requires: %{kname}-source-%{buildrel} |
361 |
Buildarch: noarch |
362 |
|
363 |
%description -n %{kname}-source-latest |
364 |
This package is a virtual rpm that aims to make sure you always have the |
365 |
latest %{kname}-source installed... |
366 |
|
367 |
%{rt_notice} |
368 |
%endif #build_source |
369 |
|
370 |
|
371 |
# |
372 |
# kernel-devel-latest: virtual rpm |
373 |
# |
374 |
%if %build_devel |
375 |
%package -n %{kname}-devel-latest |
376 |
Version: %{kversion} |
377 |
Release: %{rpmrel} |
378 |
Summary: Virtual rpm for latest %{kname}-devel |
379 |
Group: System/Kernel and hardware |
380 |
Requires: %{kname}-devel-%{buildrel} |
381 |
%ifarch %{ix86} |
382 |
Conflicts: arch(x86_64) |
383 |
%endif |
384 |
|
385 |
%description -n %{kname}-devel-latest |
386 |
This package is a virtual rpm that aims to make sure you always have the |
387 |
latest %{kname}-devel installed... |
388 |
|
389 |
%{rt_notice} |
390 |
%endif #build_devel |
391 |
|
392 |
|
393 |
# |
394 |
# End packages - here begins build stage |
395 |
# |
396 |
%prep |
397 |
%setup -q -n %top_dir_name -c |
398 |
|
399 |
pushd %src_dir |
400 |
%if %kpatch |
401 |
%patch1 -p1 |
402 |
%endif |
403 |
%if %sublevel |
404 |
%patch1 -p1 |
405 |
%endif |
406 |
%if %kgit |
407 |
%patch2 -p1 |
408 |
%endif |
409 |
|
410 |
# rt patches |
411 |
%patch101 -p1 |
412 |
|
413 |
popd |
414 |
|
415 |
# PATCH END |
416 |
|
417 |
|
418 |
# |
419 |
# Setup Begin |
420 |
# |
421 |
|
422 |
|
423 |
# Install defconfigs... |
424 |
install %{SOURCE20} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/ |
425 |
install %{SOURCE21} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/ |
426 |
install %{SOURCE22} %{build_dir}/linux-%{tar_ver}/arch/arm/configs/ |
427 |
|
428 |
# make sure the kernel has the sublevel we know it has... |
429 |
LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" linux-%{tar_ver}/Makefile |
430 |
|
431 |
# drop localversion before build or it will mess up uname -r (we have it in kernel name/version) |
432 |
rm -f %{build_dir}/linux-%{tar_ver}/localversion-rt |
433 |
|
434 |
%build |
435 |
# Common target directories |
436 |
%define _bootdir /boot |
437 |
%define _modulesdir /lib/modules |
438 |
%define _kerneldir /usr/src/%{kname}-%{buildrel} |
439 |
%define _develdir /usr/src/%{kname}-devel-%{buildrel} |
440 |
|
441 |
|
442 |
# Directories definition needed for building |
443 |
%define temp_root %{build_dir}/temp-root |
444 |
%define temp_boot %{temp_root}%{_bootdir} |
445 |
%define temp_modules %{temp_root}%{_modulesdir} |
446 |
%define temp_source %{temp_root}%{_kerneldir} |
447 |
%define temp_devel %{temp_root}%{_develdir} |
448 |
|
449 |
|
450 |
# Create a simulacro of buildroot |
451 |
rm -rf %{temp_root} |
452 |
install -d %{temp_root} |
453 |
|
454 |
|
455 |
# make sure we are in the directory |
456 |
cd %{src_dir} |
457 |
|
458 |
# make sure EXTRAVERSION says what we want it to say |
459 |
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildrpmrel}/" Makefile |
460 |
|
461 |
# Prepare the kernel |
462 |
%smake -s mrproper |
463 |
%ifarch %{ix86} x86_64 %{arm} |
464 |
cp arch/x86/configs/%{target_arch}_defconfig .config |
465 |
%else |
466 |
cp arch/%{target_arch}/defconfig .config |
467 |
%endif |
468 |
%smake oldconfig |
469 |
|
470 |
# Build the kernel |
471 |
%kmake -s all |
472 |
%ifarch %{arm} |
473 |
%kmake uImage |
474 |
%endif |
475 |
# Install kernel |
476 |
install -d %{temp_boot} |
477 |
install -m 644 System.map %{temp_boot}/System.map-%{buildrel} |
478 |
install -m 644 .config %{temp_boot}/config-%{buildrel} |
479 |
%ifarch %{arm} |
480 |
cp -f arch/%{target_arch}/boot/uImage %{temp_boot}/uImage-$KernelVer |
481 |
%else |
482 |
cp -f arch/%{target_arch}/boot/bzImage %{temp_boot}/vmlinuz-%{buildrel} |
483 |
%endif |
484 |
|
485 |
# Install modules |
486 |
install -d %{temp_modules}/%{buildrel} |
487 |
%smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{buildrel} modules_install |
488 |
|
489 |
# remove /lib/firmware, we use a separate kernel-firmware |
490 |
rm -rf %{temp_root}/lib/firmware |
491 |
|
492 |
# Save devel tree |
493 |
%if %build_devel |
494 |
mkdir -p %{temp_devel} |
495 |
for i in $(find . -name 'Makefile*'); do cp -R --parents $i %{temp_devel};done |
496 |
for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*' -o -name config.mk); do cp -R --parents $i %{temp_devel};done |
497 |
cp -fR include %{temp_devel} |
498 |
cp -fR scripts %{temp_devel} |
499 |
%ifarch %{arm} |
500 |
cp -fR arch/%{target_arch}/tools $TempDevelRoot/arch/%{target_arch}/ |
501 |
%endif |
502 |
%ifarch %{ix86} x86_64 |
503 |
cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel}/arch/x86/kernel/ |
504 |
cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel}/arch/x86/kernel/ |
505 |
cp -fR arch/x86/include %{temp_devel}/arch/x86/ |
506 |
%else |
507 |
cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} %{temp_devel}/arch/%{target_arch}/kernel/ |
508 |
for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f $TempDevelRoot; done |
509 |
%endif |
510 |
|
511 |
# Needed for generation of kernel/bounds.s |
512 |
cp -fR kernel/bounds.c %{temp_devel}/kernel/ |
513 |
|
514 |
# Needed for lguest |
515 |
cp -fR drivers/lguest/lg.h %{temp_devel}/drivers/lguest/ |
516 |
|
517 |
cp -fR .config Module.symvers %{temp_devel} |
518 |
|
519 |
# Needed for truecrypt build (Danny) |
520 |
cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/ |
521 |
|
522 |
# Needed for external dvb tree (#41418) |
523 |
cp -fR drivers/media/dvb/dvb-core/*.h %{temp_devel}/drivers/media/dvb/dvb-core/ |
524 |
cp -fR drivers/media/dvb/frontends/lgdt330x.h %{temp_devel}/drivers/media/dvb/frontends/ |
525 |
|
526 |
# add acpica header files, needed for fglrx build |
527 |
cp -fR drivers/acpi/acpica/*.h %{temp_devel}/drivers/acpi/acpica/ |
528 |
|
529 |
# Check and clean the -devel tree |
530 |
pushd %{temp_devel} >/dev/null |
531 |
%smake -s prepare scripts clean |
532 |
rm -f .config.old |
533 |
popd >/dev/null |
534 |
|
535 |
# Disable mrproper and other targets |
536 |
patch -p1 -d %{temp_devel} -i %{SOURCE2} |
537 |
|
538 |
# Fix permissions |
539 |
chmod -R a+rX %{temp_devel} |
540 |
%endif # build_devel |
541 |
|
542 |
#make sure we are in the directory |
543 |
cd %src_dir |
544 |
|
545 |
# kernel-source is shipped as an unprepared tree |
546 |
%smake -s mrproper |
547 |
|
548 |
|
549 |
### |
550 |
### Install |
551 |
### |
552 |
%install |
553 |
install -m 644 %{SOURCE4} . |
554 |
|
555 |
cd %src_dir |
556 |
# Directories definition needed for installing |
557 |
%define target_source %{buildroot}/%{_kerneldir} |
558 |
%define target_boot %{buildroot}%{_bootdir} |
559 |
%define target_modules %{buildroot}%{_modulesdir} |
560 |
%define target_devel %{buildroot}%{_develdir} |
561 |
|
562 |
# We want to be able to test several times the install part |
563 |
rm -rf %{buildroot} |
564 |
cp -a %{temp_root} %{buildroot} |
565 |
|
566 |
# Create directories infastructure |
567 |
%if %build_source |
568 |
install -d %{target_source} |
569 |
|
570 |
tar cf - . | tar xf - -C %{target_source} |
571 |
chmod -R a+rX %{target_source} |
572 |
|
573 |
# we remove all the source files that we don't ship |
574 |
|
575 |
# first architecture files |
576 |
for i in alpha avr32 blackfin cris frv h8300 ia64 m32r mips microblaze \ |
577 |
m68k m68knommu mn10300 parisc powerpc ppc s390 score sh sh64 sparc \ |
578 |
tile unicore32 v850 xtensa; do |
579 |
rm -rf %{target_source}/arch/$i |
580 |
|
581 |
%if %build_devel |
582 |
rm -rf %{target_devel}/arch/$i |
583 |
%endif |
584 |
done |
585 |
|
586 |
# remove arch files based on target arch in -devel rpms |
587 |
%if %build_devel |
588 |
%ifnarch %{ix86} x86_64 |
589 |
rm -rf %{target_devel}/arch/x86 |
590 |
%endif |
591 |
%ifnarch %{arm} |
592 |
rm -rf %{target_devel}/arch/arm |
593 |
%endif |
594 |
%endif |
595 |
|
596 |
|
597 |
# other misc files |
598 |
rm -f %{target_source}/{.config.old,.config.cmd,.tmp_gas_check,.mailmap,.missing-syscalls.d,arch/.gitignore} |
599 |
rm -rf %{target_source}/.tmp_depmod/ |
600 |
|
601 |
#endif %build_source |
602 |
%endif |
603 |
|
604 |
|
605 |
# gzipping modules |
606 |
find %{target_modules} -name "*.ko" | %kxargs gzip -9 |
607 |
|
608 |
|
609 |
# We used to have a copy of PrepareKernel here |
610 |
# Now, we make sure that the thing in the linux dir is what we want it to be |
611 |
|
612 |
for i in %{target_modules}/*; do |
613 |
rm -f $i/build $i/source |
614 |
done |
615 |
|
616 |
|
617 |
# sniff, if we gzipped all the modules, we change the stamp :( |
618 |
# we really need the depmod -ae here |
619 |
pushd %{target_modules} |
620 |
for i in *; do |
621 |
/sbin/depmod -u -ae -b %{buildroot} -r -F %{target_boot}/System.map-$i $i |
622 |
echo $? |
623 |
done |
624 |
|
625 |
for i in *; do |
626 |
pushd $i |
627 |
echo "Creating module.description for $i" |
628 |
modules=`find . -name "*.ko.gz"` |
629 |
echo $modules | %kxargs /sbin/modinfo \ |
630 |
| perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description |
631 |
popd |
632 |
done |
633 |
popd |
634 |
|
635 |
|
636 |
### |
637 |
### Clean |
638 |
### |
639 |
|
640 |
%clean |
641 |
rm -rf %{buildroot} |
642 |
# We don't want to remove this, the whole reason of its existence is to be |
643 |
# able to do several rpm --short-circuit -bi for testing install |
644 |
# phase without repeating compilation phase |
645 |
#rm -rf %{temp_root} |
646 |
|
647 |
|
648 |
### |
649 |
### Scripts |
650 |
### |
651 |
|
652 |
### kernel |
653 |
%if %build_kernel |
654 |
%preun -n %{kname}-%{buildrel} |
655 |
/sbin/installkernel -R %{buildrel} |
656 |
if [ -L /lib/modules/%{buildrel}/build ]; then |
657 |
rm -f /lib/modules/%{buildrel}/build |
658 |
fi |
659 |
if [ -L /lib/modules/%{buildrel}/source ]; then |
660 |
rm -f /lib/modules/%{buildrel}/source |
661 |
fi |
662 |
pushd /boot > /dev/null |
663 |
if [ -L vmlinuz-linus ]; then |
664 |
if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then |
665 |
rm -f vmlinuz-linus |
666 |
fi |
667 |
fi |
668 |
if [ -L initrd-linus.img ]; then |
669 |
if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then |
670 |
rm -f initrd-linus.img |
671 |
fi |
672 |
fi |
673 |
popd > /dev/null |
674 |
exit 0 |
675 |
|
676 |
%post -n %{kname}-%{buildrel} |
677 |
/sbin/installkernel -L %{buildrel} |
678 |
if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then |
679 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build |
680 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source |
681 |
fi |
682 |
pushd /boot > /dev/null |
683 |
if [ -L vmlinuz-linus ]; then |
684 |
rm -f vmlinuz-linus |
685 |
fi |
686 |
ln -sf vmlinuz-%{buildrel} vmlinuz-linus |
687 |
if [ -L initrd-linus.img ]; then |
688 |
rm -f initrd-linus.img |
689 |
fi |
690 |
ln -sf initrd-%{buildrel}.img initrd-linus.img |
691 |
popd > /dev/null |
692 |
|
693 |
%postun -n %{kname}-%{buildrel} |
694 |
/sbin/kernel_remove_initrd %{buildrel} |
695 |
rm -rf /lib/modules/%{buildrel} > /dev/null |
696 |
%endif # build_kernel |
697 |
|
698 |
|
699 |
### kernel-devel |
700 |
%if %build_devel |
701 |
%post -n %{kname}-devel-%{buildrel} |
702 |
# place /build and /source symlinks in place. |
703 |
if [ -d /lib/modules/%{buildrel} ]; then |
704 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build |
705 |
ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source |
706 |
fi |
707 |
|
708 |
%preun -n %{kname}-devel-%{buildrel} |
709 |
# we need to delete <modules>/{build,source} at uninstall |
710 |
if [ -L /lib/modules/%{buildrel}/build ]; then |
711 |
rm -f /lib/modules/%{buildrel}/build |
712 |
fi |
713 |
if [ -L /lib/modules/%{buildrel}/source ]; then |
714 |
rm -f /lib/modules/%{buildrel}/source |
715 |
fi |
716 |
exit 0 |
717 |
%endif #build_devel |
718 |
|
719 |
|
720 |
### kernel-source |
721 |
%if %build_source |
722 |
%post -n %{kname}-source-%{buildrel} |
723 |
for i in /lib/modules/%{buildrel}*; do |
724 |
if [ -d $i ]; then |
725 |
if [ ! -L $i/build -a ! -L $i/source ]; then |
726 |
rm -f $i/{build,source} |
727 |
ln -sf /usr/src/%{kname}-%{buildrel} $i/build |
728 |
ln -sf /usr/src/%{kname}-%{buildrel} $i/source |
729 |
fi |
730 |
fi |
731 |
done |
732 |
|
733 |
%preun -n %{kname}-source-%{buildrel} |
734 |
for i in /lib/modules/%{buildrel}/{build,source}; do |
735 |
if [ -L $i ]; then |
736 |
if [ "$(readlink $i)" = "/usr/src/%{kname}-%{buildrel}" ]; then |
737 |
rm -f $i |
738 |
fi |
739 |
fi |
740 |
done |
741 |
exit 0 |
742 |
%endif # build_source |
743 |
|
744 |
|
745 |
### |
746 |
### file lists |
747 |
### |
748 |
|
749 |
# kernel |
750 |
%if %build_kernel |
751 |
%files -n %{kname}-%{buildrel} |
752 |
%defattr(-,root,root) |
753 |
%{_bootdir}/config-%{buildrel} |
754 |
%ifarch %{arm} |
755 |
%{_bootdir}/uImage-%{buildrel} |
756 |
%else |
757 |
%{_bootdir}/vmlinuz-%{buildrel} |
758 |
%endif |
759 |
%{_bootdir}/System.map-%{buildrel} |
760 |
%dir %{_modulesdir}/%{buildrel}/ |
761 |
%{_modulesdir}/%{buildrel}/kernel |
762 |
%{_modulesdir}/%{buildrel}/modules.* |
763 |
%doc README.kernel-sources |
764 |
%endif # build_kernel |
765 |
|
766 |
# kernel-source |
767 |
%if %build_source |
768 |
%files -n %{kname}-source-%{buildrel} |
769 |
%defattr(-,root,root) |
770 |
%dir %{_kerneldir} |
771 |
%dir %{_kerneldir}/arch |
772 |
%dir %{_kerneldir}/include |
773 |
%{_kerneldir}/.gitignore |
774 |
%{_kerneldir}/COPYING |
775 |
%{_kerneldir}/CREDITS |
776 |
%{_kerneldir}/Documentation |
777 |
%{_kerneldir}/Kbuild |
778 |
%{_kerneldir}/Kconfig |
779 |
%{_kerneldir}/MAINTAINERS |
780 |
%{_kerneldir}/Makefile |
781 |
%{_kerneldir}/README |
782 |
%{_kerneldir}/REPORTING-BUGS |
783 |
%{_kerneldir}/arch/Kconfig |
784 |
%{_kerneldir}/arch/arm |
785 |
%{_kerneldir}/arch/x86 |
786 |
%{_kerneldir}/arch/um |
787 |
%{_kerneldir}/block |
788 |
%{_kerneldir}/crypto |
789 |
%{_kerneldir}/drivers |
790 |
%{_kerneldir}/firmware |
791 |
%{_kerneldir}/fs |
792 |
%{_kerneldir}/include/Kbuild |
793 |
%{_kerneldir}/include/acpi |
794 |
%{_kerneldir}/include/asm-generic |
795 |
%{_kerneldir}/include/crypto |
796 |
%{_kerneldir}/include/drm |
797 |
%{_kerneldir}/include/linux |
798 |
%{_kerneldir}/include/math-emu |
799 |
%{_kerneldir}/include/net |
800 |
%{_kerneldir}/include/pcmcia |
801 |
%{_kerneldir}/include/scsi |
802 |
%{_kerneldir}/include/sound |
803 |
%{_kerneldir}/include/target |
804 |
%{_kerneldir}/include/trace |
805 |
%{_kerneldir}/include/video |
806 |
%{_kerneldir}/include/media |
807 |
%{_kerneldir}/include/mtd |
808 |
%{_kerneldir}/include/rxrpc |
809 |
%{_kerneldir}/include/keys |
810 |
%{_kerneldir}/include/rdma |
811 |
%{_kerneldir}/include/xen |
812 |
%{_kerneldir}/init |
813 |
%{_kerneldir}/ipc |
814 |
%{_kerneldir}/kernel |
815 |
%{_kerneldir}/lib |
816 |
%{_kerneldir}/mm |
817 |
%{_kerneldir}/net |
818 |
%{_kerneldir}/samples |
819 |
%{_kerneldir}/scripts |
820 |
%{_kerneldir}/security |
821 |
%{_kerneldir}/sound |
822 |
%{_kerneldir}/tools |
823 |
%{_kerneldir}/usr |
824 |
%{_kerneldir}/virt |
825 |
%doc README.kernel-sources |
826 |
%endif # build_source |
827 |
|
828 |
# kernel-devel |
829 |
%if %build_devel |
830 |
%files -n %{kname}-devel-%{buildrel} |
831 |
%defattr(-,root,root) |
832 |
%dir %{_develdir} |
833 |
%dir %{_develdir}/arch |
834 |
%dir %{_develdir}/include |
835 |
%{_develdir}/.config |
836 |
%{_develdir}/Documentation |
837 |
%{_develdir}/Kbuild |
838 |
%{_develdir}/Kconfig |
839 |
%{_develdir}/Makefile |
840 |
%{_develdir}/Module.symvers |
841 |
%{_develdir}/arch/Kconfig |
842 |
%ifarch %{arm} |
843 |
%{_develdir}/arch/arm |
844 |
%endif |
845 |
%ifarch %{ix86} x86_64 |
846 |
%{_develdir}/arch/x86 |
847 |
%endif |
848 |
%{_develdir}/arch/um |
849 |
%{_develdir}/block |
850 |
%{_develdir}/crypto |
851 |
%{_develdir}/drivers |
852 |
%{_develdir}/firmware |
853 |
%{_develdir}/fs |
854 |
%{_develdir}/include/Kbuild |
855 |
%{_develdir}/include/acpi |
856 |
%{_develdir}/include/asm-generic |
857 |
%{_develdir}/include/config |
858 |
%{_develdir}/include/crypto |
859 |
%{_develdir}/include/drm |
860 |
%{_develdir}/include/generated |
861 |
%{_develdir}/include/keys |
862 |
%{_develdir}/include/linux |
863 |
%{_develdir}/include/math-emu |
864 |
%{_develdir}/include/mtd |
865 |
%{_develdir}/include/net |
866 |
%{_develdir}/include/pcmcia |
867 |
%{_develdir}/include/rdma |
868 |
%{_develdir}/include/scsi |
869 |
%{_develdir}/include/sound |
870 |
%{_develdir}/include/target |
871 |
%{_develdir}/include/trace |
872 |
%{_develdir}/include/video |
873 |
%{_develdir}/include/media |
874 |
%{_develdir}/include/rxrpc |
875 |
%{_develdir}/include/xen |
876 |
%{_develdir}/init |
877 |
%{_develdir}/ipc |
878 |
%{_develdir}/kernel |
879 |
%{_develdir}/lib |
880 |
%{_develdir}/mm |
881 |
%{_develdir}/net |
882 |
%{_develdir}/samples |
883 |
%{_develdir}/scripts |
884 |
%{_develdir}/security |
885 |
%{_develdir}/sound |
886 |
%{_develdir}/tools |
887 |
%{_develdir}/usr |
888 |
%{_develdir}/virt |
889 |
%doc README.kernel-sources |
890 |
%endif # build_devel |
891 |
|
892 |
|
893 |
%if %build_doc |
894 |
%files -n %{kname}-doc |
895 |
%defattr(-,root,root) |
896 |
%doc linux-%{tar_ver}/Documentation/* |
897 |
%endif # build_doc |
898 |
|
899 |
%if %build_kernel |
900 |
%files -n %{kname}-latest |
901 |
%defattr(-,root,root) |
902 |
%endif # build_kernel |
903 |
|
904 |
%if %build_source |
905 |
%files -n %{kname}-source-latest |
906 |
%defattr(-,root,root) |
907 |
%endif # build_source |
908 |
|
909 |
%if %build_devel |
910 |
%files -n %{kname}-devel-latest |
911 |
%defattr(-,root,root) |
912 |
%endif # build_devel |