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

  ViewVC Help
Powered by ViewVC 1.1.30