/[packages]/backports/6/kernel-joeghi/current/SPECS/kernel-joeghi.spec
ViewVC logotype

Contents of /backports/6/kernel-joeghi/current/SPECS/kernel-joeghi.spec

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.30