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

Contents of /updates/8/kernel-linus/current/SPECS/kernel-linus.spec

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.30