/[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 1631872 - (show annotations) (download)
Fri Oct 2 16:45:33 2020 UTC (3 years, 5 months ago) by tv
File size: 26547 byte(s)
5.8.12
1 # upstream versioning
2 %define kernelversion 5
3 %define patchlevel 8
4 # sublevel is now used for -stable patches
5 %define sublevel 13
6
7 # kernel Makefile extraversion is substituted by
8 # kpatch wich are either 0 (empty), rc (kpatch)
9 %define kpatch 0
10
11 # this is the releaseversion
12 %define mgarelease 1
13
14 # This is only to make life easier for people that creates derivated kernels
15 # a.k.a name it kernel-tmb :)
16 %define kname kernel-linus
17
18 %define rpmtag %{distsuffix}%{mgaver}
19 %if %kpatch
20 %define rpmrel %mkrel 0.%{kpatch}.%{mgarelease}
21 %else
22 %define rpmrel %mkrel %{mgarelease}
23 %endif
24
25 # theese two never change, they are used to fool rpm/urpmi/smart
26 %define fakever 1
27 %define fakerel %mkrel 1
28
29 # When we are using a pre/rc patch, the tarball is a sublevel -1
30 %if %kpatch
31 %if %sublevel
32 %define tar_ver %{kernelversion}.%{patchlevel}
33 %else
34 %define tar_ver %{kernelversion}.%(expr %{patchlevel} - 1)
35 %endif
36 %else
37 %define tar_ver %{kernelversion}.%{patchlevel}
38 %endif
39 %define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
40 %define kverrel %{kversion}-%{rpmrel}
41
42 # used for not making too long names for rpms or search paths
43 %if %kpatch
44 %define buildrpmrel 0.%{kpatch}.%{mgarelease}%{rpmtag}
45 %else
46 %define buildrpmrel %{mgarelease}%{rpmtag}
47 %endif
48
49 %define buildrel %{kversion}-%{buildrpmrel}
50
51 %define klinus_notice NOTE: This kernel has no Mageia patches and no third-party drivers.
52
53 # having different top level names for packges means that you have to remove them by hard :(
54 %define top_dir_name %{kname}-%{_arch}
55
56 %define build_dir ${RPM_BUILD_DIR}/%{top_dir_name}
57 %define src_dir %{build_dir}/linux-%{tar_ver}
58
59 # disable useless debug rpms...
60 %global debug_package %{nil}
61 %global _enable_debug_packages %{nil}
62 %global __debug_package %{nil}
63 %global __debug_install_post %{nil}
64 %global _build_id_links none
65
66 # no bytecompiling wanted as it breaks build on selftests we dont even ship
67 # for older buildsystems
68 %global _python_bytecompile_build 0
69 # for systems with >= rpm-mageia-setup-2.29-1.mga7
70 %global __brp_python_bytecompile %nil
71
72 # build defines
73 %define build_doc 1
74 %define build_source 1
75 %define build_devel 1
76
77 %define build_kernel 1
78
79 %define distro_branch %(perl -pe '/(\\d+)\\.(\\d)\\.?(\\d)?/; $_="$1.$2"' /etc/mageia-release)
80
81 # End of user definitions
82 %{?_without_kernel: %global build_kernel 0}
83 %{?_without_doc: %global build_doc 0}
84 %{?_without_source: %global build_source 0}
85 %{?_without_devel: %global build_devel 0}
86
87 %{?_with_kernel: %global build_kernel 1}
88 %{?_with_doc: %global build_doc 1}
89 %{?_with_source: %global build_source 1}
90 %{?_with_devel: %global build_devel 1}
91
92 %if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi)
93 %define kmake %make_build CC="$CC"
94 %else
95 %define kmake %make_build
96 %endif
97 # there are places where parallel make doesn't work
98 %define smake make
99
100 # Parallelize xargs invocations on smp machines
101 %define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\
102 && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
103 [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS")
104
105 # Aliases for amd64 builds (better make source links?)
106 %define target_cpu %(echo %{_target_cpu} | sed -e "s/amd64/x86_64/")
107 %define target_arch %(echo %{_arch} | sed -e "s/amd64/x86_64/" -e 's/arm.*/arm/')
108
109 # src.rpm description
110 Summary: The Linux kernel (the core of the Linux operating system)
111 Name: %{kname}
112 Version: %{kversion}
113 Release: %{rpmrel}
114 License: GPLv2
115 Group: System/Kernel and hardware
116 ExclusiveArch: %{ix86} x86_64 %{arm}
117 ExclusiveOS: Linux
118 URL: https://www.kernel.org/
119
120 ####################################################################
121 #
122 # Sources
123 #
124 ### This is for full SRC RPM
125 Source0: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.xz
126 Source1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.sign
127
128 # This is for disabling mrproper and other targets on -devel rpms
129 Source2: disable-mrproper-in-devel-rpms.patch
130
131 Source4: README.kernel-sources
132
133 # Kernel defconfigs
134 Source10: update-defconfigs.sh
135 Source20: i386_defconfig
136 Source21: x86_64_defconfig
137 Source22: arm_defconfig
138 Source23: arm64_defconfig
139
140 ####################################################################
141 #
142 # Patches
143
144 #
145 # Patch0 to Patch100 are for core kernel upgrades.
146 #
147
148 # Pre linus patch: https://cdn.kernel.org/pub/linux/kernel/v(kernelversion).(patchlevel)/testing
149
150 %if %sublevel
151 Patch1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.xz
152 %endif
153 %if %kpatch
154 # (tmb) Created with:
155 # wget https://git.kernel.org/torvalds/p/v5.1-rc6/v5.0 -O patch-5.1-rc6
156 # xz -6e patch-5.1-rc6
157 Patch2: patch-%{kernelversion}.%{patchlevel}-%{kpatch}.xz
158 %endif
159
160 # python3
161 Patch50: linux-5.5-python3.patch
162
163 # revert as it breaks mageia kernel build process, no real functional change
164 Patch55: revert-objtool-silence-build-output.patch
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 # conflict dkms packages that dont support kernel-5.6
218 Conflicts: dkms-broadcom-wl < 20200316-1
219 Conflicts: dkms-nvidia-current < 430.64-8
220 Conflicts: dkms-nvidia390 < 390.132-6
221 Conflicts: dkms-nvidia340 < 340.108-6
222 Conflicts: dkms-nvidia304 < 304.137-3
223 Conflicts: dkms-virtualbox < 6.0.14-2
224 %if %mgaversion >= 8
225 Conflicts: dkms-virtualbox < 6.1.6-1
226 %else
227 Conflicts: dkms-virtualbox < 6.0.20-1
228 %endif
229 Conflicts: dkms-xtables-addons < 3.9-1
230 # (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd
231 Conflicts: btrfs-progs < 5.1.1-1
232 # (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd
233 Conflicts: radeon-firmware < 20200316-1
234 # (tmb) conflict old firmware to get the firmwares in initrd
235 Conflicts: kernel-firmware-nonfree < 20200316-1
236 # (tmb) conflict old microcode to get updated ones in initrd for early loading
237 Conflicts: microcode < 0.20190514-1
238 # (tmb) conflict old theme to get mga5 theme in initrd
239 Conflicts: mageia-gfxboot-theme < 4.5.14.10-1
240 # (tmb) conflict too old grub2(-efi)
241 Conflicts: grub2 < 2.02.0-15
242 Conflicts: grub2-efi < 2.02.0-15
243 # (tmb) conflict too old efibootmgr
244 Conflicts: efibootmgr < 16-3
245 # (tmb) conflict for vmmouse breakage (for mga5, 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 Requires: pkgconfig(libelf)
322 %ifarch %{ix86}
323 Conflicts: arch(x86_64)
324 %endif
325
326 %description -n %{kname}-devel-%{buildrel}
327 This package contains the kernel-devel files that should be enough to build
328 3rdparty drivers against for use with the %{kname}-%{buildrel}.
329
330 If you want to build your own kernel, you need to install the full
331 %{kname}-source-%{buildrel} rpm.
332
333 %{klinus_notice}
334 %endif #build_devel
335
336
337 #
338 # kernel-doc: documentation for the Linux kernel
339 #
340 %if %build_doc
341 %package -n %{kname}-doc
342 Version: %{kversion}
343 Release: %{rpmrel}
344 Summary: Various documentation bits found in the kernel source
345 Group: Documentation
346 Buildarch: noarch
347
348 %description -n %{kname}-doc
349 This package contains documentation files form the kernel source. Various
350 bits of information about the Linux kernel and the device drivers shipped
351 with it are documented in these files. You also might want install this
352 package if you need a reference to the options that can be passed to Linux
353 kernel modules at load time.
354
355 %{klinus_notice}
356 %endif #build_doc
357
358
359 #
360 # kernel-latest: virtual rpm
361 #
362 %if %build_kernel
363 %package -n %{kname}-latest
364 Version: %{kversion}
365 Release: %{rpmrel}
366 Summary: Virtual rpm for latest %{kname}
367 Group: System/Kernel and hardware
368 Requires: %{kname}-%{buildrel}
369 %ifarch %{ix86}
370 Conflicts: arch(x86_64)
371 %endif
372
373 %description -n %{kname}-latest
374 This package is a virtual rpm that aims to make sure you always have the
375 latest %{kname} installed...
376
377 %{klinus_notice}
378 %endif #build_kernel
379
380
381 #
382 # kernel-source-latest: virtual rpm
383 #
384 %if %build_source
385 %package -n %{kname}-source-latest
386 Version: %{kversion}
387 Release: %{rpmrel}
388 Summary: Virtual rpm for latest %{kname}-source
389 Group: System/Kernel and hardware
390 Requires: %{kname}-source-%{buildrel}
391 Buildarch: noarch
392
393 %description -n %{kname}-source-latest
394 This package is a virtual rpm that aims to make sure you always have the
395 latest %{kname}-source installed...
396
397 %{klinus_notice}
398 %endif #build_source
399
400
401 #
402 # kernel-devel-latest: virtual rpm
403 #
404 %if %build_devel
405 %package -n %{kname}-devel-latest
406 Version: %{kversion}
407 Release: %{rpmrel}
408 Summary: Virtual rpm for latest %{kname}-devel
409 Group: System/Kernel and hardware
410 Requires: %{kname}-devel-%{buildrel}
411 %ifarch %{ix86}
412 Conflicts: arch(x86_64)
413 %endif
414
415 %description -n %{kname}-devel-latest
416 This package is a virtual rpm that aims to make sure you always have the
417 latest %{kname}-devel installed...
418
419 %{klinus_notice}
420 %endif #build_devel
421
422
423 #
424 # End packages - here begins build stage
425 #
426 %prep
427 %setup -q -n %top_dir_name -c
428
429 pushd %src_dir
430
431 %if %sublevel
432 %patch1 -p1
433 %endif
434 %if %kpatch
435 %patch2 -p1
436 %endif
437
438 # python 3
439 %patch50 -p1
440 # revert build breakage
441 %patch55 -p1
442
443 # critical fixes
444
445 popd
446
447 # PATCH END
448
449
450 #
451 # Setup Begin
452 #
453
454 # Install defconfigs...
455 install %{SOURCE20} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/
456 install %{SOURCE21} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/
457 install %{SOURCE22} %{build_dir}/linux-%{tar_ver}/arch/arm/configs/
458 install %{SOURCE23} %{build_dir}/linux-%{tar_ver}/arch/arm64/configs/
459
460 # make sure the kernel has the sublevel we know it has...
461 LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" linux-%{tar_ver}/Makefile
462
463
464 %build
465 # Common target directories
466 %define _bootdir /boot
467 %define _modulesdir /lib/modules
468 %define _kerneldir /usr/src/%{kname}-%{buildrel}
469 %define _develdir /usr/src/%{kname}-devel-%{buildrel}
470
471
472 # Directories definition needed for building
473 %define temp_root %{build_dir}/temp-root
474 %define temp_boot %{temp_root}%{_bootdir}
475 %define temp_modules %{temp_root}%{_modulesdir}
476 %define temp_source %{temp_root}%{_kerneldir}
477 %define temp_devel %{temp_root}%{_develdir}
478
479
480 # Create a simulacro of buildroot
481 rm -rf %{temp_root}
482 install -d %{temp_root}
483
484
485 # make sure we are in the directory
486 cd %{src_dir}
487
488 # fix missing exec flag on file introduced in 4.14.10-rc1
489 chmod 755 tools/objtool/sync-check.sh
490
491 # make sure EXTRAVERSION says what we want it to say
492 LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildrpmrel}/" Makefile
493
494 # Prepare the kernel
495 %smake -s mrproper
496 %ifarch %{ix86} x86_64
497 cp arch/x86/configs/%{target_arch}_defconfig .config
498 %else
499 cp arch/%{target_arch}/configs/%{target_arch}_defconfig .config
500 %endif
501 %smake ARCH=%{_arch} oldconfig
502
503 # Build the kernel
504 %kmake ARCH=%{_arch} -s all
505 # Install kernel
506 install -d %{temp_boot}
507 install -m 644 System.map %{temp_boot}/System.map-%{buildrel}
508 install -m 644 .config %{temp_boot}/config-%{buildrel}
509 %ifarch %{arm}
510 cp -f arch/arm/boot/zImage %{temp_boot}/vmlinuz-%{buildrel}
511 install -d %{temp_root}/usr/lib/linux-%{buildrel}/
512 for d in arch/arm/boot/dts/*.dtb; do \
513 install -D -m644 $d %{temp_root}/usr/lib/linux-%{buildrel}/$(basename $d); \
514 done
515 %else
516 cp -f arch/%{target_arch}/boot/bzImage %{temp_boot}/vmlinuz-%{buildrel}
517 %endif
518
519 # Install modules
520 install -d %{temp_modules}/%{buildrel}
521 %smake ARCH=%{_arch} INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{buildrel} modules_install
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 # needed for selinux
532 cp -R --parents security/selinux/include/*.h %{temp_devel}
533 %ifarch %{arm}
534 cp -fR arch/%{target_arch}/tools %{temp_devel}/arch/%{target_arch}/
535 cp -fR arch/%{target_arch}/kernel/signal.h %{temp_devel}/arch/%{target_arch}/kernel/
536 %endif
537 %ifarch %{ix86} x86_64
538 cp -fR arch/x86/boot/{ctype.h,string.{c,h}} %{temp_devel}/arch/x86/boot/
539 cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel}/arch/x86/kernel/
540 cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel}/arch/x86/kernel/
541 cp -fR arch/x86/purgatory/* %{temp_devel}/arch/x86/purgatory/
542 cp -fR arch/x86/entry/syscalls/syscall* %{temp_devel}/arch/x86/entry/syscalls/
543 cp -fR arch/x86/include %{temp_devel}/arch/x86/
544 cp -fR arch/x86/tools %{temp_devel}/arch/x86/
545 %else
546 cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} %{temp_devel}/arch/%{target_arch}/kernel/
547 for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f %{temp_devel}; done
548 %endif
549 %ifarch x86_64
550 # orc unwinder needs theese
551 cp -fR tools/build/Build{,.include} %{temp_devel}/tools/build
552 cp -fR tools/build/fixdep.c %{temp_devel}/tools/build
553 cp -fR tools/lib/{rbtree.c,ctype.c,str_error_r.c,string.c} %{temp_devel}/tools/lib
554 cp -fR tools/lib/subcmd/* %{temp_devel}/tools/lib/subcmd
555 cp -fR tools/objtool/* %{temp_devel}/tools/objtool
556 cp -fR tools/scripts/utilities.mak %{temp_devel}/tools/scripts
557 mkdir -p %{temp_devel}/tools/arch/x86/tools
558 cp -fR tools/arch/x86/tools/gen-insn-attr-x86.awk %{temp_devel}/tools/arch/x86/tools/
559 mkdir -p %{temp_devel}/tools/arch/x86/lib
560 cp -fR tools/arch/x86/lib/{inat.c,insn.c,x86-opcode-map.txt} %{temp_devel}/tools/arch/x86/lib/
561 mkdir -p %{temp_devel}/tools/arch/x86/include/asm
562 cp -fR tools/arch/x86/include/asm/{emulate_prefix.h,inat.h,inat_types.h,insn.h,orc_types.h} %{temp_devel}/tools/arch/x86/include/asm/
563 %endif
564
565 # Needed for generation of kernel/bounds.s
566 cp -fR kernel/bounds.c %{temp_devel}/kernel/
567
568 # needed by include/generated/timeconst.h
569 cp -fR kernel/time/timeconst.bc %{temp_devel}/kernel/time/
570
571 # ship config and symvers
572 cp -fR .config Module.symvers %{temp_devel}
573
574 # Needed for truecrypt build (Danny)
575 cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/
576
577 # Check and clean the -devel tree
578 pushd %{temp_devel} >/dev/null
579 %smake ARCH=%{_arch} -s prepare scripts clean
580 rm -f .config.old
581 popd >/dev/null
582
583 # Disable mrproper and other targets
584 patch -p1 -d %{temp_devel} -i %{SOURCE2}
585
586 # Fix permissions
587 chmod -R a+rX %{temp_devel}
588 %endif # build_devel
589
590 #make sure we are in the directory
591 cd %src_dir
592
593 # kernel-source is shipped as an unprepared tree
594 %smake ARCH=%{_arch} -s mrproper
595
596
597 ###
598 ### Install
599 ###
600 %install
601 install -m 644 %{SOURCE4} .
602
603 cd %src_dir
604 # Directories definition needed for installing
605 %define target_source %{buildroot}/%{_kerneldir}
606 %define target_boot %{buildroot}%{_bootdir}
607 %define target_modules %{buildroot}%{_modulesdir}
608 %define target_devel %{buildroot}%{_develdir}
609
610 # We want to be able to test several times the install part
611 rm -rf %{buildroot}
612 cp -a %{temp_root} %{buildroot}
613
614 # Create directories infastructure
615 %if %build_source
616 install -d %{target_source}
617
618 tar cf - . | tar xf - -C %{target_source}
619 chmod -R a+rX %{target_source}
620
621 # we remove all the source files that we don't ship
622
623 # first architecture files
624 for i in alpha arc avr32 blackfin c6x cris csky frv hexagon h8300 ia64 m32r mips \
625 microblaze m68k m68knommu metag mn10300 nds32 nios2 openrisc parisc powerpc ppc \
626 riscv s390 score sh sh64 sparc tile unicore32 v850 xtensa; do
627 rm -rf %{target_source}/arch/$i
628
629 %if %build_devel
630 rm -rf %{target_devel}/arch/$i
631 %endif
632 done
633 %ifnarch %{arm}
634 rm -rf %{target_source}/arch/arm*
635 rm -rf %{target_source}/include/kvm/arm*
636 rm -rf %{target_source}/include/soc
637 rm -rf %{target_source}/tools/arch/arm*
638 %endif
639
640 # remove arch files based on target arch in -devel rpms
641 %if %build_devel
642 %ifnarch %{ix86} x86_64
643 rm -rf %{target_devel}/arch/x86
644 %endif
645 %ifnarch %{arm}
646 rm -rf %{target_devel}/arch/arm
647 rm -rf %{target_devel}/arch/arm64
648 rm -rf %{target_devel}/include/kvm/arm*
649 rm -rf %{target_devel}/include/soc
650 %endif
651 %endif
652
653
654 # other misc files
655 rm -f %{target_source}/{.clang-format,.config.old,.config.cmd,.tmp_gas_check,.mailmap,.missing-syscalls.d,arch/.gitignore,.gitattributes,.get_maintainer.ignore,.cocciconfig}
656 rm -rf %{target_source}/.tmp_depmod/
657
658 # clean tools tree
659 pushd %{target_source}
660 %smake -C tools clean
661 %smake -C tools/build clean
662 %smake -C tools/build/feature clean
663 popd
664
665 # nuke last as it gets re-created
666 rm -f %{target_source}/.cache.mk
667
668 #endif %build_source
669 %endif
670
671
672 # compressing modules
673 find %{target_modules} -name "*.ko" | %kxargs xz -6
674
675
676 # We used to have a copy of PrepareKernel here
677 # Now, we make sure that the thing in the linux dir is what we want it to be
678
679 for i in %{target_modules}/*; do
680 rm -f $i/build $i/source
681 done
682
683
684 # sniff, if we gzipped all the modules, we change the stamp :(
685 # we really need the depmod -ae here
686 pushd %{target_modules}
687 for i in *; do
688 /sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i
689 echo $?
690 done
691
692 for i in *; do
693 pushd $i
694 echo "Creating module.description for $i"
695 modules=`find . -name "*.ko.xz"`
696 echo $modules | xargs /sbin/modinfo \
697 | perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description
698 popd
699 done
700 popd
701
702
703 ###
704 ### Clean
705 ###
706
707 %clean
708 rm -rf %{buildroot}
709 # We don't want to remove this, the whole reason of its existence is to be
710 # able to do several rpm --short-circuit -bi for testing install
711 # phase without repeating compilation phase
712 #rm -rf %{temp_root}
713
714
715 ###
716 ### Scripts
717 ###
718
719 ### kernel
720 %if %build_kernel
721
722 %post -n %{kname}-%{buildrel}
723 /sbin/installkernel -L %{buildrel}
724 if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then
725 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
726 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
727 fi
728 pushd /boot > /dev/null
729 ln -sf vmlinuz-%{buildrel} vmlinuz-linus
730 ln -sf initrd-%{buildrel}.img initrd-linus.img
731 popd > /dev/null
732
733 %posttrans -n %{kname}-%{buildrel}
734 if [ -x /usr/sbin/dkms_autoinstaller -a -d /usr/src/%{kname}-devel-%{buildrel} ]; then
735 /usr/sbin/dkms_autoinstaller start %{buildrel}
736 fi
737
738 %postun -n %{kname}-%{buildrel}
739 pushd /boot > /dev/null
740 if [ -L vmlinuz-linus ]; then
741 if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then
742 rm -f vmlinuz-linus
743 fi
744 fi
745 if [ -L initrd-linus.img ]; then
746 if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then
747 rm -f initrd-linus.img
748 fi
749 fi
750 popd > /dev/null
751 /sbin/kernel_remove_initrd %{buildrel}
752 /sbin/installkernel -R %{buildrel}
753 rm -rf /lib/modules/%{buildrel} > /dev/null
754 if [ -d /var/lib/dkms ]; then
755 rm -f /var/lib/dkms/*/kernel-%{buildrel}-%{_target_cpu} >/dev/null
756 rm -rf /var/lib/dkms/*/*/%{buildrel} >/dev/null
757 fi
758 %endif # build_kernel
759
760
761 ### kernel-devel
762 %if %build_devel
763 %post -n %{kname}-devel-%{buildrel}
764 # place /build and /source symlinks in place.
765 if [ -d /lib/modules/%{buildrel} ]; then
766 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build
767 ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source
768 fi
769
770 %preun -n %{kname}-devel-%{buildrel}
771 # we need to delete <modules>/{build,source} at uninstall
772 if [ -L /lib/modules/%{buildrel}/build ]; then
773 rm -f /lib/modules/%{buildrel}/build
774 fi
775 if [ -L /lib/modules/%{buildrel}/source ]; then
776 rm -f /lib/modules/%{buildrel}/source
777 fi
778 exit 0
779 %endif #build_devel
780
781
782 ###
783 ### file lists
784 ###
785
786 # kernel
787 %if %build_kernel
788 %files -n %{kname}-%{buildrel}
789 %{_bootdir}/config-%{buildrel}
790 %{_bootdir}/vmlinuz-%{buildrel}
791 %{_bootdir}/System.map-%{buildrel}
792 %dir %{_modulesdir}/%{buildrel}/
793 %{_modulesdir}/%{buildrel}/kernel
794 %{_modulesdir}/%{buildrel}/modules.*
795 %doc README.kernel-sources
796 %ifarch %arm
797 %dir /usr/lib/linux-%{buildrel}
798 /usr/lib/linux-%{buildrel}/*.dtb
799 %endif
800 %endif # build_kernel
801
802 # kernel-source
803 %if %build_source
804 %files -n %{kname}-source-%{buildrel}
805 %doc %{_kerneldir}/LICENSES
806 %dir %{_kerneldir}
807 %dir %{_kerneldir}/arch
808 %dir %{_kerneldir}/include
809 %{_kerneldir}/.gitignore
810 %{_kerneldir}/COPYING
811 %{_kerneldir}/CREDITS
812 %{_kerneldir}/Documentation
813 %{_kerneldir}/Kbuild
814 %{_kerneldir}/Kconfig
815 %{_kerneldir}/MAINTAINERS
816 %{_kerneldir}/Makefile
817 %{_kerneldir}/README
818 %{_kerneldir}/arch/Kconfig
819 %ifarch %arm
820 %{_kerneldir}/arch/arm
821 %{_kerneldir}/arch/arm64
822 %endif
823 %{_kerneldir}/arch/x86
824 %{_kerneldir}/arch/um
825 %{_kerneldir}/block
826 %{_kerneldir}/certs
827 %{_kerneldir}/crypto
828 %{_kerneldir}/drivers
829 %{_kerneldir}/fs
830 %{_kerneldir}/include/acpi
831 %{_kerneldir}/include/asm-generic
832 %{_kerneldir}/include/clocksource
833 %{_kerneldir}/include/crypto
834 %{_kerneldir}/include/drm
835 %{_kerneldir}/include/dt-bindings
836 %{_kerneldir}/include/kunit
837 %{_kerneldir}/include/kvm
838 %{_kerneldir}/include/linux
839 %{_kerneldir}/include/math-emu
840 %{_kerneldir}/include/net
841 %{_kerneldir}/include/pcmcia
842 %{_kerneldir}/include/ras
843 %{_kerneldir}/include/scsi
844 %ifarch %arm
845 %{_kerneldir}/include/soc
846 %endif
847 %{_kerneldir}/include/sound
848 %{_kerneldir}/include/target
849 %{_kerneldir}/include/trace
850 %{_kerneldir}/include/uapi
851 %{_kerneldir}/include/vdso/*.h
852 %{_kerneldir}/include/video
853 %{_kerneldir}/include/media
854 %{_kerneldir}/include/misc
855 %{_kerneldir}/include/keys
856 %{_kerneldir}/include/rdma
857 %{_kerneldir}/include/xen
858 %{_kerneldir}/init
859 %{_kerneldir}/ipc
860 %{_kerneldir}/kernel
861 %{_kerneldir}/lib
862 %{_kerneldir}/mm
863 %{_kerneldir}/net
864 %{_kerneldir}/samples
865 %{_kerneldir}/scripts
866 %{_kerneldir}/security
867 %{_kerneldir}/sound
868 %{_kerneldir}/tools
869 %{_kerneldir}/usr
870 %{_kerneldir}/virt
871 %doc README.kernel-sources
872 %endif # build_source
873
874 # kernel-devel
875 %if %build_devel
876 %files -n %{kname}-devel-%{buildrel}
877 %dir %{_develdir}
878 %dir %{_develdir}/arch
879 %dir %{_develdir}/include
880 %{_develdir}/.config
881 %{_develdir}/Documentation
882 %{_develdir}/Kbuild
883 %{_develdir}/Kconfig
884 %{_develdir}/Makefile
885 %{_develdir}/Module.symvers
886 %{_develdir}/arch/Kconfig
887 %ifarch %{arm}
888 %{_develdir}/arch/arm
889 %{_develdir}/arch/arm64
890 %endif
891 %ifarch %{ix86} x86_64
892 %{_develdir}/arch/x86
893 %endif
894 %{_develdir}/arch/um
895 %{_develdir}/block
896 %{_develdir}/certs
897 %{_develdir}/crypto
898 %{_develdir}/drivers
899 %{_develdir}/fs
900 %{_develdir}/include/acpi
901 %{_develdir}/include/asm-generic
902 %{_develdir}/include/clocksource
903 %{_develdir}/include/config
904 %{_develdir}/include/crypto
905 %{_develdir}/include/drm
906 %{_develdir}/include/dt-bindings
907 %{_develdir}/include/generated
908 %{_develdir}/include/keys
909 %{_develdir}/include/kunit
910 %{_develdir}/include/kvm
911 %{_develdir}/include/linux
912 %{_develdir}/include/math-emu
913 %{_develdir}/include/misc
914 %{_develdir}/include/net
915 %{_develdir}/include/pcmcia
916 %{_develdir}/include/ras
917 %{_develdir}/include/rdma
918 %{_develdir}/include/scsi
919 %ifarch %arm
920 %{_develdir}/include/soc
921 %endif
922 %{_develdir}/include/sound
923 %{_develdir}/include/target
924 %{_develdir}/include/trace
925 %{_develdir}/include/uapi
926 %{_develdir}/include/vdso/*.h
927 %{_develdir}/include/video
928 %{_develdir}/include/media
929 %{_develdir}/include/xen
930 %{_develdir}/init
931 %{_develdir}/ipc
932 %{_develdir}/kernel
933 %{_develdir}/lib
934 %{_develdir}/mm
935 %{_develdir}/net
936 %{_develdir}/samples
937 %{_develdir}/scripts
938 %{_develdir}/security
939 %{_develdir}/sound
940 %{_develdir}/tools
941 %{_develdir}/usr
942 %{_develdir}/virt
943 %doc README.kernel-sources
944 %endif # build_devel
945
946
947 %if %build_doc
948 %files -n %{kname}-doc
949 %doc linux-%{tar_ver}/Documentation/*
950 %endif # build_doc
951
952 %if %build_kernel
953 %files -n %{kname}-latest
954 %endif # build_kernel
955
956 %if %build_source
957 %files -n %{kname}-source-latest
958 %endif # build_source
959
960 %if %build_devel
961 %files -n %{kname}-devel-latest
962 %endif # build_devel

  ViewVC Help
Powered by ViewVC 1.1.30