/[packages]/cauldron/kernel-linus/current/SPECS/kernel-linus.spec
ViewVC logotype

Annotation of /cauldron/kernel-linus/current/SPECS/kernel-linus.spec

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.30