1 |
# -*- Mode: rpm-spec -*- |
2 |
# |
3 |
# This Specfile is based on kernel-tmb spec done by |
4 |
# Thomas Backlund <tmb@mandriva.org> |
5 |
# |
6 |
# The mkflavour() macroization done by Anssi Hannula <anssi@mandriva.org> |
7 |
# |
8 |
# Mageia kernels use kernel.org versioning |
9 |
# |
10 |
%define kernelversion 2 |
11 |
%define patchlevel 6 |
12 |
%define sublevel 37 |
13 |
|
14 |
# Package release |
15 |
%define mgarel 1 |
16 |
|
17 |
# kernel Makefile extraversion is substituted by |
18 |
# kpatch/kgit/kstable wich are either 0 (empty), rc (kpatch), git (kgit) |
19 |
# or stable release (kstable) |
20 |
%define kpatch 0 |
21 |
%define kstable 4 |
22 |
# kernel.org -gitX patch (only the number after "git") |
23 |
%define kgit 0 |
24 |
|
25 |
# Used when building update candidates |
26 |
#define uclevel uc1 |
27 |
%define devel_notice %{?uclevel:NOTE: This is work-in-progress (WIP) development kernel.} |
28 |
|
29 |
# kernel base name (also name of srpm) |
30 |
%define kname kernel |
31 |
|
32 |
# Patch tarball tag |
33 |
%define ktag mga |
34 |
|
35 |
%define rpmtag %distsuffix |
36 |
%if %kpatch |
37 |
%if %kgit |
38 |
%define rpmrel %mkrel 0.%{kpatch}.%{kgit}.%{mgarel}%{?uclevel:.%{uclevel}} |
39 |
%else |
40 |
%define rpmrel %mkrel 0.%{kpatch}.%{mgarel}%{?uclevel:.%{uclevel}} |
41 |
%endif |
42 |
%else |
43 |
%define rpmrel %mkrel %{mgarel}%{?uclevel:.%{uclevel}} |
44 |
%endif |
45 |
%define fakerel %mkrel 1 |
46 |
|
47 |
# fakerel above and fakever below never change, they are used to fool |
48 |
# rpm/urpmi/smart |
49 |
%define fakever 1 |
50 |
|
51 |
# When we are using a pre/rc patch, the tarball is a sublevel -1 |
52 |
%if %kpatch |
53 |
%if %kstable |
54 |
%define tar_ver %{kernelversion}.%{patchlevel}.%{sublevel} |
55 |
%else |
56 |
%define tar_ver %{kernelversion}.%{patchlevel}.%(expr %{sublevel} - 1) |
57 |
%endif |
58 |
%define patch_ver %{kversion}-%{kpatch}-%{ktag}%{mgarel} |
59 |
%else |
60 |
%define tar_ver %{kernelversion}.%{patchlevel}.%{sublevel} |
61 |
%define patch_ver %{kversion}-%{ktag}%{mgarel} |
62 |
%endif |
63 |
%if %kstable |
64 |
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel}.%{kstable} |
65 |
%else |
66 |
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel} |
67 |
%endif |
68 |
%define kverrel %{kversion}-%{rpmrel} |
69 |
|
70 |
# Used for not making too long names for rpms or search paths |
71 |
%if %kpatch |
72 |
%if %kgit |
73 |
%define buildrpmrel 0.%{kpatch}.%{kgit}.%{mgarel}%{?uclevel:.%{uclevel}}%{rpmtag} |
74 |
%else |
75 |
%define buildrpmrel 0.%{kpatch}.%{mgarel}%{?uclevel:.%{uclevel}}%{rpmtag} |
76 |
%endif |
77 |
%else |
78 |
%define buildrpmrel %{mgarel}%{?uclevel:.%{uclevel}}%{rpmtag} |
79 |
%endif |
80 |
%define buildrel %{kversion}-%{buildrpmrel} |
81 |
|
82 |
# Having different top level names for packges means that you have to remove |
83 |
# them by hard :( |
84 |
%define top_dir_name %{kname}-%{_arch} |
85 |
|
86 |
%define build_dir ${RPM_BUILD_DIR}/%{top_dir_name} |
87 |
%define src_dir %{build_dir}/linux-%{tar_ver} |
88 |
|
89 |
# Disable useless debug rpms... |
90 |
%define _enable_debug_packages %{nil} |
91 |
%define debug_package %{nil} |
92 |
|
93 |
# Build defines |
94 |
%define build_doc 1 |
95 |
%define build_source 1 |
96 |
%define build_devel 1 |
97 |
|
98 |
%define build_debug 1 |
99 |
|
100 |
# Build desktop i586 / 4GB |
101 |
%ifarch %{ix86} |
102 |
%define build_desktop586 1 |
103 |
%endif |
104 |
|
105 |
# Build desktop (i686 / 4GB) / x86_64 / sparc64 sets |
106 |
%define build_desktop 1 |
107 |
|
108 |
# Build server (i686 / 64GB)/x86_64 / sparc64 sets |
109 |
%define build_server 1 |
110 |
|
111 |
# End of user definitions |
112 |
%{?_without_desktop586: %global build_desktop586 0} |
113 |
%{?_without_desktop: %global build_desktop 0} |
114 |
%{?_without_server: %global build_server 0} |
115 |
%{?_without_doc: %global build_doc 0} |
116 |
%{?_without_source: %global build_source 0} |
117 |
%{?_without_devel: %global build_devel 0} |
118 |
%{?_without_debug: %global build_debug 0} |
119 |
|
120 |
%{?_with_desktop586: %global build_desktop586 1} |
121 |
%{?_with_desktop: %global build_desktop 1} |
122 |
%{?_with_server: %global build_server 1} |
123 |
%{?_with_doc: %global build_doc 1} |
124 |
%{?_with_source: %global build_source 1} |
125 |
%{?_with_devel: %global build_devel 1} |
126 |
%{?_with_debug: %global build_debug 1} |
127 |
|
128 |
# For the .nosrc.rpm |
129 |
%define build_nosrc 0 |
130 |
%{?_with_nosrc: %global build_nosrc 1} |
131 |
|
132 |
%if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi) |
133 |
%define kmake %make CC="$CC" |
134 |
%else |
135 |
%define kmake %make |
136 |
%endif |
137 |
# there are places where parallel make don't work |
138 |
%define smake make |
139 |
|
140 |
# Parallelize xargs invocations on smp machines |
141 |
%define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\ |
142 |
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ |
143 |
[ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS") |
144 |
|
145 |
# Sparc arch wants sparc64 kernels |
146 |
%define target_arch %(echo %{_arch} | sed -e "s/sparc/sparc64/") |
147 |
|
148 |
|
149 |
# |
150 |
# SRC RPM description |
151 |
# |
152 |
Summary: Linux kernel built for Mageia |
153 |
Name: %{kname} |
154 |
Version: %{kversion} |
155 |
Release: %{rpmrel} |
156 |
License: GPLv2 |
157 |
Group: System/Kernel and hardware |
158 |
ExclusiveArch: %{ix86} x86_64 |
159 |
ExclusiveOS: Linux |
160 |
URL: http://www.kernel.org |
161 |
|
162 |
#################################################################### |
163 |
# |
164 |
# Sources |
165 |
# |
166 |
### This is for full SRC RPM |
167 |
Source0: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.bz2 |
168 |
Source1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.bz2.sign |
169 |
### This is for stripped SRC RPM |
170 |
%if %build_nosrc |
171 |
NoSource: 0 |
172 |
%endif |
173 |
# This is for disabling *config, mrproper, prepare, scripts on -devel rpms |
174 |
Source2: disable-mrproper-prepare-scripts-configs-in-devel-rpms.patch |
175 |
|
176 |
Source4: README.kernel-sources |
177 |
|
178 |
Source100: linux-%{patch_ver}.tar.bz2 |
179 |
|
180 |
#################################################################### |
181 |
# |
182 |
# Patches |
183 |
|
184 |
# |
185 |
# Patch0 to Patch100 are for core kernel upgrades. |
186 |
# |
187 |
|
188 |
# Pre linus patch: ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing |
189 |
|
190 |
%if %kpatch |
191 |
%if %kstable |
192 |
Patch2: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/stable-review/patch-%{kversion}-%{kpatch}.bz2 |
193 |
Source11: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/stable-review/patch-%{kversion}-%{kpatch}.bz2.sign |
194 |
%else |
195 |
Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kversion}-%{kpatch}.bz2 |
196 |
Source10: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/testing/patch-%{kversion}-%{kpatch}.bz2.sign |
197 |
%endif |
198 |
%endif |
199 |
%if %kgit |
200 |
Patch2: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/snapshots/patch-%{kernelversion}.%{patchlevel}.%{sublevel}-%{kpatch}-git%{kgit}.bz2 |
201 |
Source11: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/snapshots/patch-%{kernelversion}.%{patchlevel}.%{sublevel}-%{kpatch}-git%{kgit}.bz2.sign |
202 |
%endif |
203 |
%if %kstable |
204 |
%if %kpatch |
205 |
%define prev_stable %(expr %{kstable} - 1) |
206 |
%if %prev_stable |
207 |
Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.%{prev_stable}.bz2 |
208 |
Source10: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.%{prev_stable}.bz2.sign |
209 |
%endif |
210 |
%else |
211 |
Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kversion}.bz2 |
212 |
Source10: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kversion}.bz2.sign |
213 |
%endif |
214 |
%endif |
215 |
|
216 |
#END |
217 |
#################################################################### |
218 |
|
219 |
# Defines for the things that are needed for all the kernels |
220 |
# |
221 |
%define common_description_kernel The kernel package contains the Linux kernel (vmlinuz), the core of your \ |
222 |
Mageia operating system. The kernel handles the basic functions \ |
223 |
of the operating system: memory allocation, process allocation, device \ |
224 |
input and output, etc. |
225 |
|
226 |
%{devel_notice} |
227 |
|
228 |
### Global Requires/Provides |
229 |
%define requires1 bootloader-utils >= 1.13-1 |
230 |
%define requires2 mkinitrd >= 4.2.17-31 |
231 |
%define requires3 module-init-tools >= 3.0-7 |
232 |
%define requires4 sysfsutils >= 1.3.0-1 |
233 |
%define requires5 kernel-firmware >= 20101024-2 |
234 |
|
235 |
%define kprovides %{kname} = %{kverrel}, kernel = %{tar_ver}, alsa = 1.0.23, drbd-api = 88 |
236 |
|
237 |
%define kconflicts drakxtools-backend < 10.4.190-2 |
238 |
|
239 |
%define kobsoletes dkms-iwlwifi < 1.2.26 |
240 |
|
241 |
BuildRoot: %{_tmppath}/%{kname}-%{kversion}-%{_arch}-build |
242 |
Autoreqprov: no |
243 |
BuildRequires: gcc module-init-tools |
244 |
|
245 |
%description |
246 |
%common_description_kernel |
247 |
|
248 |
%common_description_info |
249 |
|
250 |
# mkflavour() name flavour processor |
251 |
# name: the flavour name in the package name |
252 |
# flavour: first parameter of CreateKernel() |
253 |
%define mkflavour() \ |
254 |
%package -n %{kname}-%{1}-%{buildrel} \ |
255 |
Version: %{fakever} \ |
256 |
Release: %{fakerel} \ |
257 |
Provides: %kprovides \ |
258 |
Requires(pre): %requires1 %requires2 %requires3 %requires4 \ |
259 |
Requires: %requires5 \ |
260 |
Provides: should-restart = system \ |
261 |
Suggests: crda \ |
262 |
Obsoletes: %kobsoletes \ |
263 |
Conflicts: %kconflicts \ |
264 |
%ifarch %{ix86} \ |
265 |
Conflicts: arch(x86_64) \ |
266 |
%endif \ |
267 |
Summary: %{expand:%{summary_%(echo %{1})}} \ |
268 |
Group: System/Kernel and hardware \ |
269 |
%description -n %{kname}-%{1}-%{buildrel} \ |
270 |
%common_description_kernel %{expand:%{info_%(echo %{1})}} \ |
271 |
\ |
272 |
%common_description_info \ |
273 |
\ |
274 |
%if %build_devel \ |
275 |
%package -n %{kname}-%{1}-devel-%{buildrel} \ |
276 |
Version: %{fakever} \ |
277 |
Release: %{fakerel} \ |
278 |
Requires: glibc-devel ncurses-devel make gcc perl \ |
279 |
Summary: The kernel-devel files for %{kname}-%{1}-%{buildrel} \ |
280 |
Group: Development/Kernel \ |
281 |
Provides: kernel-devel = %{kverrel} \ |
282 |
%ifarch %{ix86} \ |
283 |
Conflicts: arch(x86_64) \ |
284 |
%endif \ |
285 |
%description -n %{kname}-%{1}-devel-%{buildrel} \ |
286 |
This package contains the kernel files (headers and build tools) \ |
287 |
that should be enough to build additional drivers for \ |
288 |
use with %{kname}-%{1}-%{buildrel}. \ |
289 |
\ |
290 |
If you want to build your own kernel, you need to install the full \ |
291 |
%{kname}-source-%{buildrel} rpm. \ |
292 |
\ |
293 |
%common_description_info \ |
294 |
%endif \ |
295 |
\ |
296 |
%if %build_debug \ |
297 |
%package -n %{kname}-%{1}-debug-%{buildrel} \ |
298 |
Version: %{fakever} \ |
299 |
Release: %{fakerel} \ |
300 |
Summary: Files with debug info for %{kname}-%{1}-%{buildrel} \ |
301 |
Group: Development/Debug \ |
302 |
Provides: kernel-debug = %{kverrel} \ |
303 |
%ifarch %{ix86} \ |
304 |
Conflicts: arch(x86_64) \ |
305 |
%endif \ |
306 |
%description -n %{kname}-%{1}-debug-%{buildrel} \ |
307 |
This package contains the files with debug info to aid in debug tasks \ |
308 |
when using %{kname}-%{1}-%{buildrel}. \ |
309 |
\ |
310 |
If you need to look at debug information or use some application that \ |
311 |
needs debugging info from the kernel, this package may help. \ |
312 |
\ |
313 |
%common_description_info \ |
314 |
%endif \ |
315 |
\ |
316 |
%package -n %{kname}-%{1}-latest \ |
317 |
Version: %{kversion} \ |
318 |
Release: %{rpmrel} \ |
319 |
Summary: Virtual rpm for latest %{kname}-%{1} \ |
320 |
Group: System/Kernel and hardware \ |
321 |
Requires: %{kname}-%{1}-%{buildrel} \ |
322 |
%ifarch %{ix86} \ |
323 |
Conflicts: arch(x86_64) \ |
324 |
%endif \ |
325 |
%description -n %{kname}-%{1}-latest \ |
326 |
This package is a virtual rpm that aims to make sure you always have the \ |
327 |
latest %{kname}-%{1} installed... \ |
328 |
\ |
329 |
%common_description_info \ |
330 |
\ |
331 |
%if %build_devel \ |
332 |
%package -n %{kname}-%{1}-devel-latest \ |
333 |
Version: %{kversion} \ |
334 |
Release: %{rpmrel} \ |
335 |
Summary: Virtual rpm for latest %{kname}-%{1}-devel \ |
336 |
Group: Development/Kernel \ |
337 |
Requires: %{kname}-%{1}-devel-%{buildrel} \ |
338 |
%ifarch %{ix86} \ |
339 |
Conflicts: arch(x86_64) \ |
340 |
%endif \ |
341 |
Provides: %{kname}-devel-latest \ |
342 |
%description -n %{kname}-%{1}-devel-latest \ |
343 |
This package is a virtual rpm that aims to make sure you always have the \ |
344 |
latest %{kname}-%{1}-devel installed... \ |
345 |
\ |
346 |
%common_description_info \ |
347 |
%endif \ |
348 |
\ |
349 |
%if %build_debug \ |
350 |
%package -n %{kname}-%{1}-debug-latest \ |
351 |
Version: %{kversion} \ |
352 |
Release: %{rpmrel} \ |
353 |
Summary: Virtual rpm for latest %{kname}-%{1}-debug \ |
354 |
Group: Development/Debug \ |
355 |
Requires: %{kname}-%{1}-debug-%{buildrel} \ |
356 |
%ifarch %{ix86} \ |
357 |
Conflicts: arch(x86_64) \ |
358 |
%endif \ |
359 |
Provides: %{kname}-debug-latest \ |
360 |
%description -n %{kname}-%{1}-debug-latest \ |
361 |
This package is a virtual rpm that aims to make sure you always have the \ |
362 |
latest %{kname}-%{1}-debug installed... \ |
363 |
\ |
364 |
%common_description_info \ |
365 |
%endif \ |
366 |
\ |
367 |
%post -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-post \ |
368 |
%preun -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-preun \ |
369 |
%postun -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-postun \ |
370 |
\ |
371 |
%if %build_devel \ |
372 |
%post -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-post \ |
373 |
%preun -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-preun \ |
374 |
%endif \ |
375 |
\ |
376 |
%files -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1} \ |
377 |
%files -n %{kname}-%{1}-latest \ |
378 |
%defattr(-,root,root) \ |
379 |
\ |
380 |
%if %build_devel \ |
381 |
%files -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1} \ |
382 |
%files -n %{kname}-%{1}-devel-latest \ |
383 |
%defattr(-,root,root) \ |
384 |
%endif \ |
385 |
\ |
386 |
%if %build_debug \ |
387 |
%files -n %{kname}-%{1}-debug-%{buildrel} -f kernel_debug_files.%{1} \ |
388 |
%files -n %{kname}-%{1}-debug-latest \ |
389 |
%defattr(-,root,root) \ |
390 |
%endif |
391 |
|
392 |
%ifarch %{ix86} |
393 |
# |
394 |
# kernel-desktop586: i586, smp-alternatives, 4GB |
395 |
# |
396 |
%if %build_desktop586 |
397 |
%define summary_desktop586 Linux kernel for desktop use with i586 & 4GB RAM |
398 |
%define info_desktop586 This kernel is compiled for desktop use, single or \ |
399 |
multiple i586 processor(s)/core(s) and less than 4GB RAM, using voluntary \ |
400 |
preempt, CFS cpu scheduler and cfq i/o scheduler. \ |
401 |
This kernel relies on in-kernel smp alternatives to switch between up & smp \ |
402 |
mode depending on detected hardware. To force the kernel to boot in single \ |
403 |
processor mode, use the "nosmp" boot parameter. |
404 |
%mkflavour desktop586 |
405 |
%endif |
406 |
%endif |
407 |
|
408 |
# |
409 |
# kernel-desktop: i686, smp-alternatives, 4 GB / x86_64 |
410 |
# |
411 |
|
412 |
%if %build_desktop |
413 |
%ifarch %{ix86} |
414 |
%define summary_desktop Linux Kernel for desktop use with i686 & 4GB RAM |
415 |
%define info_desktop This kernel is compiled for desktop use, single or \ |
416 |
multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \ |
417 |
voluntary preempt, CFS cpu scheduler and cfq i/o scheduler. \ |
418 |
This kernel relies on in-kernel smp alternatives to switch between up & smp \ |
419 |
mode depending on detected hardware. To force the kernel to boot in single \ |
420 |
processor mode, use the "nosmp" boot parameter. |
421 |
%else |
422 |
%define summary_desktop Linux Kernel for desktop use with %{_arch} |
423 |
%define info_desktop This kernel is compiled for desktop use, single or \ |
424 |
multiple %{_arch} processor(s)/core(s), using HZ_1000, voluntary preempt, \ |
425 |
CFS cpu scheduler and cfq i/o scheduler. \ |
426 |
This kernel relies on in-kernel smp alternatives to switch between up & smp \ |
427 |
mode depending on detected hardware. To force the kernel to boot in single \ |
428 |
processor mode, use the "nosmp" boot parameter. |
429 |
%endif |
430 |
%mkflavour desktop |
431 |
%endif |
432 |
|
433 |
# |
434 |
# kernel-server: i686, smp-alternatives, 64 GB / x86_64 |
435 |
# |
436 |
|
437 |
%if %build_server |
438 |
%ifarch %{ix86} |
439 |
%define summary_server Linux Kernel for server use with i686 & 64GB RAM |
440 |
%define info_server This kernel is compiled for server use, single or \ |
441 |
multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using \ |
442 |
no preempt, HZ_100, CFS cpu scheduler and cfq i/o scheduler. \ |
443 |
This kernel relies on in-kernel smp alternatives to switch between up & smp \ |
444 |
mode depending on detected hardware. To force the kernel to boot in single \ |
445 |
processor mode, use the "nosmp" boot parameter. |
446 |
%else |
447 |
%define summary_server Linux Kernel for server use with %{_arch} |
448 |
%define info_server This kernel is compiled for server use, single or \ |
449 |
multiple %{_arch} processor(s)/core(s), using no preempt, HZ_100, \ |
450 |
CFS cpu scheduler and cfq i/o scheduler. \ |
451 |
This kernel relies on in-kernel smp alternatives to switch between up & smp \ |
452 |
mode depending on detected hardware. To force the kernel to boot in single \ |
453 |
processor mode, use the "nosmp" boot parameter. |
454 |
%endif |
455 |
%mkflavour server |
456 |
%endif |
457 |
|
458 |
# |
459 |
# kernel-source |
460 |
# |
461 |
%if %build_source |
462 |
%package -n %{kname}-source-%{buildrel} |
463 |
Version: %{fakever} |
464 |
Release: %{fakerel} |
465 |
Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils |
466 |
Summary: The Linux source code for %{kname}-%{buildrel} |
467 |
Group: Development/Kernel |
468 |
Autoreqprov: no |
469 |
Provides: kernel-source = %{kverrel}, kernel-devel = %{kverrel} |
470 |
%ifarch %{ix86} |
471 |
Conflicts: arch(x86_64) |
472 |
%endif |
473 |
|
474 |
%description -n %{kname}-source-%{buildrel} |
475 |
The %{kname}-source package contains the source code files for the Mageia |
476 |
kernel. Theese source files are only needed if you want to build your |
477 |
own custom kernel that is better tuned to your particular hardware. |
478 |
|
479 |
If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...) |
480 |
drivers against, install the *-devel-* rpm that is matching your kernel. |
481 |
|
482 |
%common_description_info |
483 |
|
484 |
%post -n %{kname}-source-%{buildrel} |
485 |
for i in /lib/modules/%{kversion}-{desktop586,desktop,server}-%{buildrpmrel}; do |
486 |
if [ -d $i ]; then |
487 |
if [ ! -L $i/build -a ! -L $i/source ]; then |
488 |
ln -sf /usr/src/linux-%{kversion}-%{buildrpmrel} $i/build |
489 |
ln -sf /usr/src/linux-%{kversion}-%{buildrpmrel} $i/source |
490 |
fi |
491 |
fi |
492 |
done |
493 |
cd /usr/src |
494 |
rm -f linux |
495 |
ln -snf linux-%{kversion}-%{buildrpmrel} linux |
496 |
|
497 |
%preun -n %{kname}-source-%{buildrel} |
498 |
for i in /lib/modules/%{kversion}-{desktop586,desktop,server}-%{buildrpmrel}/{build,source}; do |
499 |
if [ -L $i ]; then |
500 |
if [ "$(readlink $i)" = "/usr/src/linux-%{kversion}-%{buildrpmrel}" ]; then |
501 |
rm -f $i |
502 |
fi |
503 |
fi |
504 |
done |
505 |
if [ -L /usr/src/linux ]; then |
506 |
if [ "$(readlink /usr/src/linux)" = "linux-%{kversion}-%{buildrpmrel}" ]; then |
507 |
rm -f /usr/src/linux |
508 |
fi |
509 |
fi |
510 |
exit 0 |
511 |
|
512 |
# |
513 |
# kernel-source-latest: virtual rpm |
514 |
# |
515 |
%package -n %{kname}-source-latest |
516 |
Version: %{kversion} |
517 |
Release: %{rpmrel} |
518 |
Summary: Virtual rpm for latest %{kname}-source |
519 |
Group: Development/Kernel |
520 |
Requires: %{kname}-source-%{buildrel} |
521 |
%ifarch %{ix86} |
522 |
Conflicts: arch(x86_64) |
523 |
%endif |
524 |
|
525 |
%description -n %{kname}-source-latest |
526 |
This package is a virtual rpm that aims to make sure you always have the |
527 |
latest %{kname}-source installed... |
528 |
|
529 |
%common_description_info |
530 |
%endif |
531 |
|
532 |
# |
533 |
# kernel-doc: documentation for the Linux kernel |
534 |
# |
535 |
%if %build_doc |
536 |
%package -n %{kname}-doc |
537 |
Version: %{kversion} |
538 |
Release: %{rpmrel} |
539 |
Summary: Various documentation bits found in the %{kname} source |
540 |
Group: Books/Computer books |
541 |
Buildarch: noarch |
542 |
|
543 |
%description -n %{kname}-doc |
544 |
This package contains documentation files from the %{kname} source. |
545 |
Various bits of information about the Linux kernel and the device drivers |
546 |
shipped with it are documented in these files. You also might want install |
547 |
this package if you need a reference to the options that can be passed to |
548 |
Linux kernel modules at load time. |
549 |
|
550 |
%common_description_info |
551 |
%endif |
552 |
|
553 |
# |
554 |
# End packages - here begins build stage |
555 |
# |
556 |
%prep |
557 |
%setup -q -n %top_dir_name -c |
558 |
%setup -q -n %top_dir_name -D -T -a100 |
559 |
|
560 |
%define patches_dir ../%{patch_ver}/ |
561 |
|
562 |
cd %src_dir |
563 |
|
564 |
%if %kstable |
565 |
%if %kpatch |
566 |
%if %prev_stable |
567 |
%patch1 -p1 |
568 |
%endif |
569 |
%patch2 -p1 |
570 |
%else |
571 |
%patch1 -p1 |
572 |
%endif |
573 |
%else |
574 |
%if %kpatch |
575 |
%patch1 -p1 |
576 |
%endif |
577 |
%endif |
578 |
%if %kgit |
579 |
%patch2 -p1 |
580 |
%endif |
581 |
|
582 |
%{patches_dir}/scripts/apply_patches |
583 |
|
584 |
# PATCH END |
585 |
|
586 |
|
587 |
# |
588 |
# Setup Begin |
589 |
# |
590 |
|
591 |
# Prepare all the variables for calling create_configs |
592 |
|
593 |
%if %build_debug |
594 |
%define debug --debug |
595 |
%else |
596 |
%define debug --no-debug |
597 |
%endif |
598 |
|
599 |
|
600 |
%{patches_dir}/scripts/create_configs %debug --user_cpu="%{target_arch}" |
601 |
|
602 |
# make sure the kernel has the sublevel we know it has... |
603 |
LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile |
604 |
|
605 |
# get rid of unwanted files |
606 |
find . -name '*~' -o -name '*.orig' -o -name '*.append' | %kxargs rm -f |
607 |
|
608 |
|
609 |
%build |
610 |
# Common target directories |
611 |
%define _kerneldir /usr/src/linux-%{kversion}-%{buildrpmrel} |
612 |
%define _bootdir /boot |
613 |
%define _modulesdir /lib/modules |
614 |
%define _efidir %{_bootdir}/efi/mageia |
615 |
|
616 |
# Directories definition needed for building |
617 |
%define temp_root %{build_dir}/temp-root |
618 |
%define temp_source %{temp_root}%{_kerneldir} |
619 |
%define temp_boot %{temp_root}%{_bootdir} |
620 |
%define temp_modules %{temp_root}%{_modulesdir} |
621 |
|
622 |
PrepareKernel() { |
623 |
name=$1 |
624 |
extension=$2 |
625 |
x86_dir=arch/x86/configs |
626 |
|
627 |
echo "Make config for kernel $extension" |
628 |
|
629 |
%smake -s mrproper |
630 |
|
631 |
if [ "%{target_arch}" == "i386" -o "%{target_arch}" == "x86_64" ]; then |
632 |
if [ -z "$name" ]; then |
633 |
cp ${x86_dir}/%{target_arch}_defconfig-desktop .config |
634 |
else |
635 |
cp ${x86_dir}/%{target_arch}_defconfig-$name .config |
636 |
fi |
637 |
else |
638 |
if [ -z "$name" ]; then |
639 |
cp arch/%{target_arch}/defconfig-desktop .config |
640 |
else |
641 |
cp arch/%{target_arch}/defconfig-$name .config |
642 |
fi |
643 |
fi |
644 |
|
645 |
# make sure EXTRAVERSION says what we want it to say |
646 |
%if %kstable |
647 |
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = .%{kstable}-$extension/" Makefile |
648 |
%else |
649 |
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -$extension/" Makefile |
650 |
%endif |
651 |
|
652 |
%smake oldconfig |
653 |
} |
654 |
|
655 |
BuildKernel() { |
656 |
KernelVer=$1 |
657 |
|
658 |
echo "Building kernel $KernelVer" |
659 |
|
660 |
%kmake all |
661 |
|
662 |
# Start installing stuff |
663 |
install -d %{temp_boot} |
664 |
install -m 644 System.map %{temp_boot}/System.map-$KernelVer |
665 |
install -m 644 .config %{temp_boot}/config-$KernelVer |
666 |
gzip -c Module.symvers > %{temp_boot}/symvers-$KernelVer.gz |
667 |
|
668 |
%ifarch ppc powerpc |
669 |
cp -f vmlinux %{temp_boot}/vmlinuz-$KernelVer |
670 |
%ifarch ppc |
671 |
cp -f arch/ppc/boot/images/zImage.chrp-rs6k %{temp_boot}/vmlinuz-rs6k-$KernelVer |
672 |
%endif |
673 |
%else |
674 |
%ifarch sparc sparc64 |
675 |
gzip -9c vmlinux > %{temp_boot}/vmlinuz-$KernelVer |
676 |
%else |
677 |
cp -f arch/%{target_arch}/boot/bzImage %{temp_boot}/vmlinuz-$KernelVer |
678 |
%endif |
679 |
%endif |
680 |
|
681 |
# modules |
682 |
install -d %{temp_modules}/$KernelVer |
683 |
%smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=$KernelVer modules_install |
684 |
|
685 |
# remove /lib/firmware, we use a separate kernel-firmware |
686 |
rm -rf %{temp_root}/lib/firmware |
687 |
} |
688 |
|
689 |
SaveDevel() { |
690 |
devel_flavour=$1 |
691 |
|
692 |
DevelRoot=/usr/src/linux-%{kversion}-$devel_flavour-%{buildrpmrel} |
693 |
TempDevelRoot=%{temp_root}$DevelRoot |
694 |
|
695 |
mkdir -p $TempDevelRoot |
696 |
for i in $(find . -name 'Makefile*'); do cp -R --parents $i $TempDevelRoot;done |
697 |
for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*'); do cp -R --parents $i $TempDevelRoot;done |
698 |
cp -fR include $TempDevelRoot |
699 |
cp -fR scripts $TempDevelRoot |
700 |
cp -fR kernel/bounds.c $TempDevelRoot/kernel |
701 |
%ifarch %{ix86} x86_64 |
702 |
cp -fR arch/x86/kernel/asm-offsets.{c,s} $TempDevelRoot/arch/x86/kernel/ |
703 |
cp -fR arch/x86/kernel/asm-offsets_{32,64}.c $TempDevelRoot/arch/x86/kernel/ |
704 |
cp -fR arch/x86/include $TempDevelRoot/arch/x86/ |
705 |
%else |
706 |
cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} $TempDevelRoot/arch/%{target_arch}/kernel/ |
707 |
cp -fR arch/%{target_arch}/include $TempDevelRoot/arch/%{target_arch}/ |
708 |
%endif |
709 |
cp -fR .config Module.symvers $TempDevelRoot |
710 |
cp -fR 3rdparty/mkbuild.pl $TempDevelRoot/3rdparty |
711 |
|
712 |
# Needed for truecrypt build (Danny) |
713 |
cp -fR drivers/md/dm.h $TempDevelRoot/drivers/md/ |
714 |
|
715 |
# Needed for lguest |
716 |
cp -fR drivers/lguest/lg.h $TempDevelRoot/drivers/lguest/ |
717 |
|
718 |
# Needed for lirc_gpio (#39004) |
719 |
cp -fR drivers/media/video/bt8xx/bttv{,p}.h $TempDevelRoot/drivers/media/video/bt8xx/ |
720 |
cp -fR drivers/media/video/bt8xx/bt848.h $TempDevelRoot/drivers/media/video/bt8xx/ |
721 |
cp -fR drivers/media/video/btcx-risc.h $TempDevelRoot/drivers/media/video/ |
722 |
|
723 |
# Needed for external dvb tree (#41418) |
724 |
cp -fR drivers/media/dvb/dvb-core/*.h $TempDevelRoot/drivers/media/dvb/dvb-core/ |
725 |
cp -fR drivers/media/dvb/frontends/lgdt330x.h $TempDevelRoot/drivers/media/dvb/frontends/ |
726 |
|
727 |
# add acpica header files, needed for fglrx build |
728 |
cp -fR drivers/acpi/acpica/*.h $TempDevelRoot/drivers/acpi/acpica/ |
729 |
|
730 |
# aufs2 has a special file needed |
731 |
cp -fR fs/aufs/magic.mk $TempDevelRoot/fs/aufs |
732 |
|
733 |
for i in alpha arm avr32 blackfin cris frv h8300 ia64 m32r m68knommu \ |
734 |
microblaze mips mn10300 parisc s390 score sh tile xtensa; do |
735 |
rm -rf $TempDevelRoot/arch/$i |
736 |
done |
737 |
|
738 |
# ppc needs only m68k headers |
739 |
rm -rf $TempDevelRoot/arch/m68k |
740 |
|
741 |
%ifnarch ppc powerpc |
742 |
rm -rf $TempDevelRoot/arch/powerpc |
743 |
%endif |
744 |
%ifnarch sparc sparc64 |
745 |
rm -rf $TempDevelRoot/arch/sparc |
746 |
rm -rf $TempDevelRoot/arch/sparc64 |
747 |
%endif |
748 |
%ifnarch %{ix86} x86_64 |
749 |
rm -rf $TempDevelRoot/arch/x86 |
750 |
%endif |
751 |
|
752 |
# Clean the scripts tree, and make sure everything is ok (sanity check) |
753 |
# running prepare+scripts (tree was already "prepared" in build) |
754 |
pushd $TempDevelRoot >/dev/null |
755 |
%smake -s prepare scripts |
756 |
%smake -s clean |
757 |
popd >/dev/null |
758 |
rm -f $TempDevelRoot/.config.old |
759 |
|
760 |
# fix permissions |
761 |
chmod -R a+rX $TempDevelRoot |
762 |
|
763 |
# disable mrproper in -devel rpms |
764 |
patch -p1 --fuzz=0 -d $TempDevelRoot -i %{SOURCE2} |
765 |
|
766 |
kernel_devel_files=../kernel_devel_files.$devel_flavour |
767 |
|
768 |
|
769 |
### Create the kernel_devel_files.* |
770 |
cat > $kernel_devel_files <<EOF |
771 |
%defattr(-,root,root) |
772 |
%dir $DevelRoot |
773 |
%dir $DevelRoot/arch |
774 |
%dir $DevelRoot/include |
775 |
$DevelRoot/3rdparty |
776 |
$DevelRoot/Documentation |
777 |
%ifarch ppc powerpc |
778 |
$DevelRoot/arch/powerpc |
779 |
$DevelRoot/arch/ppc |
780 |
%endif |
781 |
%ifarch sparc sparc64 |
782 |
$DevelRoot/arch/sparc |
783 |
$DevelRoot/arch/sparc64 |
784 |
%endif |
785 |
$DevelRoot/arch/um |
786 |
%ifarch %{ix86} x86_64 |
787 |
$DevelRoot/arch/x86 |
788 |
%endif |
789 |
$DevelRoot/block |
790 |
$DevelRoot/crypto |
791 |
$DevelRoot/drivers |
792 |
$DevelRoot/firmware |
793 |
$DevelRoot/fs |
794 |
$DevelRoot/include/Kbuild |
795 |
$DevelRoot/include/acpi |
796 |
$DevelRoot/include/asm-generic |
797 |
$DevelRoot/include/config |
798 |
$DevelRoot/include/crypto |
799 |
$DevelRoot/include/drm |
800 |
$DevelRoot/include/generated |
801 |
$DevelRoot/include/keys |
802 |
$DevelRoot/include/linux |
803 |
$DevelRoot/include/math-emu |
804 |
$DevelRoot/include/media |
805 |
$DevelRoot/include/mtd |
806 |
$DevelRoot/include/net |
807 |
$DevelRoot/include/pcmcia |
808 |
$DevelRoot/include/rdma |
809 |
$DevelRoot/include/rxrpc |
810 |
$DevelRoot/include/scsi |
811 |
$DevelRoot/include/sound |
812 |
$DevelRoot/include/target |
813 |
$DevelRoot/include/trace |
814 |
$DevelRoot/include/video |
815 |
$DevelRoot/include/xen |
816 |
$DevelRoot/init |
817 |
$DevelRoot/ipc |
818 |
$DevelRoot/kernel |
819 |
$DevelRoot/lib |
820 |
$DevelRoot/mm |
821 |
$DevelRoot/net |
822 |
$DevelRoot/samples |
823 |
$DevelRoot/scripts |
824 |
$DevelRoot/security |
825 |
$DevelRoot/sound |
826 |
$DevelRoot/tools |
827 |
$DevelRoot/usr |
828 |
$DevelRoot/virt |
829 |
$DevelRoot/.config |
830 |
$DevelRoot/Kbuild |
831 |
$DevelRoot/Kconfig |
832 |
$DevelRoot/Makefile |
833 |
$DevelRoot/Module.symvers |
834 |
$DevelRoot/arch/Kconfig |
835 |
%doc README.kernel-sources |
836 |
EOF |
837 |
|
838 |
|
839 |
### Create -devel Post script on the fly |
840 |
cat > $kernel_devel_files-post <<EOF |
841 |
if [ -d /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel} ]; then |
842 |
rm -f /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/{build,source} |
843 |
ln -sf $DevelRoot /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/build |
844 |
ln -sf $DevelRoot /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/source |
845 |
fi |
846 |
EOF |
847 |
|
848 |
|
849 |
### Create -devel Preun script on the fly |
850 |
cat > $kernel_devel_files-preun <<EOF |
851 |
if [ -L /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/build ]; then |
852 |
rm -f /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/build |
853 |
fi |
854 |
if [ -L /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/source ]; then |
855 |
rm -f /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/source |
856 |
fi |
857 |
exit 0 |
858 |
EOF |
859 |
} |
860 |
|
861 |
SaveDebug() { |
862 |
debug_flavour=$1 |
863 |
|
864 |
install -m 644 vmlinux \ |
865 |
%{temp_boot}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel} |
866 |
kernel_debug_files=../kernel_debug_files.$debug_flavour |
867 |
echo "%defattr(-,root,root)" > $kernel_debug_files |
868 |
echo "%{_bootdir}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel}" \ |
869 |
>> $kernel_debug_files |
870 |
|
871 |
find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \ |
872 |
-name "*.ko" | \ |
873 |
%kxargs -I '{}' objcopy --only-keep-debug '{}' '{}'.debug |
874 |
find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \ |
875 |
-name "*.ko" | %kxargs -I '{}' \ |
876 |
sh -c 'cd `dirname {}`; \ |
877 |
objcopy --add-gnu-debuglink=`basename {}`.debug \ |
878 |
--strip-debug `basename {}`' |
879 |
|
880 |
pushd %{temp_modules} |
881 |
find %{kversion}-$debug_flavour-%{buildrpmrel}/kernel \ |
882 |
-name "*.ko.debug" > debug_module_list |
883 |
popd |
884 |
cat %{temp_modules}/debug_module_list | \ |
885 |
sed 's|\(.*\)|%{_modulesdir}/\1|' >> $kernel_debug_files |
886 |
cat %{temp_modules}/debug_module_list | \ |
887 |
sed 's|\(.*\)|%exclude %{_modulesdir}/\1|' \ |
888 |
>> ../kernel_exclude_debug_files.$debug_flavour |
889 |
rm -f %{temp_modules}/debug_module_list |
890 |
} |
891 |
|
892 |
CreateFiles() { |
893 |
kernel_flavour=$1 |
894 |
|
895 |
kernel_files=../kernel_files.$kernel_flavour |
896 |
|
897 |
### Create the kernel_files.* |
898 |
cat > $kernel_files <<EOF |
899 |
%defattr(-,root,root) |
900 |
%{_bootdir}/System.map-%{kversion}-$kernel_flavour-%{buildrpmrel} |
901 |
%{_bootdir}/symvers-%{kversion}-$kernel_flavour-%{buildrpmrel}.gz |
902 |
%{_bootdir}/config-%{kversion}-$kernel_flavour-%{buildrpmrel} |
903 |
%{_bootdir}/vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel} |
904 |
%dir %{_modulesdir}/%{kversion}-$kernel_flavour-%{buildrpmrel}/ |
905 |
%{_modulesdir}/%{kversion}-$kernel_flavour-%{buildrpmrel}/kernel |
906 |
%{_modulesdir}/%{kversion}-$kernel_flavour-%{buildrpmrel}/modules.* |
907 |
%doc README.kernel-sources |
908 |
EOF |
909 |
|
910 |
%if %build_debug |
911 |
cat ../kernel_exclude_debug_files.$kernel_flavour >> $kernel_files |
912 |
%endif |
913 |
|
914 |
### Create kernel Post script |
915 |
cat > $kernel_files-post <<EOF |
916 |
/sbin/installkernel %{kversion}-$kernel_flavour-%{buildrpmrel} |
917 |
pushd /boot > /dev/null |
918 |
if [ -L vmlinuz-$kernel_flavour ]; then |
919 |
rm -f vmlinuz-$kernel_flavour |
920 |
fi |
921 |
ln -sf vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel} vmlinuz-$kernel_flavour |
922 |
if [ -L initrd-$kernel_flavour.img ]; then |
923 |
rm -f initrd-$kernel_flavour.img |
924 |
fi |
925 |
ln -sf initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img initrd-$kernel_flavour.img |
926 |
popd > /dev/null |
927 |
%if %build_devel |
928 |
# create kernel-devel symlinks if matching -devel- rpm is installed |
929 |
if [ -d /usr/src/linux-%{kversion}-$kernel_flavour-%{buildrpmrel} ]; then |
930 |
rm -f /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/{build,source} |
931 |
ln -sf /usr/src/linux-%{kversion}-$kernel_flavour-%{buildrpmrel} /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/build |
932 |
ln -sf /usr/src/linux-%{kversion}-$kernel_flavour-%{buildrpmrel} /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/source |
933 |
fi |
934 |
%endif |
935 |
%if %build_source |
936 |
# create kernel-source symlinks only if matching -devel- rpm is not installed |
937 |
if [ -d /usr/src/linux-%{kversion}-%{buildrpmrel} -a ! -d /usr/src/linux-%{kversion}-$kernel_flavour-%{buildrpmrel} ]; then |
938 |
rm -f /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/{build,source} |
939 |
ln -sf /usr/src/linux-%{kversion}-%{buildrpmrel} /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/build |
940 |
ln -sf /usr/src/linux-%{kversion}-%{buildrpmrel} /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/source |
941 |
fi |
942 |
%endif |
943 |
EOF |
944 |
|
945 |
|
946 |
### Create kernel Preun script on the fly |
947 |
cat > $kernel_files-preun <<EOF |
948 |
/sbin/installkernel -R %{kversion}-$kernel_flavour-%{buildrpmrel} |
949 |
pushd /boot > /dev/null |
950 |
if [ -L vmlinuz-$kernel_flavour ]; then |
951 |
if [ "$(readlink vmlinuz-$kernel_flavour)" = "vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel}" ]; then |
952 |
rm -f vmlinuz-$kernel_flavour |
953 |
fi |
954 |
fi |
955 |
if [ -L initrd-$kernel_flavour.img ]; then |
956 |
if [ "$(readlink initrd-$kernel_flavour.img)" = "initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img" ]; then |
957 |
rm -f initrd-$kernel_flavour.img |
958 |
fi |
959 |
fi |
960 |
popd > /dev/null |
961 |
%if %build_devel |
962 |
if [ -L /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/build ]; then |
963 |
rm -f /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/build |
964 |
fi |
965 |
if [ -L /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/source ]; then |
966 |
rm -f /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/source |
967 |
fi |
968 |
%endif |
969 |
exit 0 |
970 |
EOF |
971 |
|
972 |
|
973 |
### Create kernel Postun script on the fly |
974 |
cat > $kernel_files-postun <<EOF |
975 |
/sbin/kernel_remove_initrd %{kversion}-$kernel_flavour-%{buildrpmrel} |
976 |
EOF |
977 |
} |
978 |
|
979 |
|
980 |
CreateKernel() { |
981 |
flavour=$1 |
982 |
|
983 |
PrepareKernel $flavour $flavour-%{buildrpmrel} |
984 |
|
985 |
BuildKernel %{kversion}-$flavour-%{buildrpmrel} |
986 |
%if %build_devel |
987 |
SaveDevel $flavour |
988 |
%endif |
989 |
%if %build_debug |
990 |
SaveDebug $flavour |
991 |
%endif |
992 |
CreateFiles $flavour |
993 |
} |
994 |
|
995 |
|
996 |
### |
997 |
# DO it... |
998 |
### |
999 |
|
1000 |
|
1001 |
# Create a simulacro of buildroot |
1002 |
rm -rf %{temp_root} |
1003 |
install -d %{temp_root} |
1004 |
|
1005 |
|
1006 |
#make sure we are in the directory |
1007 |
cd %src_dir |
1008 |
|
1009 |
%ifarch %{ix86} |
1010 |
%if %build_desktop586 |
1011 |
CreateKernel desktop586 |
1012 |
%endif |
1013 |
%endif |
1014 |
|
1015 |
%if %build_desktop |
1016 |
CreateKernel desktop |
1017 |
%endif |
1018 |
|
1019 |
%if %build_server |
1020 |
CreateKernel server |
1021 |
%endif |
1022 |
|
1023 |
|
1024 |
# We don't make to repeat the depend code at the install phase |
1025 |
%if %build_source |
1026 |
PrepareKernel "" %{buildrpmrel}custom |
1027 |
%smake -s mrproper |
1028 |
%endif |
1029 |
|
1030 |
|
1031 |
### |
1032 |
### install |
1033 |
### |
1034 |
%install |
1035 |
install -m 644 %{SOURCE4} . |
1036 |
|
1037 |
cd %src_dir |
1038 |
|
1039 |
# Directories definition needed for installing |
1040 |
%define target_source %{buildroot}%{_kerneldir} |
1041 |
%define target_boot %{buildroot}%{_bootdir} |
1042 |
%define target_modules %{buildroot}%{_modulesdir} |
1043 |
|
1044 |
# We want to be able to test several times the install part |
1045 |
rm -rf %{buildroot} |
1046 |
cp -a %{temp_root} %{buildroot} |
1047 |
|
1048 |
# Create directories infastructure |
1049 |
%if %build_source |
1050 |
install -d %{target_source} |
1051 |
|
1052 |
tar cf - . | tar xf - -C %{target_source} |
1053 |
chmod -R a+rX %{target_source} |
1054 |
|
1055 |
# we remove all the source files that we don't ship |
1056 |
# first architecture files |
1057 |
for i in alpha arm arm26 avr32 blackfin cris frv h8300 ia64 m32r m68knommu \ |
1058 |
microblaze mips parisc s390 score sh sh64 tile v850 xtensa mn10300; do |
1059 |
rm -rf %{target_source}/arch/$i |
1060 |
done |
1061 |
|
1062 |
# ppc needs only m68k headers |
1063 |
rm -rf %{target_source}/arch/m68k |
1064 |
|
1065 |
%ifnarch ppc powerpc |
1066 |
rm -rf %{target_source}/arch/ppc |
1067 |
rm -rf %{target_source}/arch/powerpc |
1068 |
%endif |
1069 |
%ifnarch sparc sparc64 |
1070 |
rm -rf %{target_source}/arch/sparc |
1071 |
rm -rf %{target_source}/arch/sparc64 |
1072 |
%endif |
1073 |
%ifnarch %{ix86} x86_64 |
1074 |
rm -rf %{target_source}/arch/x86 |
1075 |
%endif |
1076 |
|
1077 |
# other misc files |
1078 |
rm -f %{target_source}/{.config.old,.config.cmd,.gitignore,.lst,.mailmap} |
1079 |
rm -f %{target_source}/{.missing-syscalls.d,arch/.gitignore,firmware/.gitignore} |
1080 |
|
1081 |
#endif %build_source |
1082 |
%endif |
1083 |
|
1084 |
# gzipping modules |
1085 |
find %{target_modules} -name "*.ko" | %kxargs gzip -9 |
1086 |
|
1087 |
# We used to have a copy of PrepareKernel here |
1088 |
# Now, we make sure that the thing in the linux dir is what we want it to be |
1089 |
for i in %{target_modules}/*; do |
1090 |
rm -f $i/build $i/source |
1091 |
done |
1092 |
|
1093 |
# sniff, if we gzipped all the modules, we change the stamp :( |
1094 |
# we really need the depmod -ae here |
1095 |
pushd %{target_modules} |
1096 |
for i in *; do |
1097 |
/sbin/depmod -u -ae -b %{buildroot} -r -F %{target_boot}/System.map-$i $i |
1098 |
echo $? |
1099 |
done |
1100 |
|
1101 |
for i in *; do |
1102 |
pushd $i |
1103 |
echo "Creating modules.description for $i" |
1104 |
modules=`find . -name "*.ko.gz"` |
1105 |
echo $modules | %kxargs /sbin/modinfo \ |
1106 |
| perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description |
1107 |
popd |
1108 |
done |
1109 |
popd |
1110 |
|
1111 |
|
1112 |
### |
1113 |
### clean |
1114 |
### |
1115 |
%clean |
1116 |
rm -rf %{buildroot} |
1117 |
|
1118 |
|
1119 |
# We don't want to remove this, the whole reason of its existence is to be |
1120 |
# able to do several rpm --short-circuit -bi for testing install |
1121 |
# phase without repeating compilation phase |
1122 |
#rm -rf %{temp_root} |
1123 |
|
1124 |
### |
1125 |
### source and doc file lists |
1126 |
### |
1127 |
|
1128 |
%if %build_source |
1129 |
%files -n %{kname}-source-%{buildrel} |
1130 |
%defattr(-,root,root) |
1131 |
%dir %{_kerneldir} |
1132 |
%dir %{_kerneldir}/arch |
1133 |
%dir %{_kerneldir}/include |
1134 |
%{_kerneldir}/3rdparty |
1135 |
%{_kerneldir}/Documentation |
1136 |
%{_kerneldir}/arch/Kconfig |
1137 |
%ifarch powerpc ppc |
1138 |
%{_kerneldir}/arch/powerpc |
1139 |
%{_kerneldir}/arch/ppc |
1140 |
%endif |
1141 |
%ifarch sparc sparc64 |
1142 |
%{_kerneldir}/arch/sparc |
1143 |
%{_kerneldir}/arch/sparc64 |
1144 |
%endif |
1145 |
%{_kerneldir}/arch/um |
1146 |
%ifarch %{ix86} x86_64 |
1147 |
%{_kerneldir}/arch/x86 |
1148 |
%endif |
1149 |
%{_kerneldir}/block |
1150 |
%{_kerneldir}/crypto |
1151 |
%{_kerneldir}/drivers |
1152 |
%{_kerneldir}/firmware |
1153 |
%{_kerneldir}/fs |
1154 |
%{_kerneldir}/include/Kbuild |
1155 |
%{_kerneldir}/include/acpi |
1156 |
%{_kerneldir}/include/asm-generic |
1157 |
%ifarch powerpc ppc |
1158 |
%{_kerneldir}/include/m68k |
1159 |
%{_kerneldir}/include/powerpc |
1160 |
%{_kerneldir}/include/ppc |
1161 |
%endif |
1162 |
%{_kerneldir}/include/crypto |
1163 |
%{_kerneldir}/include/drm |
1164 |
%{_kerneldir}/include/keys |
1165 |
%{_kerneldir}/include/linux |
1166 |
%{_kerneldir}/include/math-emu |
1167 |
%{_kerneldir}/include/media |
1168 |
%{_kerneldir}/include/mtd |
1169 |
%{_kerneldir}/include/net |
1170 |
%{_kerneldir}/include/pcmcia |
1171 |
%{_kerneldir}/include/rdma |
1172 |
%{_kerneldir}/include/rxrpc |
1173 |
%{_kerneldir}/include/scsi |
1174 |
%{_kerneldir}/include/sound |
1175 |
%{_kerneldir}/include/target |
1176 |
%{_kerneldir}/include/trace |
1177 |
%{_kerneldir}/include/video |
1178 |
%{_kerneldir}/include/xen |
1179 |
%{_kerneldir}/init |
1180 |
%{_kerneldir}/ipc |
1181 |
%{_kerneldir}/kernel |
1182 |
%{_kerneldir}/lib |
1183 |
%{_kerneldir}/mm |
1184 |
%{_kerneldir}/net |
1185 |
%{_kerneldir}/virt |
1186 |
%{_kerneldir}/samples |
1187 |
%{_kerneldir}/scripts |
1188 |
%{_kerneldir}/security |
1189 |
%{_kerneldir}/sound |
1190 |
%{_kerneldir}/tools |
1191 |
%{_kerneldir}/usr |
1192 |
%{_kerneldir}/COPYING |
1193 |
%{_kerneldir}/CREDITS |
1194 |
%{_kerneldir}/Kbuild |
1195 |
%{_kerneldir}/Kconfig |
1196 |
%{_kerneldir}/MAINTAINERS |
1197 |
%{_kerneldir}/Makefile |
1198 |
%{_kerneldir}/README |
1199 |
%{_kerneldir}/REPORTING-BUGS |
1200 |
%doc README.kernel-sources |
1201 |
|
1202 |
%files -n %{kname}-source-latest |
1203 |
%defattr(-,root,root) |
1204 |
%endif |
1205 |
|
1206 |
%if %build_doc |
1207 |
%files -n %{kname}-doc |
1208 |
%defattr(-,root,root) |
1209 |
%doc linux-%{tar_ver}/Documentation/* |
1210 |
%endif |
1211 |
|