/[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 1359655 - (show annotations) (download)
Tue Jan 22 22:57:16 2019 UTC (5 years, 3 months ago) by tmb
File size: 25943 byte(s)
update to 4.20.4
1 # upstream versioning
2 %define kernelversion 4
3 %define patchlevel 20
4 # sublevel is now used for -stable patches
5 %define sublevel 4
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 %ifarch %{arm}
525 cp -fR arch/%{target_arch}/tools %{temp_devel}/arch/%{target_arch}/
526 cp -fR arch/%{target_arch}/kernel/signal.h %{temp_devel}/arch/%{target_arch}/kernel/
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 %ifarch x86_64
541 # orc unwinder needs theese
542 cp -fR tools/build/Build{,.include} %{temp_devel}/tools/build
543 cp -fR tools/build/fixdep.c %{temp_devel}/tools/build
544 cp -fR tools/lib/{str_error_r.c,string.c} %{temp_devel}/tools/lib
545 cp -fR tools/lib/subcmd/* %{temp_devel}/tools/lib/subcmd
546 cp -fR tools/objtool/* %{temp_devel}/tools/objtool
547 cp -fR tools/scripts/utilities.mak %{temp_devel}/tools/scripts
548 %endif
549
550 # Needed for generation of kernel/bounds.s
551 cp -fR kernel/bounds.c %{temp_devel}/kernel/
552
553 # needed by include/generated/timeconst.h
554 cp -fR kernel/time/timeconst.bc %{temp_devel}/kernel/time/
555
556 # ship config and symvers
557 cp -fR .config Module.symvers %{temp_devel}
558
559 # Needed for truecrypt build (Danny)
560 cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/
561
562 # Check and clean the -devel tree
563 pushd %{temp_devel} >/dev/null
564 %smake ARCH=%{_arch} -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 ARCH=%{_arch} -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 csky frv hexagon h8300 ia64 m32r mips \
610 microblaze m68k m68knommu metag mn10300 nds32 nios2 openrisc parisc powerpc ppc \
611 riscv 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}/{.clang-format,.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 # clean tools tree
644 pushd %{target_source}
645 %smake -C tools clean
646 %smake -C tools/build clean
647 %smake -C tools/build/feature clean
648 popd
649
650 # nuke last as it gets re-created
651 rm -f %{target_source}/.cache.mk
652
653 #endif %build_source
654 %endif
655
656
657 # compressing modules
658 find %{target_modules} -name "*.ko" | %kxargs xz -6e
659
660
661 # We used to have a copy of PrepareKernel here
662 # Now, we make sure that the thing in the linux dir is what we want it to be
663
664 for i in %{target_modules}/*; do
665 rm -f $i/build $i/source
666 done
667
668
669 # sniff, if we gzipped all the modules, we change the stamp :(
670 # we really need the depmod -ae here
671 pushd %{target_modules}
672 for i in *; do
673 /sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i
674 echo $?
675 done
676
677 for i in *; do
678 pushd $i
679 echo "Creating module.description for $i"
680 modules=`find . -name "*.ko.xz"`
681 echo $modules | %kxargs /sbin/modinfo \
682 | perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description
683 popd
684 done
685 popd
686
687
688 ###
689 ### Clean
690 ###
691
692 %clean
693 rm -rf %{buildroot}
694 # We don't want to remove this, the whole reason of its existence is to be
695 # able to do several rpm --short-circuit -bi for testing install
696 # phase without repeating compilation phase
697 #rm -rf %{temp_root}
698
699
700 ###
701 ### Scripts
702 ###
703
704 ### kernel
705 %if %build_kernel
706 %preun -n %{kname}-%{buildrel}
707 /sbin/installkernel -R %{buildrel}
708 if [ -L /lib/modules/%{buildrel}/build ]; then
709 rm -f /lib/modules/%{buildrel}/build
710 fi
711 if [ -L /lib/modules/%{buildrel}/source ]; then
712 rm -f /lib/modules/%{buildrel}/source
713 fi
714 pushd /boot > /dev/null
715 if [ -L vmlinuz-linus ]; then
716 if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then
717 rm -f vmlinuz-linus
718 fi
719 fi
720 if [ -L initrd-linus.img ]; then
721 if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then
722 rm -f initrd-linus.img
723 fi
724 fi
725 popd > /dev/null
726 exit 0
727
728 %post -n %{kname}-%{buildrel}
729 /sbin/installkernel -L %{buildrel}
730 if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then
731 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
732 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
733 fi
734 pushd /boot > /dev/null
735 if [ -L vmlinuz-linus ]; then
736 rm -f vmlinuz-linus
737 fi
738 ln -sf vmlinuz-%{buildrel} vmlinuz-linus
739 if [ -L initrd-linus.img ]; then
740 rm -f initrd-linus.img
741 fi
742 ln -sf initrd-%{buildrel}.img initrd-linus.img
743 popd > /dev/null
744
745 %posttrans -n %{kname}-%{buildrel}
746 if [ -x /usr/sbin/dkms_autoinstaller -a -d /usr/src/%{kname}-devel-%{buildrel} ]; then
747 /usr/sbin/dkms_autoinstaller start %{buildrel}
748 fi
749
750 %postun -n %{kname}-%{buildrel}
751 /sbin/kernel_remove_initrd %{buildrel}
752 rm -rf /lib/modules/%{buildrel} > /dev/null
753 %endif # build_kernel
754
755
756 ### kernel-devel
757 %if %build_devel
758 %post -n %{kname}-devel-%{buildrel}
759 # place /build and /source symlinks in place.
760 if [ -d /lib/modules/%{buildrel} ]; then
761 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
762 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
763 fi
764
765 %preun -n %{kname}-devel-%{buildrel}
766 # we need to delete <modules>/{build,source} at uninstall
767 if [ -L /lib/modules/%{buildrel}/build ]; then
768 rm -f /lib/modules/%{buildrel}/build
769 fi
770 if [ -L /lib/modules/%{buildrel}/source ]; then
771 rm -f /lib/modules/%{buildrel}/source
772 fi
773 exit 0
774 %endif #build_devel
775
776
777 ###
778 ### file lists
779 ###
780
781 # kernel
782 %if %build_kernel
783 %files -n %{kname}-%{buildrel}
784 %{_bootdir}/config-%{buildrel}
785 %{_bootdir}/vmlinuz-%{buildrel}
786 %{_bootdir}/System.map-%{buildrel}
787 %dir %{_modulesdir}/%{buildrel}/
788 %{_modulesdir}/%{buildrel}/kernel
789 %{_modulesdir}/%{buildrel}/modules.*
790 %doc README.kernel-sources
791 %ifarch %arm
792 %dir /usr/lib/linux-%{buildrel}
793 /usr/lib/linux-%{buildrel}/*.dtb
794 %endif
795 %endif # build_kernel
796
797 # kernel-source
798 %if %build_source
799 %files -n %{kname}-source-%{buildrel}
800 %doc %{_kerneldir}/LICENSES
801 %dir %{_kerneldir}
802 %dir %{_kerneldir}/arch
803 %dir %{_kerneldir}/include
804 %{_kerneldir}/.gitignore
805 %{_kerneldir}/COPYING
806 %{_kerneldir}/CREDITS
807 %{_kerneldir}/Documentation
808 %{_kerneldir}/Kbuild
809 %{_kerneldir}/Kconfig
810 %{_kerneldir}/MAINTAINERS
811 %{_kerneldir}/Makefile
812 %{_kerneldir}/README
813 %{_kerneldir}/arch/Kconfig
814 %ifarch %arm
815 %{_kerneldir}/arch/arm
816 %{_kerneldir}/arch/arm64
817 %endif
818 %{_kerneldir}/arch/x86
819 %{_kerneldir}/arch/um
820 %{_kerneldir}/block
821 %{_kerneldir}/certs
822 %{_kerneldir}/crypto
823 %{_kerneldir}/drivers
824 %{_kerneldir}/firmware
825 %{_kerneldir}/fs
826 %{_kerneldir}/include/acpi
827 %{_kerneldir}/include/asm-generic
828 %{_kerneldir}/include/clocksource
829 %{_kerneldir}/include/crypto
830 %{_kerneldir}/include/drm
831 %{_kerneldir}/include/dt-bindings
832 %{_kerneldir}/include/kvm
833 %{_kerneldir}/include/linux
834 %{_kerneldir}/include/math-emu
835 %{_kerneldir}/include/memory
836 %{_kerneldir}/include/net
837 %{_kerneldir}/include/pcmcia
838 %{_kerneldir}/include/ras
839 %{_kerneldir}/include/scsi
840 %ifarch %arm
841 %{_kerneldir}/include/soc
842 %endif
843 %{_kerneldir}/include/sound
844 %{_kerneldir}/include/target
845 %{_kerneldir}/include/trace
846 %{_kerneldir}/include/uapi
847 %{_kerneldir}/include/video
848 %{_kerneldir}/include/media
849 %{_kerneldir}/include/misc
850 %{_kerneldir}/include/keys
851 %{_kerneldir}/include/rdma
852 %{_kerneldir}/include/xen
853 %{_kerneldir}/init
854 %{_kerneldir}/ipc
855 %{_kerneldir}/kernel
856 %{_kerneldir}/lib
857 %{_kerneldir}/mm
858 %{_kerneldir}/net
859 %{_kerneldir}/samples
860 %{_kerneldir}/scripts
861 %{_kerneldir}/security
862 %{_kerneldir}/sound
863 %{_kerneldir}/tools
864 %{_kerneldir}/usr
865 %{_kerneldir}/virt
866 %doc README.kernel-sources
867 %endif # build_source
868
869 # kernel-devel
870 %if %build_devel
871 %files -n %{kname}-devel-%{buildrel}
872 %dir %{_develdir}
873 %dir %{_develdir}/arch
874 %dir %{_develdir}/include
875 %{_develdir}/.config
876 %{_develdir}/Documentation
877 %{_develdir}/Kbuild
878 %{_develdir}/Kconfig
879 %{_develdir}/Makefile
880 %{_develdir}/Module.symvers
881 %{_develdir}/arch/Kconfig
882 %ifarch %{arm}
883 %{_develdir}/arch/arm
884 %{_develdir}/arch/arm64
885 %endif
886 %ifarch %{ix86} x86_64
887 %{_develdir}/arch/x86
888 %endif
889 %{_develdir}/arch/um
890 %{_develdir}/block
891 %{_develdir}/certs
892 %{_develdir}/crypto
893 %{_develdir}/drivers
894 %{_develdir}/firmware
895 %{_develdir}/fs
896 %{_develdir}/include/acpi
897 %{_develdir}/include/asm-generic
898 %{_develdir}/include/clocksource
899 %{_develdir}/include/config
900 %{_develdir}/include/crypto
901 %{_develdir}/include/drm
902 %{_develdir}/include/dt-bindings
903 %{_develdir}/include/generated
904 %{_develdir}/include/keys
905 %{_develdir}/include/kvm
906 %{_develdir}/include/linux
907 %{_develdir}/include/math-emu
908 %{_develdir}/include/memory
909 %{_develdir}/include/misc
910 %{_develdir}/include/net
911 %{_develdir}/include/pcmcia
912 %{_develdir}/include/ras
913 %{_develdir}/include/rdma
914 %{_develdir}/include/scsi
915 %ifarch %arm
916 %{_develdir}/include/soc
917 %endif
918 %{_develdir}/include/sound
919 %{_develdir}/include/target
920 %{_develdir}/include/trace
921 %{_develdir}/include/uapi
922 %{_develdir}/include/video
923 %{_develdir}/include/media
924 %{_develdir}/include/xen
925 %{_develdir}/init
926 %{_develdir}/ipc
927 %{_develdir}/kernel
928 %{_develdir}/lib
929 %{_develdir}/mm
930 %{_develdir}/net
931 %{_develdir}/samples
932 %{_develdir}/scripts
933 %{_develdir}/security
934 %{_develdir}/sound
935 %{_develdir}/tools
936 %{_develdir}/usr
937 %{_develdir}/virt
938 %doc README.kernel-sources
939 %endif # build_devel
940
941
942 %if %build_doc
943 %files -n %{kname}-doc
944 %doc linux-%{tar_ver}/Documentation/*
945 %endif # build_doc
946
947 %if %build_kernel
948 %files -n %{kname}-latest
949 %endif # build_kernel
950
951 %if %build_source
952 %files -n %{kname}-source-latest
953 %endif # build_source
954
955 %if %build_devel
956 %files -n %{kname}-devel-latest
957 %endif # build_devel

  ViewVC Help
Powered by ViewVC 1.1.30