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