/[packages]/updates/6/kernel-linus/current/SPECS/kernel-linus.spec
ViewVC logotype

Contents of /updates/6/kernel-linus/current/SPECS/kernel-linus.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1068711 - (show annotations) (download)
Tue Nov 22 09:42:17 2016 UTC (7 years, 4 months ago) by pterjan
Original Path: cauldron/kernel-linus/current/SPECS/kernel-linus.spec
File size: 26065 byte(s)
Drop BuildRequires and fix defconfig path on arm
1 # upstream versioning
2 %define kernelversion 4
3 %define patchlevel 8
4 # sublevel is now used for -stable patches
5 %define sublevel 10
6 # extstable is for extended stable patches
7 %define extstable 0
8
9 # kernel Makefile extraversion is substituted by
10 # kpatch/kgit wich are either 0 (empty), rc (kpatch), git (kgit)
11 %define kpatch 0
12
13 # kernel.org -gitX patch (only the number after "git")
14 %define kgit 0
15
16 # this is the releaseversion
17 %define mgarelease 1
18
19 # This is only to make life easier for people that creates derivated kernels
20 # a.k.a name it kernel-tmb :)
21 %define kname kernel-linus
22
23 %define rpmtag %{distsuffix}%{mgaver}
24 %if %kpatch
25 %if %kgit
26 %define rpmrel %mkrel 0.%{kpatch}.%{kgit}.%{mgarelease}
27 %else
28 %define rpmrel %mkrel 0.%{kpatch}.%{mgarelease}
29 %endif
30 %else
31 %define rpmrel %mkrel %{mgarelease}
32 %endif
33
34 # theese two never change, they are used to fool rpm/urpmi/smart
35 %define fakever 1
36 %define fakerel %mkrel 1
37
38 # When we are using a pre/rc patch, the tarball is a sublevel -1
39 %if %kpatch
40 %if %sublevel
41 %define tar_ver %{kernelversion}.%{patchlevel}
42 %else
43 %define tar_ver %{kernelversion}.%(expr %{patchlevel} - 1)
44 %endif
45 %else
46 %define tar_ver %{kernelversion}.%{patchlevel}
47 %endif
48 %if %extstable
49 %define kversion %{kernelversion}.%{patchlevel}.%{sublevel}.%{extstable}
50 %else
51 %define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
52 %endif
53 %define kverrel %{kversion}-%{rpmrel}
54
55 # used for not making too long names for rpms or search paths
56 %if %kpatch
57 %if %kgit
58 %define buildrpmrel 0.%{kpatch}.%{kgit}.%{mgarelease}%{rpmtag}
59 %else
60 %define buildrpmrel 0.%{kpatch}.%{mgarelease}%{rpmtag}
61 %endif
62 %else
63 %define buildrpmrel %{mgarelease}%{rpmtag}
64 %endif
65
66 %define buildrel %{kversion}-%{buildrpmrel}
67
68 %define klinus_notice NOTE: This kernel has no Mageia patches and no third-party drivers.
69
70 # having different top level names for packges means that you have to remove them by hard :(
71 %define top_dir_name %{kname}-%{_arch}
72
73 %define build_dir ${RPM_BUILD_DIR}/%{top_dir_name}
74 %define src_dir %{build_dir}/linux-%{tar_ver}
75
76 # disable useless debug rpms...
77 %define _enable_debug_packages %{nil}
78 %define debug_package %{nil}
79
80 # build defines
81 %define build_doc 1
82 %define build_source 1
83 %define build_devel 1
84
85 %define build_kernel 1
86
87 %define distro_branch %(perl -pe '/(\\d+)\\.(\\d)\\.?(\\d)?/; $_="$1.$2"' /etc/mageia-release)
88
89 # End of user definitions
90 %{?_without_kernel: %global build_kernel 0}
91 %{?_without_doc: %global build_doc 0}
92 %{?_without_source: %global build_source 0}
93 %{?_without_devel: %global build_devel 0}
94
95 %{?_with_kernel: %global build_kernel 1}
96 %{?_with_doc: %global build_doc 1}
97 %{?_with_source: %global build_source 1}
98 %{?_with_devel: %global build_devel 1}
99
100 %if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi)
101 %define kmake %make_build CC="$CC"
102 %else
103 %define kmake %make_build
104 %endif
105 # there are places where parallel make doesn't work
106 %define smake make
107
108 # Parallelize xargs invocations on smp machines
109 %define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\
110 && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
111 [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS")
112
113 # Aliases for amd64 builds (better make source links?)
114 %define target_cpu %(echo %{_target_cpu} | sed -e "s/amd64/x86_64/")
115 %define target_arch %(echo %{_arch} | sed -e "s/amd64/x86_64/" -e 's/arm.*/arm/')
116
117 # src.rpm description
118 Summary: The Linux kernel (the core of the Linux operating system)
119 Name: %{kname}
120 Version: %{kversion}
121 Release: %{rpmrel}
122 License: GPLv2
123 Group: System/Kernel and hardware
124 ExclusiveArch: %{ix86} x86_64 %{arm}
125 ExclusiveOS: Linux
126 URL: http://www.kernel.org/
127
128 ####################################################################
129 #
130 # Sources
131 #
132 ### This is for full SRC RPM
133 Source0: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.xz
134 Source1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/linux-%{tar_ver}.tar.sign
135
136 # This is for disabling mrproper and other targets on -devel rpms
137 Source2: disable-mrproper-in-devel-rpms.patch
138
139 Source4: README.kernel-sources
140
141 # Kernel defconfigs
142 Source20: i386_defconfig
143 Source21: x86_64_defconfig
144 Source22: arm_defconfig
145
146 ####################################################################
147 #
148 # Patches
149
150 #
151 # Patch0 to Patch100 are for core kernel upgrades.
152 #
153
154 # Pre linus patch: ftp://ftp.kernel.org/pub/linux/kernel/v(kernelversion).(patchlevel)/testing
155
156 %if %sublevel
157 Patch1: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.xz
158 Source11: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.sign
159 %endif
160 %if %kpatch
161 Patch2: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.x/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.xz
162 Source12: ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.x/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.sign
163 %endif
164 %if %extstable
165 Patch3: patch-%{kernelversion}.%{patchlevel}.%{sublevel}.%{extstable}.patch
166 %endif
167
168 # critical fixes
169
170 #END
171 ####################################################################
172
173 # global defines
174 Autoreqprov: no
175 BuildRequires: gcc
176 BuildRequires: kmod >= 12-2
177 BuildRequires: bc
178 BuildRequires: binutils >= 1:2.25.1
179
180 %description
181 Source package to build the Linux kernel.
182
183 %{klinus_notice}
184
185
186 #
187 # kernel: Symmetric MultiProcessing kernel
188 #
189 %if %build_kernel
190 %package -n %{kname}-%{buildrel}
191 Version: %{fakever}
192 Release: %{fakerel}
193 %ifarch %{ix86}
194 Summary: Linux Kernel for desktop use with i586 & 4GB RAM
195 %else
196 %ifarch %{arm}
197 Summary: Linux Kernel for Arm machines based on Kirkwood
198 %else
199 Summary: Linux Kernel for desktop use with %{_arch}
200 %endif
201 %endif
202 Group: System/Kernel and hardware
203 Provides: should-restart = system
204 Provides: kernel = %{tar_ver}
205 Provides: alsa
206 Requires: bootloader-utils >= 1.16-1
207 Requires: dracut >= 038-21
208 Requires: kmod >= 12-2
209 Requires: sysfsutils >= 2.1.0-16
210 Requires: kernel-firmware >= 20160712-1
211
212 # conflict dkms packages that dont support kernel-4.8
213 Conflicts: dkms-broadcom-wl < 6.30.223.271-44
214 Conflicts: dkms-fglrx < 15.302
215 Conflicts: dkms-nvidia-current < 367.57-1
216 Conflicts: dkms-nvidia340 < 340.98-1
217 Conflicts: dkms-nvidia304 < 304.132-1
218 Conflicts: dkms-virtualbox < 5.1.6-3
219 Conflicts: dkms-xtables-addons < 2.11-1
220 # not supported by x11-server-1.16
221 Conflicts: dkms-nvidia173 <= 173.14.39
222 # (tmb) nvidia96xx does not support this kernel or x11-server-1.13
223 Conflicts: dkms-nvidia96xx <= 96.43.23
224 # (tmb) conflict too old lvm2 rules to make upgrades work (tv, mga #9536)
225 Conflicts: lvm2 < 2.02.98-3
226 # (tmb) conflict too old drakxtools-backend to avoid bogus root=/dev/ (#9536)
227 Conflicts: drakxtools-backend < 15.37-1
228 # (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd
229 Conflicts: btrfs-progs < 4.4.1-1
230 # (tmb) conflict too old plymouth (mga#15486)
231 Conflicts: plymouth < 0.8.6.1-13
232 # (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd
233 Conflicts: radeon-firmware < 20160712-1
234 # (tmb) conflict old firmware to get the firmwares in initrd
235 Conflicts: kernel-firmware-nonfree < 20160712-1
236 # (tmb) conflict old microcode to get updated ones in initrd for early loading
237 Conflicts: microcode < 0.20160409-1
238 # (tmb) conflict old theme to get mga5 theme in initrd
239 Conflicts: mageia-gfxboot-theme < 4.5.6.6-1
240 # (tmb) conflict too old grub2(-efi)
241 Conflicts: grub2 < 2.02-0.git9752.18
242 Conflicts: grub2-efi < 2.02-0.git9752.18
243 # (tmb) conflict too old efibootmgr
244 Conflicts: efibootmgr < 0.11.0-7
245 # (tmb) conflict for vmmouse breakage (mga#16954)
246 Conflicts: x11-driver-input-vmmouse < 13.1.0-1
247
248 %ifarch %{ix86}
249 Conflicts: arch(x86_64)
250 %endif
251
252 %description -n %{kname}-%{buildrel}
253 %ifarch %{ix86}
254 This kernel is compiled for desktop use, single or multiple i586
255 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, voluntary
256 preempt, CFS cpu scheduler and cfq i/o scheduler.
257 This kernel relies on in-kernel smp alternatives to switch between
258 up & smp mode depending on detected hardware. To force the kernel
259 to boot in single processor mode, use the "nosmp" boot parameter.
260 %else
261 %ifarch %{arm}
262 This kernel is compiled for Arm Kirkwood boxes. It will run on openrd
263 boards. It's configured using HZ_100, preempt, CFS cpu scheduler and
264 cfq i/o scheduler.
265 This kernel relies on in-kernel smp alternatives to switch between
266 up & smp mode depending on detected hardware. To force the kernel
267 to boot in single processor mode, use the "nosmp" boot parameter.
268 %else
269 This kernel is compiled for desktop use, single or multiple %{_arch}
270 processor(s)/core(s), using HZ_1000, voluntary preempt, CFS cpu
271 scheduler and cfq i/o scheduler.
272 This kernel relies on in-kernel smp alternatives to switch between
273 up & smp mode depending on detected hardware. To force the kernel
274 to boot in single processor mode, use the "nosmp" boot parameter.
275 %endif
276 %endif
277
278 %{klinus_notice}
279 %endif # build_kernel
280
281
282 #
283 # kernel-source: kernel sources
284 #
285 %if %build_source
286 %package -n %{kname}-source-%{buildrel}
287 Version: %{fakever}
288 Release: %{fakerel}
289 Provides: %{kname}-source, kernel-source = %{kverrel}
290 Provides: %{kname}-source-%{kernelversion}.%{patchlevel}
291 Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils
292 Summary: The source code for the Linux kernel
293 Group: Development/Kernel
294 Autoreqprov: no
295 Buildarch: noarch
296
297 %description -n %{kname}-source-%{buildrel}
298 The %{kname}-source package contains the source code files for the
299 Linux kernel. Theese source files are only needed if you want to build
300 your own custom kernel that is better tuned to your particular hardware.
301
302 If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...)
303 drivers against, install the *-devel-* rpm that is matching your kernel.
304
305 %{klinus_notice}
306 %endif #build_source
307
308
309 #
310 # kernel-devel: stripped kernel sources
311 #
312 %if %build_devel
313 %package -n %{kname}-devel-%{buildrel}
314 Version: %{fakever}
315 Release: %{fakerel}
316 Provides: kernel-devel = %{kverrel}
317 Summary: The %{kname} devel files for 3rdparty modules build
318 Group: Development/Kernel
319 Autoreqprov: no
320 Requires: glibc-devel, ncurses-devel, make, gcc, perl
321 %ifarch %{ix86}
322 Conflicts: arch(x86_64)
323 %endif
324
325 %description -n %{kname}-devel-%{buildrel}
326 This package contains the kernel-devel files that should be enough to build
327 3rdparty drivers against for use with the %{kname}-%{buildrel}.
328
329 If you want to build your own kernel, you need to install the full
330 %{kname}-source-%{buildrel} rpm.
331
332 %{klinus_notice}
333 %endif #build_devel
334
335
336 #
337 # kernel-doc: documentation for the Linux kernel
338 #
339 %if %build_doc
340 %package -n %{kname}-doc
341 Version: %{kversion}
342 Release: %{rpmrel}
343 Summary: Various documentation bits found in the kernel source
344 Group: Documentation
345 Buildarch: noarch
346
347 %description -n %{kname}-doc
348 This package contains documentation files form the kernel source. Various
349 bits of information about the Linux kernel and the device drivers shipped
350 with it are documented in these files. You also might want install this
351 package if you need a reference to the options that can be passed to Linux
352 kernel modules at load time.
353
354 %{klinus_notice}
355 %endif #build_doc
356
357
358 #
359 # kernel-latest: virtual rpm
360 #
361 %if %build_kernel
362 %package -n %{kname}-latest
363 Version: %{kversion}
364 Release: %{rpmrel}
365 Summary: Virtual rpm for latest %{kname}
366 Group: System/Kernel and hardware
367 Requires: %{kname}-%{buildrel}
368 %ifarch %{ix86}
369 Conflicts: arch(x86_64)
370 %endif
371
372 %description -n %{kname}-latest
373 This package is a virtual rpm that aims to make sure you always have the
374 latest %{kname} installed...
375
376 %{klinus_notice}
377 %endif #build_kernel
378
379
380 #
381 # kernel-source-latest: virtual rpm
382 #
383 %if %build_source
384 %package -n %{kname}-source-latest
385 Version: %{kversion}
386 Release: %{rpmrel}
387 Summary: Virtual rpm for latest %{kname}-source
388 Group: System/Kernel and hardware
389 Requires: %{kname}-source-%{buildrel}
390 Buildarch: noarch
391
392 %description -n %{kname}-source-latest
393 This package is a virtual rpm that aims to make sure you always have the
394 latest %{kname}-source installed...
395
396 %{klinus_notice}
397 %endif #build_source
398
399
400 #
401 # kernel-devel-latest: virtual rpm
402 #
403 %if %build_devel
404 %package -n %{kname}-devel-latest
405 Version: %{kversion}
406 Release: %{rpmrel}
407 Summary: Virtual rpm for latest %{kname}-devel
408 Group: System/Kernel and hardware
409 Requires: %{kname}-devel-%{buildrel}
410 %ifarch %{ix86}
411 Conflicts: arch(x86_64)
412 %endif
413
414 %description -n %{kname}-devel-latest
415 This package is a virtual rpm that aims to make sure you always have the
416 latest %{kname}-devel installed...
417
418 %{klinus_notice}
419 %endif #build_devel
420
421
422 #
423 # End packages - here begins build stage
424 #
425 %prep
426 %setup -q -n %top_dir_name -c
427
428 pushd %src_dir
429
430 %if %sublevel
431 %patch1 -p1
432 %endif
433 %if %kpatch
434 %patch2 -p1
435 %endif
436 %if %extstable
437 %patch3 -p1
438 %endif
439
440 # critical fixes
441
442 popd
443
444 # PATCH END
445
446
447 #
448 # Setup Begin
449 #
450
451
452 # Install defconfigs...
453 install %{SOURCE20} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/
454 install %{SOURCE21} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/
455 install %{SOURCE22} %{build_dir}/linux-%{tar_ver}/arch/arm/configs/
456
457 # make sure the kernel has the sublevel we know it has...
458 LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" linux-%{tar_ver}/Makefile
459
460
461 %build
462 # Common target directories
463 %define _bootdir /boot
464 %define _modulesdir /lib/modules
465 %define _kerneldir /usr/src/%{kname}-%{buildrel}
466 %define _develdir /usr/src/%{kname}-devel-%{buildrel}
467
468
469 # Directories definition needed for building
470 %define temp_root %{build_dir}/temp-root
471 %define temp_boot %{temp_root}%{_bootdir}
472 %define temp_modules %{temp_root}%{_modulesdir}
473 %define temp_source %{temp_root}%{_kerneldir}
474 %define temp_devel %{temp_root}%{_develdir}
475
476
477 # Create a simulacro of buildroot
478 rm -rf %{temp_root}
479 install -d %{temp_root}
480
481
482 # make sure we are in the directory
483 cd %{src_dir}
484
485 # make sure EXTRAVERSION says what we want it to say
486 %if %extstable
487 LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = .%{extstable}-%{buildrpmrel}/" Makefile
488 %else
489 LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildrpmrel}/" Makefile
490 %endif
491
492 # Prepare the kernel
493 %smake -s mrproper
494 %ifarch %{ix86} x86_64
495 cp arch/x86/configs/%{target_arch}_defconfig .config
496 %else
497 cp arch/%{target_arch}/configs/%{target_arch}_defconfig .config
498 %endif
499 %smake oldconfig
500
501 # Build the kernel
502 %kmake -s all
503 %ifarch %{arm}
504 %kmake uImage
505 %endif
506 # Install kernel
507 install -d %{temp_boot}
508 install -m 644 System.map %{temp_boot}/System.map-%{buildrel}
509 install -m 644 .config %{temp_boot}/config-%{buildrel}
510 %ifarch %{arm}
511 cp -f arch/%{target_arch}/boot/uImage %{temp_boot}/uImage-$KernelVer
512 %else
513 cp -f arch/%{target_arch}/boot/bzImage %{temp_boot}/vmlinuz-%{buildrel}
514 %endif
515
516 # Install modules
517 install -d %{temp_modules}/%{buildrel}
518 %smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{buildrel} modules_install
519
520 # remove /lib/firmware, we use a separate kernel-firmware
521 rm -rf %{temp_root}/lib/firmware
522
523 # Save devel tree
524 %if %build_devel
525 mkdir -p %{temp_devel}
526 for i in $(find . -name 'Makefile*'); do cp -R --parents $i %{temp_devel};done
527 for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*' -o -name config.mk); do cp -R --parents $i %{temp_devel};done
528 cp -fR include %{temp_devel}
529 cp -fR scripts %{temp_devel}
530 cp -fR tools/include %{temp_devel}/tools/
531 %ifarch %{arm}
532 cp -fR arch/%{target_arch}/tools %{temp_devel}/arch/%{target_arch}/
533 %endif
534 %ifarch %{ix86} x86_64
535 cp -fR arch/x86/boot/{ctype.h,string.{c,h}} %{temp_devel}/arch/x86/boot/
536 cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel}/arch/x86/kernel/
537 cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel}/arch/x86/kernel/
538 cp -fR arch/x86/purgatory/* %{temp_devel}/arch/x86/purgatory/
539 cp -fR arch/x86/entry/syscalls/syscall* %{temp_devel}/arch/x86/entry/syscalls/
540 cp -fR arch/x86/include %{temp_devel}/arch/x86/
541 cp -fR arch/x86/tools %{temp_devel}/arch/x86/
542 %else
543 cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} %{temp_devel}/arch/%{target_arch}/kernel/
544 for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f %{temp_devel}; done
545 %endif
546
547 # Needed for generation of kernel/bounds.s
548 cp -fR kernel/bounds.c %{temp_devel}/kernel/
549
550 # needed by include/generated/timeconst.h
551 cp -fR kernel/time/timeconst.bc %{temp_devel}/kernel/time/
552
553 # Needed for lguest
554 cp -fR drivers/lguest/lg.h %{temp_devel}/drivers/lguest/
555
556 cp -fR .config Module.symvers %{temp_devel}
557
558 # Needed for truecrypt build (Danny)
559 cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/
560
561 # Needed for external dvb tree (#41418)
562 cp -fR drivers/media/dvb-core/*.h %{temp_devel}/drivers/media/dvb-core/
563 cp -fR drivers/media/dvb-frontends/lgdt330x.h %{temp_devel}/drivers/media/dvb-frontends/
564
565 # add acpica header files, needed for fglrx build
566 cp -fR drivers/acpi/acpica/*.h %{temp_devel}/drivers/acpi/acpica/
567
568 # Check and clean the -devel tree
569 pushd %{temp_devel} >/dev/null
570 %smake -s prepare scripts clean
571 rm -f .config.old
572 popd >/dev/null
573
574 # Disable mrproper and other targets
575 patch -p1 -d %{temp_devel} -i %{SOURCE2}
576
577 # Fix permissions
578 chmod -R a+rX %{temp_devel}
579 %endif # build_devel
580
581 #make sure we are in the directory
582 cd %src_dir
583
584 # kernel-source is shipped as an unprepared tree
585 %smake -s mrproper
586
587
588 ###
589 ### Install
590 ###
591 %install
592 install -m 644 %{SOURCE4} .
593
594 cd %src_dir
595 # Directories definition needed for installing
596 %define target_source %{buildroot}/%{_kerneldir}
597 %define target_boot %{buildroot}%{_bootdir}
598 %define target_modules %{buildroot}%{_modulesdir}
599 %define target_devel %{buildroot}%{_develdir}
600
601 # We want to be able to test several times the install part
602 rm -rf %{buildroot}
603 cp -a %{temp_root} %{buildroot}
604
605 # Create directories infastructure
606 %if %build_source
607 install -d %{target_source}
608
609 tar cf - . | tar xf - -C %{target_source}
610 chmod -R a+rX %{target_source}
611
612 # we remove all the source files that we don't ship
613
614 # first architecture files
615 for i in alpha arc avr32 blackfin c6x cris frv hexagon h8300 ia64 m32r mips \
616 microblaze m68k m68knommu metag mn10300 nios2 openrisc parisc powerpc ppc \
617 s390 score sh sh64 sparc tile unicore32 v850 xtensa; do
618 rm -rf %{target_source}/arch/$i
619
620 %if %build_devel
621 rm -rf %{target_devel}/arch/$i
622 %endif
623 done
624 %ifnarch %{arm}
625 rm -rf %{target_source}/include/kvm/arm*
626 %endif
627
628 # remove arch files based on target arch in -devel rpms
629 %if %build_devel
630 %ifnarch %{ix86} x86_64
631 rm -rf %{target_devel}/arch/x86
632 %endif
633 %ifnarch %{arm}
634 rm -rf %{target_devel}/arch/arm
635 rm -rf %{target_devel}/arch/arm64
636 rm -rf %{target_devel}/include/kvm/arm*
637 rm -rf %{target_devel}/include/soc/tegra
638 %endif
639 %endif
640
641
642 # other misc files
643 rm -f %{target_source}/{.config.old,.config.cmd,.tmp_gas_check,.mailmap,.missing-syscalls.d,arch/.gitignore,.get_maintainer.ignore,.cocciconfig}
644 rm -rf %{target_source}/.tmp_depmod/
645
646 #endif %build_source
647 %endif
648
649
650 # compressing modules
651 find %{target_modules} -name "*.ko" | %kxargs xz -6e
652
653
654 # We used to have a copy of PrepareKernel here
655 # Now, we make sure that the thing in the linux dir is what we want it to be
656
657 for i in %{target_modules}/*; do
658 rm -f $i/build $i/source
659 done
660
661
662 # sniff, if we gzipped all the modules, we change the stamp :(
663 # we really need the depmod -ae here
664 pushd %{target_modules}
665 for i in *; do
666 /sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i
667 echo $?
668 done
669
670 for i in *; do
671 pushd $i
672 echo "Creating module.description for $i"
673 modules=`find . -name "*.ko.xz"`
674 echo $modules | %kxargs /sbin/modinfo \
675 | perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description
676 popd
677 done
678 popd
679
680
681 ###
682 ### Clean
683 ###
684
685 %clean
686 rm -rf %{buildroot}
687 # We don't want to remove this, the whole reason of its existence is to be
688 # able to do several rpm --short-circuit -bi for testing install
689 # phase without repeating compilation phase
690 #rm -rf %{temp_root}
691
692
693 ###
694 ### Scripts
695 ###
696
697 ### kernel
698 %if %build_kernel
699 %preun -n %{kname}-%{buildrel}
700 /sbin/installkernel -R %{buildrel}
701 if [ -L /lib/modules/%{buildrel}/build ]; then
702 rm -f /lib/modules/%{buildrel}/build
703 fi
704 if [ -L /lib/modules/%{buildrel}/source ]; then
705 rm -f /lib/modules/%{buildrel}/source
706 fi
707 pushd /boot > /dev/null
708 if [ -L vmlinuz-linus ]; then
709 if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then
710 rm -f vmlinuz-linus
711 fi
712 fi
713 if [ -L initrd-linus.img ]; then
714 if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then
715 rm -f initrd-linus.img
716 fi
717 fi
718 popd > /dev/null
719 exit 0
720
721 %post -n %{kname}-%{buildrel}
722 /sbin/installkernel -L %{buildrel}
723 if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then
724 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
725 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
726 fi
727 pushd /boot > /dev/null
728 if [ -L vmlinuz-linus ]; then
729 rm -f vmlinuz-linus
730 fi
731 ln -sf vmlinuz-%{buildrel} vmlinuz-linus
732 if [ -L initrd-linus.img ]; then
733 rm -f initrd-linus.img
734 fi
735 ln -sf initrd-%{buildrel}.img initrd-linus.img
736 popd > /dev/null
737
738 %posttrans -n %{kname}-%{buildrel}
739 if [ -x /usr/sbin/dkms_autoinstaller -a -d /usr/src/%{kname}-devel-%{buildrel} ]; then
740 /usr/sbin/dkms_autoinstaller start %{buildrel}
741 fi
742
743 %postun -n %{kname}-%{buildrel}
744 /sbin/kernel_remove_initrd %{buildrel}
745 rm -rf /lib/modules/%{buildrel} > /dev/null
746 %endif # build_kernel
747
748
749 ### kernel-devel
750 %if %build_devel
751 %post -n %{kname}-devel-%{buildrel}
752 # place /build and /source symlinks in place.
753 if [ -d /lib/modules/%{buildrel} ]; then
754 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
755 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
756 fi
757
758 %preun -n %{kname}-devel-%{buildrel}
759 # we need to delete <modules>/{build,source} at uninstall
760 if [ -L /lib/modules/%{buildrel}/build ]; then
761 rm -f /lib/modules/%{buildrel}/build
762 fi
763 if [ -L /lib/modules/%{buildrel}/source ]; then
764 rm -f /lib/modules/%{buildrel}/source
765 fi
766 exit 0
767 %endif #build_devel
768
769
770 ###
771 ### file lists
772 ###
773
774 # kernel
775 %if %build_kernel
776 %files -n %{kname}-%{buildrel}
777 %{_bootdir}/config-%{buildrel}
778 %ifarch %{arm}
779 %{_bootdir}/uImage-%{buildrel}
780 %else
781 %{_bootdir}/vmlinuz-%{buildrel}
782 %endif
783 %{_bootdir}/System.map-%{buildrel}
784 %dir %{_modulesdir}/%{buildrel}/
785 %{_modulesdir}/%{buildrel}/kernel
786 %{_modulesdir}/%{buildrel}/modules.*
787 %doc README.kernel-sources
788 %endif # build_kernel
789
790 # kernel-source
791 %if %build_source
792 %files -n %{kname}-source-%{buildrel}
793 %dir %{_kerneldir}
794 %dir %{_kerneldir}/arch
795 %dir %{_kerneldir}/include
796 %{_kerneldir}/.gitignore
797 %{_kerneldir}/COPYING
798 %{_kerneldir}/CREDITS
799 %{_kerneldir}/Documentation
800 %{_kerneldir}/Kbuild
801 %{_kerneldir}/Kconfig
802 %{_kerneldir}/MAINTAINERS
803 %{_kerneldir}/Makefile
804 %{_kerneldir}/README
805 %{_kerneldir}/REPORTING-BUGS
806 %{_kerneldir}/arch/Kconfig
807 %{_kerneldir}/arch/arm
808 %{_kerneldir}/arch/arm64
809 %{_kerneldir}/arch/x86
810 %{_kerneldir}/arch/um
811 %{_kerneldir}/block
812 %{_kerneldir}/certs
813 %{_kerneldir}/crypto
814 %{_kerneldir}/drivers
815 %{_kerneldir}/firmware
816 %{_kerneldir}/fs
817 %{_kerneldir}/include/Kbuild
818 %{_kerneldir}/include/acpi
819 %{_kerneldir}/include/asm-generic
820 %{_kerneldir}/include/clocksource
821 %{_kerneldir}/include/crypto
822 %{_kerneldir}/include/drm
823 %{_kerneldir}/include/dt-bindings
824 %{_kerneldir}/include/kvm
825 %{_kerneldir}/include/linux
826 %{_kerneldir}/include/math-emu
827 %{_kerneldir}/include/memory
828 %{_kerneldir}/include/net
829 %{_kerneldir}/include/pcmcia
830 %{_kerneldir}/include/ras
831 %{_kerneldir}/include/scsi
832 %{_kerneldir}/include/soc
833 %{_kerneldir}/include/sound
834 %{_kerneldir}/include/target
835 %{_kerneldir}/include/trace
836 %{_kerneldir}/include/uapi
837 %{_kerneldir}/include/video
838 %{_kerneldir}/include/media
839 %{_kerneldir}/include/misc
840 %{_kerneldir}/include/rxrpc
841 %{_kerneldir}/include/keys
842 %{_kerneldir}/include/rdma
843 %{_kerneldir}/include/xen
844 %{_kerneldir}/init
845 %{_kerneldir}/ipc
846 %{_kerneldir}/kernel
847 %{_kerneldir}/lib
848 %{_kerneldir}/mm
849 %{_kerneldir}/net
850 %{_kerneldir}/samples
851 %{_kerneldir}/scripts
852 %{_kerneldir}/security
853 %{_kerneldir}/sound
854 %{_kerneldir}/tools
855 %{_kerneldir}/usr
856 %{_kerneldir}/virt
857 %doc README.kernel-sources
858 %endif # build_source
859
860 # kernel-devel
861 %if %build_devel
862 %files -n %{kname}-devel-%{buildrel}
863 %dir %{_develdir}
864 %dir %{_develdir}/arch
865 %dir %{_develdir}/include
866 %{_develdir}/.config
867 %{_develdir}/Documentation
868 %{_develdir}/Kbuild
869 %{_develdir}/Kconfig
870 %{_develdir}/Makefile
871 %{_develdir}/Module.symvers
872 %{_develdir}/arch/Kconfig
873 %ifarch %{arm}
874 %{_develdir}/arch/arm
875 %{_develdir}/arch/arm64
876 %endif
877 %ifarch %{ix86} x86_64
878 %{_develdir}/arch/x86
879 %endif
880 %{_develdir}/arch/um
881 %{_develdir}/block
882 %{_develdir}/certs
883 %{_develdir}/crypto
884 %{_develdir}/drivers
885 %{_develdir}/firmware
886 %{_develdir}/fs
887 %{_develdir}/include/Kbuild
888 %{_develdir}/include/acpi
889 %{_develdir}/include/asm-generic
890 %{_develdir}/include/clocksource
891 %{_develdir}/include/config
892 %{_develdir}/include/crypto
893 %{_develdir}/include/drm
894 %{_develdir}/include/dt-bindings
895 %{_develdir}/include/generated
896 %{_develdir}/include/keys
897 %{_develdir}/include/kvm
898 %{_develdir}/include/linux
899 %{_develdir}/include/math-emu
900 %{_develdir}/include/memory
901 %{_develdir}/include/misc
902 %{_develdir}/include/net
903 %{_develdir}/include/pcmcia
904 %{_develdir}/include/ras
905 %{_develdir}/include/rdma
906 %{_develdir}/include/scsi
907 %{_develdir}/include/soc
908 %{_develdir}/include/sound
909 %{_develdir}/include/target
910 %{_develdir}/include/trace
911 %{_develdir}/include/uapi
912 %{_develdir}/include/video
913 %{_develdir}/include/media
914 %{_develdir}/include/rxrpc
915 %{_develdir}/include/xen
916 %{_develdir}/init
917 %{_develdir}/ipc
918 %{_develdir}/kernel
919 %{_develdir}/lib
920 %{_develdir}/mm
921 %{_develdir}/net
922 %{_develdir}/samples
923 %{_develdir}/scripts
924 %{_develdir}/security
925 %{_develdir}/sound
926 %{_develdir}/tools
927 %{_develdir}/usr
928 %{_develdir}/virt
929 %doc README.kernel-sources
930 %endif # build_devel
931
932
933 %if %build_doc
934 %files -n %{kname}-doc
935 %doc linux-%{tar_ver}/Documentation/*
936 %endif # build_doc
937
938 %if %build_kernel
939 %files -n %{kname}-latest
940 %endif # build_kernel
941
942 %if %build_source
943 %files -n %{kname}-source-latest
944 %endif # build_source
945
946 %if %build_devel
947 %files -n %{kname}-devel-latest
948 %endif # build_devel

  ViewVC Help
Powered by ViewVC 1.1.30