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