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

  ViewVC Help
Powered by ViewVC 1.1.30