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