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