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

Contents of /cauldron/kernel-linus/current/SPECS/kernel-linus.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1153797 - (show annotations) (download)
Thu Sep 14 14:22:30 2017 UTC (6 years, 7 months ago) by tmb
File size: 25850 byte(s)
- enable CC_STACKPROTECTOR_STRONG
- enable FANOTIFY_ACCESS_PERMISSIONS (mga#21498)
- update to 4.12.13


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