/[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 1357827 - (show annotations) (download)
Thu Jan 17 22:28:13 2019 UTC (5 years, 3 months ago) by tmb
File size: 26367 byte(s)
drop obsolete extstable support
1 # upstream versioning
2 %define kernelversion 4
3 %define patchlevel 20
4 # sublevel is now used for -stable patches
5 %define sublevel 3
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: http://www.kernel.org/
130
131 ####################################################################
132 #
133 # Sources
134 #
135 ### This is for full SRC RPM
136 Source0: https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-%{tar_ver}.tar.xz
137 Source1: https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-%{tar_ver}.tar.sign
138
139 # This is for disabling mrproper and other targets on -devel rpms
140 Source2: disable-mrproper-in-devel-rpms.patch
141
142 Source4: README.kernel-sources
143
144 # Kernel defconfigs
145 Source20: i386_defconfig
146 Source21: x86_64_defconfig
147 Source22: arm_defconfig
148
149 ####################################################################
150 #
151 # Patches
152
153 #
154 # Patch0 to Patch100 are for core kernel upgrades.
155 #
156
157 # Pre linus patch: https://cdn.kernel.org/pub/linux/kernel/v(kernelversion).(patchlevel)/testing
158
159 %if %sublevel
160 Patch1: https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.xz
161 #Source11: https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.sign
162 %endif
163 %if %kpatch
164 Patch2: https://cdn.kernel.org/pub/linux/kernel/v4.x/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.xz
165 #Source12: https://cdn.kernel.org/pub/linux/kernel/v4.x/testing/patch-%{kernelversion}.%{patchlevel}-%{kpatch}.sign
166 %endif
167
168 # critical fixes
169
170 #END
171 ####################################################################
172
173 # global defines
174 Autoreqprov: no
175 BuildRequires: gcc
176 BuildRequires: kmod >= 12-2
177 BuildRequires: bc
178 BuildRequires: binutils >= 1:2.25.1
179 # for orc unwinder
180 BuildRequires: elfutils-devel
181 # for crypto stuff
182 BuildRequires: pkgconfig(openssl)
183 # since 4.16
184 BuildRequires: bison
185 BuildRequires: flex
186
187 %description
188 Source package to build the Linux kernel.
189
190 %{klinus_notice}
191
192
193 #
194 # kernel: Symmetric MultiProcessing kernel
195 #
196 %if %build_kernel
197 %package -n %{kname}-%{buildrel}
198 Version: %{fakever}
199 Release: %{fakerel}
200 %ifarch %{ix86}
201 Summary: Linux Kernel for desktop use with i586 & 4GB RAM
202 %else
203 %ifarch %{arm}
204 Summary: Linux Kernel for Arm machines based on Kirkwood
205 %else
206 Summary: Linux Kernel for desktop use with %{_arch}
207 %endif
208 %endif
209 Group: System/Kernel and hardware
210 Provides: should-restart = system
211 Provides: installonlypkg(kernel)
212 Provides: kernel = %{tar_ver}
213 Provides: alsa
214 Requires: bootloader-utils >= 1.16-1
215 Requires: dracut >= 046-2
216 Requires: kmod >= 12-2
217 Requires: sysfsutils >= 2.1.0-16
218 Requires: kernel-firmware >= 20170101-1
219
220 # conflict dkms packages that dont support kernel-4.14
221 Conflicts: dkms-broadcom-wl < 6.30.223.271-47
222 Conflicts: dkms-fglrx <= 15.302
223 Conflicts: dkms-nvidia-current < 384.98-2
224 Conflicts: dkms-nvidia340 < 340.104-3
225 Conflicts: dkms-nvidia304 < 304.137-2
226 Conflicts: dkms-virtualbox < 5.2.2-1
227 Conflicts: dkms-xtables-addons < 2.13-3
228 # (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd
229 Conflicts: btrfs-progs < 4.14-2
230 # (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd
231 Conflicts: radeon-firmware < 20171123-1
232 # (tmb) conflict old firmware to get the firmwares in initrd
233 Conflicts: kernel-firmware-nonfree < 20171123-1
234 # (tmb) conflict old microcode to get updated ones in initrd for early loading
235 Conflicts: microcode < 0.20180807-1
236 # (tmb) conflict old theme to get mga5 theme in initrd
237 Conflicts: mageia-gfxboot-theme < 4.5.6.6-1
238 # (tmb) conflict too old grub2(-efi)
239 Conflicts: grub2 < 2.02-0.git9752.18
240 Conflicts: grub2-efi < 2.02-0.git9752.18
241 # (tmb) conflict too old efibootmgr
242 Conflicts: efibootmgr < 0.11.0-7
243 # (tmb) conflict for vmmouse breakage (mga#16954)
244 Conflicts: x11-driver-input-vmmouse < 13.1.0-1
245
246 %ifarch %{ix86}
247 Conflicts: arch(x86_64)
248 %endif
249
250 %description -n %{kname}-%{buildrel}
251 %ifarch %{ix86}
252 This kernel is compiled for desktop use, single or multiple i586
253 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, voluntary
254 preempt, CFS cpu scheduler and cfq i/o scheduler.
255 This kernel relies on in-kernel smp alternatives to switch between
256 up & smp mode depending on detected hardware. To force the kernel
257 to boot in single processor mode, use the "nosmp" boot parameter.
258 %else
259 %ifarch %{arm}
260 This kernel is compiled for Arm Kirkwood boxes. It will run on openrd
261 boards. It's configured using HZ_100, preempt, CFS cpu scheduler and
262 cfq i/o scheduler.
263 This kernel relies on in-kernel smp alternatives to switch between
264 up & smp mode depending on detected hardware. To force the kernel
265 to boot in single processor mode, use the "nosmp" boot parameter.
266 %else
267 This kernel is compiled for desktop use, single or multiple %{_arch}
268 processor(s)/core(s), using HZ_1000, voluntary preempt, CFS cpu
269 scheduler and 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 %endif
274 %endif
275
276 %{klinus_notice}
277 %endif # build_kernel
278
279
280 #
281 # kernel-source: kernel sources
282 #
283 %if %build_source
284 %package -n %{kname}-source-%{buildrel}
285 Version: %{fakever}
286 Release: %{fakerel}
287 Provides: %{kname}-source, kernel-source = %{kverrel}
288 Provides: %{kname}-source-%{kernelversion}.%{patchlevel}
289 Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils
290 Summary: The source code for the Linux kernel
291 Group: Development/Kernel
292 Autoreqprov: no
293 Buildarch: noarch
294
295 %description -n %{kname}-source-%{buildrel}
296 The %{kname}-source package contains the source code files for the
297 Linux kernel. Theese source files are only needed if you want to build
298 your own custom kernel that is better tuned to your particular hardware.
299
300 If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...)
301 drivers against, install the *-devel-* rpm that is matching your kernel.
302
303 %{klinus_notice}
304 %endif #build_source
305
306
307 #
308 # kernel-devel: stripped kernel sources
309 #
310 %if %build_devel
311 %package -n %{kname}-devel-%{buildrel}
312 Version: %{fakever}
313 Release: %{fakerel}
314 Provides: kernel-devel = %{kverrel}
315 Summary: The %{kname} devel files for 3rdparty modules build
316 Group: Development/Kernel
317 Autoreqprov: no
318 Requires: glibc-devel, ncurses-devel, make, gcc, perl
319 Requires: pkgconfig(libelf)
320 %ifarch %{ix86}
321 Conflicts: arch(x86_64)
322 %endif
323
324 %description -n %{kname}-devel-%{buildrel}
325 This package contains the kernel-devel files that should be enough to build
326 3rdparty drivers against for use with the %{kname}-%{buildrel}.
327
328 If you want to build your own kernel, you need to install the full
329 %{kname}-source-%{buildrel} rpm.
330
331 %{klinus_notice}
332 %endif #build_devel
333
334
335 #
336 # kernel-doc: documentation for the Linux kernel
337 #
338 %if %build_doc
339 %package -n %{kname}-doc
340 Version: %{kversion}
341 Release: %{rpmrel}
342 Summary: Various documentation bits found in the kernel source
343 Group: Documentation
344 Buildarch: noarch
345
346 %description -n %{kname}-doc
347 This package contains documentation files form the kernel source. Various
348 bits of information about the Linux kernel and the device drivers shipped
349 with it are documented in these files. You also might want install this
350 package if you need a reference to the options that can be passed to Linux
351 kernel modules at load time.
352
353 %{klinus_notice}
354 %endif #build_doc
355
356
357 #
358 # kernel-latest: virtual rpm
359 #
360 %if %build_kernel
361 %package -n %{kname}-latest
362 Version: %{kversion}
363 Release: %{rpmrel}
364 Summary: Virtual rpm for latest %{kname}
365 Group: System/Kernel and hardware
366 Requires: %{kname}-%{buildrel}
367 %ifarch %{ix86}
368 Conflicts: arch(x86_64)
369 %endif
370
371 %description -n %{kname}-latest
372 This package is a virtual rpm that aims to make sure you always have the
373 latest %{kname} installed...
374
375 %{klinus_notice}
376 %endif #build_kernel
377
378
379 #
380 # kernel-source-latest: virtual rpm
381 #
382 %if %build_source
383 %package -n %{kname}-source-latest
384 Version: %{kversion}
385 Release: %{rpmrel}
386 Summary: Virtual rpm for latest %{kname}-source
387 Group: System/Kernel and hardware
388 Requires: %{kname}-source-%{buildrel}
389 Buildarch: noarch
390
391 %description -n %{kname}-source-latest
392 This package is a virtual rpm that aims to make sure you always have the
393 latest %{kname}-source installed...
394
395 %{klinus_notice}
396 %endif #build_source
397
398
399 #
400 # kernel-devel-latest: virtual rpm
401 #
402 %if %build_devel
403 %package -n %{kname}-devel-latest
404 Version: %{kversion}
405 Release: %{rpmrel}
406 Summary: Virtual rpm for latest %{kname}-devel
407 Group: System/Kernel and hardware
408 Requires: %{kname}-devel-%{buildrel}
409 %ifarch %{ix86}
410 Conflicts: arch(x86_64)
411 %endif
412
413 %description -n %{kname}-devel-latest
414 This package is a virtual rpm that aims to make sure you always have the
415 latest %{kname}-devel installed...
416
417 %{klinus_notice}
418 %endif #build_devel
419
420
421 #
422 # End packages - here begins build stage
423 #
424 %prep
425 %setup -q -n %top_dir_name -c
426
427 pushd %src_dir
428
429 %if %sublevel
430 %patch1 -p1
431 %endif
432 %if %kpatch
433 %patch2 -p1
434 %endif
435
436 # critical fixes
437
438 popd
439
440 # PATCH END
441
442
443 #
444 # Setup Begin
445 #
446
447 # Install defconfigs...
448 install %{SOURCE20} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/
449 install %{SOURCE21} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/
450 install %{SOURCE22} %{build_dir}/linux-%{tar_ver}/arch/arm/configs/
451
452 # make sure the kernel has the sublevel we know it has...
453 LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" linux-%{tar_ver}/Makefile
454
455
456 %build
457 # Common target directories
458 %define _bootdir /boot
459 %define _modulesdir /lib/modules
460 %define _kerneldir /usr/src/%{kname}-%{buildrel}
461 %define _develdir /usr/src/%{kname}-devel-%{buildrel}
462
463
464 # Directories definition needed for building
465 %define temp_root %{build_dir}/temp-root
466 %define temp_boot %{temp_root}%{_bootdir}
467 %define temp_modules %{temp_root}%{_modulesdir}
468 %define temp_source %{temp_root}%{_kerneldir}
469 %define temp_devel %{temp_root}%{_develdir}
470
471
472 # Create a simulacro of buildroot
473 rm -rf %{temp_root}
474 install -d %{temp_root}
475
476
477 # make sure we are in the directory
478 cd %{src_dir}
479
480 # fix missing exec flag on file introduced in 4.14.10-rc1
481 chmod 755 tools/objtool/sync-check.sh
482
483 # make sure EXTRAVERSION says what we want it to say
484 LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildrpmrel}/" Makefile
485
486 # Prepare the kernel
487 %smake -s mrproper
488 %ifarch %{ix86} x86_64
489 cp arch/x86/configs/%{target_arch}_defconfig .config
490 %else
491 cp arch/%{target_arch}/configs/%{target_arch}_defconfig .config
492 %endif
493 %smake ARCH=%{_arch} oldconfig
494
495 # Build the kernel
496 %kmake ARCH=%{_arch} -s all
497 # Install kernel
498 install -d %{temp_boot}
499 install -m 644 System.map %{temp_boot}/System.map-%{buildrel}
500 install -m 644 .config %{temp_boot}/config-%{buildrel}
501 %ifarch %{arm}
502 cp -f arch/arm/boot/zImage %{temp_boot}/vmlinuz-%{buildrel}
503 install -d %{temp_root}/usr/lib/linux-%{buildrel}/
504 for d in arch/arm/boot/dts/*.dtb; do \
505 install -D -m644 $d %{temp_root}/usr/lib/linux-%{buildrel}/$(basename $d); \
506 done
507 %else
508 cp -f arch/%{target_arch}/boot/bzImage %{temp_boot}/vmlinuz-%{buildrel}
509 %endif
510
511 # Install modules
512 install -d %{temp_modules}/%{buildrel}
513 %smake ARCH=%{_arch} INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{buildrel} modules_install
514
515 # remove /lib/firmware, we use a separate kernel-firmware
516 rm -rf %{temp_root}/lib/firmware
517
518 # Save devel tree
519 %if %build_devel
520 mkdir -p %{temp_devel}
521 for i in $(find . -name 'Makefile*'); do cp -R --parents $i %{temp_devel};done
522 for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*' -o -name config.mk); do cp -R --parents $i %{temp_devel};done
523 cp -fR include %{temp_devel}
524 cp -fR scripts %{temp_devel}
525 cp -fR tools/include %{temp_devel}/tools/
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