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