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