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

  ViewVC Help
Powered by ViewVC 1.1.30