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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1765331 - (show annotations) (download)
Wed Dec 29 19:26:06 2021 UTC (2 years, 3 months ago) by tmb
File size: 59386 byte(s)
- update to 5.15.12
  * drop merged patches
- disable CIFS_SMB_DIRECT on desktop kernels as it makes loading cifs deps fail on some setups (mga#29784)


1 # -*- Mode: rpm-spec -*-
2 #
3 # This Specfile is based on kernel-tmb spec done by
4 # Thomas Backlund <tmb@mandriva.org>
5 #
6 # The mkflavour() macroization done by Anssi Hannula <anssi@mandriva.org>
7 #
8 # ----------------------------------------------------------------------------
9 # Consult this page for extra docs:
10 #
11 # https://wiki.mageia.org/en/Kernel_update_workflow
12 #
13 # (feel free to adjust the wiki-page when adding or removing features
14 # to the spec file).
15 #
16 # After building a new kernel, remember to push:
17 #
18 # kmod-virtualbox
19 # kmod-vboxadditions
20 # kmod-xtables-addons
21 # drakx-installer-images (both core and nonfree)
22 # ----------------------------------------------------------------------------
23 #
24 # Aarch64 still has problems with multithreaded rpmbuild 4.15-rc
25 %if 0%{?mageia} >= 8
26 %ifarch aarch64
27 %global _smp_nthreads_max 1
28 %endif
29 %endif
30
31 #
32 # Mageia kernels use kernel.org versioning
33 #
34 %define kernelversion 5
35 # WARNING: when patchlevel is bumped, please update drakx/kernel/list_modules.pm for new modules!!!
36 %define patchlevel 15
37 # sublevel is now used for -stable patches
38 %define sublevel 12
39
40 # Package release
41 %define mgarel 1
42
43 # kernel Makefile extraversion is substituted by
44 # rcX which are either 0 (empty), X (as in rcX)
45 %define rcX 0
46
47 # kernel base name (also name of srpm)
48 %define kname kernel
49
50 # Patch tarball tag
51 %define ktag mga
52
53 %define rpmtag %{distsuffix}%{mgaver}
54 %if %{rcX}
55 %define rpmrel %mkrel 0.rc%{rcX}.%{mgarel}
56 %else
57 %define rpmrel %mkrel %{mgarel}
58 %endif
59
60 # fakerel and fakever never change, they are used to fool
61 # rpm/urpmi/smart and ensure the kernels are installed,
62 # not upgraded so old kernel is not overwritten or removed
63 %define fakever 1
64 %define fakerel %mkrel 1
65
66 # version defines
67 %define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
68 %define kverrel %{kversion}-%{rpmrel}
69
70 # When we are using a rcX patch, the tarball is a sublevel -1
71 %if %{rcX}
72 %if %sublevel
73 %define tar_ver %{kernelversion}.%{patchlevel}
74 %else
75 %define tar_ver %{kernelversion}.%(expr %{patchlevel} - 1)
76 %endif
77 %else
78 %define tar_ver %{kernelversion}.%{patchlevel}
79 %endif
80
81 # Used for not making too long names for rpms or search paths
82 %if %rcX
83 %define buildrpmrel 0.rc%{rcX}.%{mgarel}%{rpmtag}
84 %else
85 %define buildrpmrel %{mgarel}%{rpmtag}
86 %endif
87 %define buildrel %{kversion}-%{buildrpmrel}
88
89 # Having different top level names for packges means that you have to remove
90 # them by hard :(
91 %define top_dir_name %{kname}-%{_arch}
92
93 %define build_dir ${RPM_BUILD_DIR}/%{top_dir_name}
94 %define src_dir %{build_dir}/linux-%{tar_ver}
95
96 # Disable useless debug rpms...
97 %global _enable_debug_packages %{nil}
98 %global debug_package %{nil}
99 %global __debug_package %{nil}
100 %global __debug_install_post %{nil}
101 %global _build_id_links none
102
103 # no bytecompiling wanted as it breaks build on selftests we dont even ship
104 # for older buildsystems
105 %global _python_bytecompile_build 0
106 # for systems with >= rpm-mageia-setup-2.29-1.mga7
107 %global __brp_python_bytecompile %nil
108
109 # Build defines
110 %define build_doc 1
111 %define build_uheaders 1
112 %define build_source 1
113 %define build_devel 1
114
115 %define build_debug 0
116
117 # Build desktop i586 / 4GB
118 %ifarch %{ix86}
119 %define build_desktop586 1
120 %endif
121
122 # Build desktop (i686 / 4GB) / x86_64
123 %define build_desktop 1
124
125 # Build server (i686 / 64GB)/x86_64 / sparc64 sets
126 %define build_server 1
127
128 # build perf and cpupower tools
129 %define build_perf 1
130 %define build_cpupower 1
131
132 # bpf
133 %define build_bpftool 1
134 %define build_libbpf 1
135
136 # compress modules with xz
137 %define build_modxz 1
138
139 # ARM builds
140 %ifarch %{arm}
141 %define build_server 0
142 # no cpupower tools on arm yet
143 %define build_cpupower 0
144 # arm is currently not using xz
145 %define build_modxz 0
146 %endif
147 # Arm64 builds
148 %ifarch aarch64
149 %define build_cpupower 0
150 %endif
151 # End of user definitions
152
153 # buildtime flags
154 %{?_without_desktop586: %global build_desktop586 0}
155 %{?_without_desktop: %global build_desktop 0}
156 %{?_without_server: %global build_server 0}
157 %{?_without_doc: %global build_doc 0}
158 %{?_without_uheaders: %global build_uheaders 0}
159 %{?_without_source: %global build_source 0}
160 %{?_without_devel: %global build_devel 0}
161 %{?_without_debug: %global build_debug 0}
162 %{?_without_perf: %global build_perf 0}
163 %{?_without_cpupower: %global build_cpupower 0}
164 %{?_without_bpftool: %global build_bpftool 0}
165 %{?_without_libbpf: %global build_libbpf 0}
166 %{?_without_modxz: %global build_modxz 0}
167
168 %{?_with_desktop586: %global build_desktop586 1}
169 %{?_with_desktop: %global build_desktop 1}
170 %{?_with_server: %global build_server 1}
171 %{?_with_doc: %global build_doc 1}
172 %{?_with_uheaders: %global build_uheaders 1}
173 %{?_with_source: %global build_source 1}
174 %{?_with_devel: %global build_devel 1}
175 %{?_with_debug: %global build_debug 1}
176 %{?_with_perf: %global build_perf 1}
177 %{?_with_cpupower: %global build_cpupower 1}
178 %{?_with_bpftool: %global build_bpftool 1}
179 %{?_with_libbpf: %global build_libbpf 1}
180 %{?_with_modxz: %global build_modxz 1}
181
182 # For the .nosrc.rpm
183 %define build_nosrc 0
184 %{?_with_nosrc: %global build_nosrc 1}
185
186 %if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi)
187 %define kmake %make_build CC="$CC"
188 %else
189 %define kmake %make_build
190 %endif
191 # there are places where parallel make don't work
192 %define smake make
193
194 # Parallelize xargs invocations on smp machines
195 %define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\
196 && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
197 [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS")
198
199 # Sparc arch wants sparc64 kernels
200 %define target_arch %(echo %{_arch} | sed -e 's/arm.*/arm/' -e 's/aarch64/arm64/')
201
202
203 #
204 # SRC RPM description
205 #
206 Summary: Linux kernel built for Mageia
207 Name: %{kname}
208 Version: %{kversion}
209 Release: %{rpmrel}
210 License: GPLv2
211 Group: System/Kernel and hardware
212 ExclusiveArch: %{ix86} x86_64 %{arm} aarch64
213 ExclusiveOS: Linux
214 URL: https://www.kernel.org/
215
216 ####################################################################
217 #
218 # Sources
219 #
220 ### This is for full SRC RPM
221 Source0: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.xz
222 Source1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.sign
223 ### This is for stripped SRC RPM
224 %if %build_nosrc
225 NoSource: 0
226 %endif
227 # This is for disabling *config, mrproper, prepare, scripts on -devel rpms
228 Source2: disable-mrproper-in-devel-rpms.patch
229
230 Source4: README.kernel-sources
231
232 # for creating stable queue patchlist
233 Source5: generate-patchlist.sh
234
235 # copy to patched source tree along with the defconfigs and run it
236 Source10: defconfig-updater.sh
237 Source09: defconfig-updater-simple.sh
238 # x86_64 defconfigs
239 Source11: defconfig-x86_64-desktop
240 Source12: defconfig-x86_64-server
241 # i386 defconfigs
242 Source13: defconfig-i386-desktop586
243 Source14: defconfig-i386-desktop
244 Source15: defconfig-i386-server
245 # arm64 defconfigs
246 Source16: defconfig-arm64-desktop
247 Source17: defconfig-arm64-server
248 # arm defconfigs
249 Source18: defconfig-arm-desktop
250
251 # config and systemd service file from fedora
252 Source50: cpupower.service
253 Source51: cpupower.config
254
255 # breaks bpftool build on mga8
256 Source100: tools-build-remove-needless-libpython-version-feature-check-that-breaks-test-all-fast-path.patch
257 # breaks cifs NTLM support
258 Source101: fs-cifs-remove-support-for-NTLM-and-weaker-authenticati.patch
259
260 ####################################################################
261 #
262 # Patches
263
264 #
265 # Patch0 to Patch10 are for core kernel upgrades.
266 #
267
268 %if %sublevel
269 Patch1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.xz
270 %endif
271 %if %{rcX}
272 # (tmb) Created with:
273 # wget https://git.kernel.org/torvalds/p/v5.10-rc7/v5.9 -O patch-5.10-rc7
274 # xz -6e patch-5.10-rc7
275 Patch2: patch-%{kernelversion}.%{patchlevel}-rc%{rcX}.xz
276 %endif
277
278 ###
279 ### Stable Queue can be big
280 ### Patches from 100-999
281 ###
282 ### add patches here by copying contents of kernel matching queue-x.y from:
283 ### https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/tree/
284 ### to SOURCES, generate patchlist with generate-patchlist.sh and paste it here
285 ###
286
287 ###
288 ### Arch
289 ### Patches from 1000
290 ###
291
292 # laptop needing pci=assign-busses (#18989, needs to be submitted upstream)
293 Patch1000: x86-pci-toshiba-equium-a60-assign-busses.patch
294
295 # If users choose a bad video mode, allow to jump to
296 # a working one (TTL: forever)
297 Patch1001: x86-boot-video-80x25-if-break.patch
298
299 # Allow poweroff on UP machines running SMP kernels
300 Patch1005: x86-default_poweroff_up_machines.patch
301
302 # raise vmalloc to fix https://bugs.mageia.org/show_bug.cgi?id=904
303 Patch1010: x86-increase-default-minimum-vmalloc-area-by-64MB-to-192MB.patch
304
305 # slows down boot
306 Patch1015: Revert-cpufreq-pcc-Enable-autoload-of-pcc-cpufreq-fo.patch
307
308 # fixes new hw not being properly detected
309 Patch1020: x86-pci-ignore-e820-reservations-for-bridge-windows-on-newer-systems.patch
310
311 # intel_pstate
312 Patch1025: cpufreq-intel_pstate-ITMT-support-for-overclocked-sy.patch
313
314 ###
315 ### ACPI
316 ###
317
318 # CLEVO M360S acpi irq workaround
319 Patch1100: acpi-CLEVO-M360S-disable_acpi_irq.patch
320
321 # Clevo M720SR freezes with C3
322 Patch1105: acpi-processor-M720SR-limit-to-C2.patch
323
324 # backlight fixes
325 Patch1110: ACPI-video-Add-a-quirk-to-force-acpi-video-backlight.patch
326
327 # ACPI PM fixes (TTL: 5.16)
328 Patch1130: x86-ACPI-State-Optimize-C3-entry-on-AMD-CPUs.patch
329
330 ###
331 ### Block
332 ###
333
334 # FIXME: Don't know know why this is needed
335 Patch1200: scsi-megaraid-new-sysfs-name.patch
336
337 # adds aliases to support upgrade from old dm-raid45 patch
338 Patch1215: dm-raid-aliases.patch
339
340 # disable floppy autoloading (mga #4696)
341 Patch1220: block-floppy-disable-pnp-modalias.patch
342
343 # ahci
344 Patch1240: Add-AHCI-support-for-ASM1062-JBM575-cards.patch
345
346 # mmc
347 Patch1250: mmc-sdhci-pci-Add-PCI-ID-for-Intel-ADL.patch
348
349 ###
350 ### Crypto
351 ###
352
353 ###
354 ### dma
355 ###
356
357 ###
358 ### File-system
359 ###
360
361 # aufs diffed from: https://github.com/sfjro/aufs5-linux/tree/aufs5.15 (mga#8314)
362 Patch1310: fs-aufs5.15.patch
363 # symbol exports needed for modular aufs
364 Patch1311: fs-aufs5.15-symbol-exports.patch
365 # set aufs tristate
366 Patch1312: fs-aufs5.15-tristate.patch
367
368 # 5.15.7 regression fix
369 Patch1320: fs-fget-clarify-and-improve-__fget_files-implementation.patch
370
371 # procfs
372 Patch1360: fs-procfs-do-not-list-TID-0-in-proc-pid-task.patch
373
374 ###
375 ### FireWire
376 ###
377
378 # adding module aliases to ease upgrade from ieee1394
379 Patch1400: firewire-ieee1394-module-aliases.patch
380
381 ###
382 ### Firmware
383 ###
384
385 ###
386 ### GPU/DRM
387 ###
388
389 # amdgpu
390 # switch SI and CIK from radeon to amdgpu
391 Patch1520: drm-amdgpu-SI-and-CIK-enabled-by-default.patch
392
393 # new Q57 Host Bridge id
394 Patch1530: char-agp-intel-new-Q57-id.patch
395
396 # i915
397 # DG1
398 Patch1540: drm-i915-Add-pci-ids-and-uapi-for-DG1.patch
399 # Alder Lake S
400 Patch1541: drm-i915-adl_s-Remove-require_force_probe-protection.patch
401 # Raptor Lake S
402 Patch1542: drm-i915-rpl-s-Add-PCI-IDS-for-Raptor-Lake-S.patch
403 Patch1543: drm-i915-rpl-s-Add-PCH-Support-for-Raptor-Lake-S.patch
404 Patch1544: drm-i915-rpl-s-Enable-guc-submission-by-default.patch
405 # Alder Lake N
406 Patch1545: drm-i915-adl-n-Enable-ADL-N-platform.patch
407 #
408 Patch1546: drm-i915-gen11-Moving-WAs-to-icl_gt_workarounds_init.patch
409
410 # https://bugzilla.kernel.org/show_bug.cgi?id=206653#c19
411 Patch1552: i2c_nvidia_gpu-change-err-into-info.patch
412
413 # 5.15 regression, mga#29704, alternative fix to reverting:
414 # 3e1ad79bf66165bdb2baca3989f9227939241f11 "drm/nouveau: always wait for the exclusive fence""
415 Patch1560: drm-nouveau-wait-for-the-exclusive-fence-after-the-shared-ones-v2.patch
416
417 ###
418 ### hwmon
419 ###
420
421 # k10temp
422 Patch1600: x86-amd_nb-Add-AMD-Family-19h-Models-10h-1Fh-and-A0h-AFh-PCI-IDs.patch
423 Patch1601: hwmon-k10temp-Remove-unused-definitions.patch
424 Patch1602: hwmon-k10temp-Add-support-for-AMD-Family-19h-Models-10h-1Fh-and-A0h-AFh.patch
425 Patch1603: hwmon-k10temp-Support-up-to-12-CCDs-on-AMD-Family-of-processors.patch
426
427 # asus
428 Patch1610: hwmon-nct6775-Use-superio_-function-pointers-in-sio_.patch
429 Patch1611: hwmon-nct6775-Use-nct6775_-function-pointers-in-nct6.patch
430 Patch1612: hwmon-nct6775-Support-access-via-Asus-WMI.patch
431 Patch1613: hwmon-nct6775-Add-additional-ASUS-motherboards.patch
432 Patch1614: hwmon-nct6775-add-Pro-WS-X570-ACE.patch
433 Patch1615: hwmon-nct6775-add-ProArt-X570-CREATOR-WIFI.patch
434 Patch1616: hwmon-asus_wmi_ec_sensors-Support-B550-Asus-WMI.patch
435 Patch1617: hwmon-asus_wmi_sensors-Support-X370-Asus-WMI.patch
436
437 ###
438 ### i2c
439 ###
440
441 ###
442 ### Input
443 ###
444
445 Patch1700: input-i8042-quirks-for-Fujitsu-Lifebook-A544-and-Lif.patch
446
447 ###
448 ### HID
449 ###
450
451 Patch1750: hid-intel-ish-hid-ipc-Specify-no-cache-snooping-on-TGL-and-ADL.patch
452
453 ###
454 ### MFD
455 ###
456
457 ###
458 ### MM
459 ###
460
461 ###
462 ### Network
463 ###
464
465 # SiS 190 fixes
466 Patch1900: net-sis190-fix-list-usage.patch
467
468 # netfilter IFWLOG support
469 Patch1910: net-netfilter-IFWLOG.patch
470 Patch1911: net-netfilter-IFWLOG-mdv.patch
471 Patch1912: net-netfilter-IFWLOG-2.6.35-buildfix.patch
472 Patch1913: net-netfilter-IFWLOG-2.6.37-buildfix.patch
473 Patch1914: net-ipv4-netfilter-ipt_IFWLOG-3.6-buildfix.patch
474 Patch1915: net-netfilter-IFWLOG-3.7-buildfix.patch
475 Patch1916: net-netfilter-IFWLOG-remove-unused-label.patch
476 Patch1917: net-netfilter-ipt_IFWLOG-4.12-buildfix.patch
477 Patch1918: net-netfilter-IFWLOG-5.0-buildfix.patch
478
479 # netfilter psd support
480 Patch1920: net-netfilter-psd.patch
481 Patch1921: net-netfilter-psd-mdv.patch
482 Patch1922: net-netfilter-psd-2.6.35-buildfix.patch
483 Patch1923: net-netfilter-psd-fix-redefines.patch
484
485 # rtw88 wifi
486 # add alias for the replaced r8822be staging driver
487 Patch1930: net-wireless-rtw88-add-r8822be-alias.patch
488 # add alias for the replaced 8723de 3rdparty driver
489 Patch1931: net-wireless-rtw88-add-8723de-alias.patch
490 # TTL: 5.16
491 Patch1932: net-wireless-rtw88-8821c-support-RFE-type4-wifi-NIC.patch
492 Patch1933: net-wireless-rtw88-8821c-correct-2.4G-tx-power-for-type-2-4-NIC.patch
493 # fixes broken aspm state hangs system (TTL: 5.17)
494 Patch1934: net-wireless-rtw88-add-quirk-to-disable-pci-caps-on-HP-250-G7-Notebook-PC.patch
495 Patch1935: net-wireless-rtw88-Disable-PCIe-ASPM-while-doing-NAPI-poll-on-8821CE.patch
496 Patch1936: net-wireless-rtw88-dont-check-CRC-of-VHT-SIG-B-in-802.11ac-signal.patch
497 Patch1937: net-wireless-rtw88-8822c-update-rx-settings-to-prevent-potential-hw-deadlock.patch
498
499 # bluetooth (5.15 regression, mga#29760)
500 Patch1940: bluetooth-apply-BTUSB_INTEL_BROKEN_INITIAL_NCMD-flag-for-broken-hw.patch
501
502 # amd-xgbe
503 Patch1945: net-amd-xgbe-Add-Support-for-Yellow-Carp-Ethernet-device.patch
504
505 # rtw89 patchset v7 for 802.11ax hw (TTL: 5.16)
506 Patch1960: net-wireless-rtw89-add-Realtek-802.11ax-driver.patch
507 Patch1961: net-wireless-rtw89-Fix-two-spelling-mistakes-in-debug-messages.patch
508 Patch1962: net-wireless-rtw89-Remove-redundant-check-of-ret-after-call-to-rt.patch
509 Patch1963: net-wireless-rtw89-fix-return-value-check-in-rtw89_cam_send_sec_k.patch
510 Patch1964: net-wireless-rtw89-remove-unneeded-semicolon.patch
511 Patch1965: net-wireless-rtw89-fix-error-function-parameter.patch
512 Patch1966: net-wireless-rtw89-remove-duplicate-register-definitions.patch
513 Patch1967: net-wireless-rtw89-fix-return-value-in-hfc_pub_cfg_chk.patch
514 Patch1968: net-wireless-rtw89-Fix-variable-dereferenced-before-check-sta.patch
515 Patch1969: net-wireless-rtw89-update-partition-size-of-firmware-header-on-skb-data.patch
516 Patch1970: net-wireless-rtw89-8852a-correct-bit-definition-of-dfs_en.patch
517
518 # iwlfiwi
519 Patch1980: net-wireless-iwlwifi-add-new-pci-id-for-6235.patch
520 Patch1981: net-wireless-iwlwifi-add-new-killer-devices-to-the-driver.patch
521 Patch1982: net-wireless-iwlwifi-add-new-device-id-7F70.patch
522 Patch1983: net-wireless-iwlwifi-pcie-fix-killer-name-matching-for-AX200.patch
523 Patch1984: net-wireless-iwlwifi-pcie-remove-two-duplicate-PNJ-device-entries.patch
524 Patch1985: net-wireless-iwlwifi-add-missing-entries-for-Gf4-with-So-and-SoF.patch
525 Patch1986: net-wireless-iwlwifi-swap-1650i-and-1650s-killer-struct-names.patch
526 Patch1987: net-wireless-iwlwifi-add-new-Qu-Hr-device.patch
527 Patch1988: net-wireless-iwlwifi-add-new-ax1650-killer-device.patch
528 Patch1989: net-wireless-iwlwifi-mvm-increase-the-scan-timeout-guard-to-30-seconds.patch
529
530 ###
531 ### PCI
532 ###
533
534 ###
535 ### pinctrl
536 ###
537
538 ###
539 ### Platform
540 ###
541
542 # Allow access to Shuttle WMI interface controls
543 # (Mainly allow turning on/off webcam and wireless on Shuttle DA18IE and DA18IM)
544 Patch2050: platform-x86-add-shuttle-wmi-driver.patch
545 Patch2051: platform-x86-shuttle-wmi-drop-devinit-exit.patch
546 Patch2052: platform-x86-shuttle-wmi-4.2-buildfix.patch
547 Patch2053: platform-x86-shuttle-wmi-4.13-buildfix.patch
548 Patch2054: platform-x86-shuttle-wmi-kernel-5.5.patch
549
550 ###
551 ### PM
552 ###
553
554 ###
555 ### Sound
556 ###
557
558 Patch2150: sound-alsa-hda-fix-general-protection-fault-in-azx_runtime_idle.patch
559
560 ###
561 ### SPI
562 ###
563
564 ###
565 ### Staging
566 ###
567
568 ###
569 ### Thermal
570 ###
571
572 ###
573 ### Thunderbolt
574 ###
575
576 ###
577 ### USB
578 ###
579
580 Patch2300: hid-usbhid-IBM-BladeCenterHS20-quirk.patch
581
582 Patch2310: usb-storage-unusual_devs-add-id.patch
583 Patch2311: usb-storage-unusual_devs-add-id-2.6.37-buildfix.patch
584
585 ###
586 ### V4L
587 ###
588
589 # pwc driver name in /proc/bus/devices, /sys fix and "advertisement" removal
590 Patch2400: media-usb-pwc-lie-in-proc-usb-devices.patch
591
592 ###
593 ### Video
594 ###
595
596 # Mageia framebuffer boot logo
597 Patch2500: video-mageia-logo.patch
598
599 # mga compat option
600 Patch2501: video-console-vgacon-treat-nokmsboot-as-nomodeset.patch
601
602 ###
603 ### Virt
604 ###
605
606 # fix gcc-10 build
607 Patch2550: KVM-squelch-uninitialized-variable-warning.patch
608
609 ###
610 ### Tools
611 ###
612
613 # wipe powerpc refrence so we can nuke dangling symlinks (mga#17676)
614 Patch2600: tools-testing-selftest-Makefile-remove-powerpc-reference.patch
615
616 # fix perf build
617 Patch2605: tools-perf-ui-include-slang.patch
618
619 ###
620 ### UAPI
621 ###
622
623 Patch2700: uapi-avoid-namespace-conflict-in-linux-posix_types.h.patch
624
625 ###
626 ### 3rdparty
627 ###
628
629 Patch3000: 3rd-3rdparty-tree.patch
630 Patch3001: 3rd-3rdparty-merge.patch
631
632 # ndiswrapper
633 Patch3100: 3rd-ndiswrapper-1.63.patch
634 Patch3101: 3rd-ndiswrapper-Kconfig.patch
635 Patch3102: 3rd-ndiswrapper-Makefile-build-fix.patch
636 Patch3103: 3rd-niswrapper-Kconfig-Makefile.patch
637
638 # add rtl8812 support (mga#21043)
639 # from https://github.com/aircrack-ng/rtl8812au.git
640 Patch3200: 3rd-rtl8812au.patch
641 Patch3201: 3rd-rtl8812au-Kconfig-Makefile.patch
642 Patch3202: 3rd-rtl8812au-rename.patch
643 Patch3203: 3rd-rtl8812au-kernel-5.12.patch
644 Patch3204: 3rd-rtl8812au-kernel-5.15.patch
645
646 # add rtl8723de support (mga#22559)
647 Patch3300: 3rd-rtl8723de.patch
648 Patch3301: 3rd-rtl8723de-Kconfig-Makefile.patch
649 Patch3302: 3rd-rtl8723de-fix-redefine.patch
650 Patch3303: 3rd-rtl8723de-nodebug.patch
651 Patch3304: 3rd-rtl8223de-kernel-5.6.patch
652 Patch3305: 3rd-rtl8723de-add-kernel-5.8-support.patch
653
654 # viahss
655 Patch3400: 3rd-viahss-0.92.patch
656 Patch3401: 3rd-viahss-config.patch
657 Patch3402: 3rd-viahss-module-license.patch
658 Patch3403: 3rd-viahss-2.6.35-buildfix.patch
659 Patch3404: 3rd-viahss-3.0-buildfix.patch
660 Patch3405: 3rd-viahss-Kconfig-Makefile.patch
661
662 # rtl8821ce (mga#24605) -- https://github.com/tomaspinho/rtl8821ce
663 Patch3500: 3rd-rtl8821ce.patch
664 Patch3501: 3rd-rtl8821ce-Kconfig-Makefile.patch
665 Patch3502: 3rd-rtl8821ce-5.8-fix.patch
666 Patch3503: 3rd-rtl8821ce-kernel-5.10.patch
667 Patch3504: 3rd-rtl8821ce-kernel-5.12.patch
668 Patch3505: 3rd-rtl8821ce-kernel-5.15.patch
669
670 # fix Kconfig files for 3rdparty:
671 Patch3900: 3rd-fix-kconfig.patch
672
673 ###
674 ### Python fixes
675 ###
676 Patch4000: linux-5.15-python3.patch
677
678 ###
679 ### TTY
680 ###
681
682 ###
683 ### Security fixes
684 ###
685 Patch5002: CVE-2019-12379.patch
686 #
687 # CVE-2020-16119
688 # https://bugzilla.redhat.com/show_bug.cgi?id=1886374
689 # https://bugzilla.redhat.com/show_bug.cgi?id=1888083
690 Patch5003: CVE-2020-16119-DCCP-CCID-structure-use-after-free.patch
691
692 ###
693 ### Cosmetic fixes (e.g. typos, spelling, etc.)
694 ###
695
696 ### Fixes from FC kernel
697 # Inspur Advantech PCI ids
698 Patch7000: 0001-scsi-smartpqi-add-inspur-advantech-ids.patch
699 # Vulcan AHCI PCI bar (aarch64)
700 Patch7001: 0001-Vulcan-AHCI-PCI-bar-fix-for-Broadcom-Vulcan-early-si.patch
701
702 #END
703 ####################################################################
704
705 # Defines for the things that are needed for all the kernels
706 #
707 %define common_desc_kernel The kernel package contains the Linux kernel (vmlinuz), the core of your \
708 Mageia operating system. The kernel handles the basic functions \
709 of the operating system: memory allocation, process allocation, device \
710 input and output, etc.
711
712 %define common_desc_kernel_smp This kernel relies on in-kernel smp alternatives to switch between up & smp \
713 mode depending on detected hardware. To force the kernel to boot in single \
714 processor mode, use the "nosmp" boot parameter.
715
716 ### Global Requires/Provides
717 %define requires1 bootloader-utils >= 1.16-1
718 %define requires2 dracut >= 046-2
719 %define requires3 kmod >= 12-2
720 %define requires4 sysfsutils >= 2.1.0-16
721 %define requires5 kernel-firmware >= 20190603-1
722 # ldetect-lst with SI/CIK swich from radeon to amdgpu
723 %define requires6 ldetect-lst >= 0.6.25-1
724
725 %define kprovides1 %{kname} = %{kverrel}
726 %define kprovides2 kernel = %{tar_ver}
727 %define kprovides3 alsa = 1.0.26
728 %define kprovides_server drbd-api = 88
729
730 # conflict dkms packages that dont support kernel-5.10
731 %define kconflicts1 dkms-broadcom-wl < 6.30.223.271-58
732 %define kconflicts2 dkms-nvidia-current < 460.32.03-1
733 %define kconflicts3 dkms-nvidia390 < 390.141-1
734 %define kconflicts4 dkms-nvidia340 < 340.108-15
735 %define kconflicts5 dkms-nvidia304 < 304.137-3
736 %define kconflicts6 dkms-virtualbox < 6.1.18-1
737 %define kconflicts7 dkms-xtables-addons < 3.13-2
738 # (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd
739 %define kconflicts8 btrfs-progs < 5.10-1
740 # (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd
741 %define kconflicts9 radeon-firmware < 20201218-1
742 # (tmb) conflict old firmware to get the firmwares in initrd
743 %define kconflicts10 kernel-firmware-nonfree < 20201230-1
744 # (tmb) conflict old microcode to get updated ones in initrd for early loading
745 %define kconflicts11 microcode < 0.20201118-2
746 # (tmb) conflict old theme to get mga8 theme in initrd
747 %define kconflicts12 mageia-gfxboot-theme < 4.5.14.11-2
748 # (tmb) conflict too old grub2(-efi)
749 %define kconflicts13 grub2 < 2.02.0-15
750 %define kconflicts14 grub2-efi < 2.02.0-15
751 # (tmb) conflict too old efibootmgr
752 %define kconflicts15 efibootmgr < 16-3
753 # (tmb) force new theme in initrd
754 %define kconflicts16 mageia-theme < 8.0-2
755
756 Autoreqprov: no
757
758 %if 0%{?mageia} >= 8
759 BuildRequires: gcc >= 10.3.0-1
760 BuildRequires: binutils >= 1:2.35.2-1
761 %else
762 BuildRequires: gcc >= 8.4.0-1
763 BuildRequires: binutils >= 1:2.33.1-1
764 %endif
765 BuildRequires: kmod >= 12-2
766 BuildRequires: bc
767 # for crypto stuff
768 BuildRequires: pkgconfig(openssl)
769 # since 4.16
770 BuildRequires: bison
771 BuildRequires: diffutils
772 BuildRequires: elfutils-devel
773 BuildRequires: flex
774 # for headers_install
775 BuildRequires: rsync
776 # for cpupower
777 %if %{build_cpupower}
778 BuildRequires: pkgconfig(libpci)
779 %endif
780 # for perf
781 %if %{build_perf}
782 BuildRequires: audit-devel
783 BuildRequires: binutils-devel
784 BuildRequires: gtk2-devel
785 BuildRequires: libunwind-devel
786 BuildRequires: newt-devel
787 BuildRequires: python3-devel
788 BuildRequires: zlib-devel
789 BuildRequires: asciidoc
790 BuildRequires: xmlto-notex
791 BuildRequires: perl-devel
792 %if 0%{?mageia} >= 8
793 BuildRequires: systemtap-sdt-devel
794 BuildRequires: babeltrace-devel
795 %else
796 BuildRequires: libbabeltrace-devel
797 %endif
798 %ifarch %{ix86} x86_64
799 BuildRequires: numa-devel
800 %endif
801 %endif
802 %if %{build_bpftool}
803 BuildRequires: python3-docutils
804 BuildRequires: cap-devel
805 %endif
806
807 %description
808 %common_desc_kernel
809 %ifnarch %{arm}
810 %common_desc_kernel_smp
811 %endif
812
813 # mkflavour() name flavour processor
814 # name: the flavour name in the package name
815 # flavour: first parameter of CreateKernel()
816 %define mkflavour() \
817 %package -n %{kname}-%{1}-%{buildrel} \
818 Version: %{fakever} \
819 Release: %{fakerel} \
820 Provides: %kprovides1 %kprovides2 %kprovides3 \
821 %{expand:%%{?kprovides_%{1}:Provides: %{kprovides_%{1}}}} \
822 Provides: %{kname}-%{1} \
823 Requires(pre): %requires1 %requires2 %requires3 %requires4 \
824 Requires: %requires2 %requires5 %requires6 \
825 Conflicts: %kconflicts1 %kconflicts2 %kconflicts3 \
826 Conflicts: %kconflicts4 %kconflicts5 %kconflicts6 \
827 Conflicts: %kconflicts7 %kconflicts8 %kconflicts9 \
828 Conflicts: %kconflicts10 %kconflicts11 %kconflicts12 \
829 Conflicts: %kconflicts13 %kconflicts14 %kconflicts15 \
830 Conflicts: %kconflicts16 \
831 %if 0%{?mageia} >= 8 \
832 Obsoletes: crda \
833 Obsoletes: crda-devel \
834 Obsoletes: fuse-exfat \
835 %endif \
836 Provides: should-restart = system \
837 Provides: installonlypkg(kernel) \
838 Recommends: iw cpupower microcode \
839 Recommends: %{kname}-%{1}-latest \
840 %ifarch %{ix86} \
841 Conflicts: arch(x86_64) \
842 %endif \
843 Summary: %{expand:%{summary_%(echo %{1} | sed -e "s/-/_/")}} \
844 Group: System/Kernel and hardware \
845 %description -n %{kname}-%{1}-%{buildrel} \
846 %common_desc_kernel %{expand:%{info_%(echo %{1} | sed -e "s/-/_/")}} \
847 %ifnarch %{arm} \
848 %common_desc_kernel_smp \
849 %endif \
850 \
851 %if %build_devel \
852 %package -n %{kname}-%{1}-devel-%{buildrel} \
853 Version: %{fakever} \
854 Release: %{fakerel} \
855 Requires: glibc-devel ncurses-devel make gcc perl \
856 Requires: gcc >= 5.5.0-1 \
857 %ifarch x86_64 \
858 Requires: pkgconfig(libelf) \
859 %endif \
860 Summary: The kernel-devel files for %{kname}-%{1}-%{buildrel} \
861 Group: Development/Kernel \
862 Provides: %{kname}-devel = %{kverrel} \
863 Provides: %{kname}-%{1}-devel \
864 Recommends: %{kname}-%{1}-devel-latest \
865 %ifarch %{ix86} \
866 Conflicts: arch(x86_64) \
867 %endif \
868 %description -n %{kname}-%{1}-devel-%{buildrel} \
869 This package contains the kernel files (headers and build tools) \
870 that should be enough to build additional drivers for \
871 use with %{kname}-%{1}-%{buildrel}. \
872 \
873 If you want to build your own kernel, you need to install the full \
874 %{kname}-source-%{buildrel} rpm. \
875 \
876 %endif \
877 \
878 %if %build_debug \
879 %package -n %{kname}-%{1}-%{buildrel}-debuginfo \
880 Version: %{fakever} \
881 Release: %{fakerel} \
882 Summary: Files with debuginfo for %{kname}-%{1}-%{buildrel} \
883 Group: Development/Debug \
884 Provides: kernel-debug = %{kverrel} \
885 %ifarch %{ix86} \
886 Conflicts: arch(x86_64) \
887 %endif \
888 %description -n %{kname}-%{1}-%{buildrel}-debuginfo \
889 This package contains the files with debuginfo to aid in debug tasks \
890 when using %{kname}-%{1}-%{buildrel}. \
891 \
892 If you need to look at debug information or use some application that \
893 needs debugging info from the kernel, this package may help. \
894 \
895 %endif \
896 \
897 %package -n %{kname}-%{1}-latest \
898 Version: %{kversion} \
899 Release: %{rpmrel} \
900 Summary: Virtual rpm for latest %{kname}-%{1} \
901 Group: System/Kernel and hardware \
902 Requires: %{kname}-%{1}-%{buildrel} \
903 %ifarch %{ix86} \
904 Conflicts: arch(x86_64) \
905 %endif \
906 Obsoletes: vboxadditions-kernel-%{1}-latest \
907 Obsoletes: kernel-tmb-%{1}-latest \
908 %description -n %{kname}-%{1}-latest \
909 This package is a virtual rpm that aims to make sure you always have the \
910 latest %{kname}-%{1} installed... \
911 \
912 %if %build_devel \
913 %package -n %{kname}-%{1}-devel-latest \
914 Version: %{kversion} \
915 Release: %{rpmrel} \
916 Summary: Virtual rpm for latest %{kname}-%{1}-devel \
917 Group: Development/Kernel \
918 Requires: %{kname}-%{1}-devel-%{buildrel} \
919 %ifarch %{ix86} \
920 Conflicts: arch(x86_64) \
921 %endif \
922 Provides: %{kname}-devel-latest \
923 Obsoletes: kernel-tmb-%{1}-devel-latest \
924 %description -n %{kname}-%{1}-devel-latest \
925 This package is a virtual rpm that aims to make sure you always have the \
926 latest %{kname}-%{1}-devel installed... \
927 \
928 %endif \
929 \
930 %posttrans -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-posttrans \
931 %postun -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-postun \
932 \
933 %if %build_devel \
934 %post -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-post \
935 %preun -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-preun \
936 %postun -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-postun \
937 %endif \
938 \
939 %files -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1} \
940 %files -n %{kname}-%{1}-latest \
941 \
942 %if %build_devel \
943 %files -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1} \
944 %files -n %{kname}-%{1}-devel-latest \
945 %endif \
946 \
947 %if %build_debug \
948 %files -n %{kname}-%{1}-%{buildrel}-debuginfo -f kernel_debug_files.%{1} \
949 %endif
950
951 %ifarch %{ix86}
952 #
953 # kernel-desktop586: i586, smp-alternatives, 4GB
954 #
955 %if %build_desktop586
956 %define summary_desktop586 Linux kernel for desktop use with i586 and less than 4GB RAM
957 %define info_desktop586 This kernel is compiled for desktop use, single or \
958 multiple i586 processor(s)/core(s) and less than 4GB RAM (usually 3-3.5GB \
959 detected, if you need/want to use all 4GB or more, install kernel-server), \
960 using HZ_1000, voluntary preempt, CFS cpu scheduler and cfq i/o scheduler.
961 %mkflavour desktop586
962 %endif
963 %endif
964
965 #
966 # kernel-desktop: i686, smp-alternatives, 4 GB / x86_64
967 #
968 %if %build_desktop
969 %ifarch %{ix86}
970 %define summary_desktop Linux Kernel for desktop use with i686 and less than 4GB RAM
971 %define info_desktop This kernel is compiled for desktop use, single or \
972 multiple i686 processor(s)/core(s) and less than 4GB RAM (usually 3-3.5GB \
973 detected, if you need/want to use all 4GB or more, install kernel-server), \
974 using HZ_1000, voluntary preempt, CFS cpu scheduler and cfq i/o scheduler.
975 %else
976 %define summary_desktop Linux Kernel for desktop use with %{_arch}
977 %define info_desktop This kernel is compiled for desktop use, single or \
978 multiple %{_arch} processor(s)/core(s), using HZ_1000, voluntary preempt, \
979 CFS cpu scheduler and cfq i/o scheduler.
980 %endif
981 %mkflavour desktop
982 %endif
983
984 #
985 # kernel-server: i686, smp-alternatives, 64 GB / x86_64
986 #
987 %if %build_server
988 %ifarch %{ix86}
989 %define summary_server Linux Kernel for server use with i686 & 64GB RAM
990 %define info_server This kernel is compiled for server use, single or \
991 multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using \
992 no preempt, HZ_100, CFS cpu scheduler and cfq i/o scheduler.
993 %else
994 %define summary_server Linux Kernel for server use with %{_arch}
995 %define info_server This kernel is compiled for server use, single or \
996 multiple %{_arch} processor(s)/core(s), using no preempt, HZ_100, \
997 CFS cpu scheduler and cfq i/o scheduler.
998 %endif
999 %mkflavour server
1000 %endif
1001
1002 #
1003 # kernel-source
1004 #
1005 %if %build_source
1006 %package -n %{kname}-source-%{buildrel}
1007 Version: %{fakever}
1008 Release: %{fakerel}
1009 Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils
1010 Summary: The Linux source code for %{kname}-%{buildrel}
1011 Group: Development/Kernel
1012 Autoreqprov: no
1013 Provides: kernel-source = %{kverrel}
1014 Buildarch: noarch
1015
1016 %description -n %{kname}-source-%{buildrel}
1017 The %{kname}-source package contains the source code files for the Mageia
1018 kernel. Theese source files are only needed if you want to build your
1019 own custom kernel that is better tuned to your particular hardware.
1020
1021 If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...)
1022 drivers against, install the *-devel-* rpm that is matching your kernel.
1023
1024 #
1025 # kernel-source-latest: virtual rpm
1026 #
1027 %package -n %{kname}-source-latest
1028 Version: %{kversion}
1029 Release: %{rpmrel}
1030 Summary: Virtual rpm for latest %{kname}-source
1031 Group: Development/Kernel
1032 Requires: %{kname}-source-%{buildrel}
1033 Buildarch: noarch
1034
1035 %description -n %{kname}-source-latest
1036 This package is a virtual rpm that aims to make sure you always have the
1037 latest %{kname}-source installed...
1038 %endif
1039
1040 #
1041 # kernel-doc: documentation for the Linux kernel
1042 #
1043 %if %build_doc
1044 %package -n %{kname}-doc
1045 Version: %{kversion}
1046 Release: %{rpmrel}
1047 Summary: Various documentation bits found in the %{kname} source
1048 Group: Documentation
1049 Buildarch: noarch
1050
1051 %description -n %{kname}-doc
1052 This package contains documentation files from the %{kname} source.
1053 Various bits of information about the Linux kernel and the device drivers
1054 shipped with it are documented in these files. You also might want install
1055 this package if you need a reference to the options that can be passed to
1056 Linux kernel modules at load time.
1057 %endif
1058
1059 #
1060 # kernel userspace-headers
1061 #
1062 %if %{build_uheaders}
1063 %package -n %{kname}-userspace-headers
1064 Version: %{kversion}
1065 Release: %{rpmrel}
1066 Summary: Linux kernel header files for userspace
1067 Group: System/Kernel and hardware
1068 %rename linux-userspace-headers
1069 Provides: kernel-headers = 1:%{version}-%{release}
1070
1071 %description -n %{kname}-userspace-headers
1072 C header files from the Linux kernel. The header files define structures
1073 and constants that are needed for building most standard programs.
1074
1075 This package is not suitable for building kernel modules.
1076 %endif
1077
1078 #
1079 # kernel/tools
1080 #
1081 %if %{build_perf}
1082 %package -n perf
1083 Version: %{kversion}
1084 Release: %{rpmrel}
1085 Summary: perf tool and the supporting documentation
1086 Group: System/Kernel and hardware
1087
1088 %description -n perf
1089 the perf tool and the supporting documentation.
1090 %endif
1091
1092 %if %{build_cpupower}
1093 %package -n cpupower
1094 Version: %{kversion}
1095 Release: %{rpmrel}
1096 Summary: the cpupower tools
1097 Group: System/Kernel and hardware
1098 Requires(post): rpm-helper >= 0.24.8-1
1099 Requires(preun): rpm-helper >= 0.24.8-1
1100 Obsoletes: cpufreq cpufrequtils
1101
1102 %description -n cpupower
1103 the cpupower tools.
1104
1105 %post -n cpupower
1106 %_post_service cpupower
1107
1108 %preun -n cpupower
1109 %_preun_service cpupower
1110
1111 %package -n cpupower-devel
1112 Version: %{kversion}
1113 Release: %{rpmrel}
1114 Summary: devel files for cpupower
1115 Group: Development/Kernel
1116 Requires: cpupower = %{kversion}-%{rpmrel}
1117 Conflicts: %{_lib}cpufreq-devel
1118
1119 %description -n cpupower-devel
1120 This package contains the development files for cpupower.
1121 %endif
1122
1123 %if %{build_bpftool}
1124 %package -n bpftool
1125 Summary: Inspection and simple manipulation of eBPF programs and maps
1126 Group: System/Kernel and hardware
1127
1128 %description -n bpftool
1129 This package contains the bpftool, which allows inspection and simple
1130 manipulation of eBPF programs and maps.
1131 %endif
1132
1133 %if %{build_libbpf}
1134 %package -n %{_lib}bpf0
1135 Summary: The bpf library from kernel source
1136 Group: System/Libraries
1137
1138 %description -n %{_lib}bpf0
1139 This package contains the kernel source bpf library.
1140
1141 %package -n %{_lib}bpf-devel
1142 Summary: Developement files for the bpf library from kernel source
1143 Group: Development/Kernel
1144 Requires: %{_lib}bpf0
1145
1146 %description -n %{_lib}bpf-devel
1147 This package includes libraries and header files needed for development
1148 of applications which use bpf library from kernel source.
1149 %endif
1150
1151 #
1152 # End packages - here begins build stage
1153 #
1154 %prep
1155 %setup -q -n %top_dir_name -c
1156
1157 cd %src_dir
1158
1159 %autopatch -p1
1160
1161 # PATCH END
1162
1163 # breaks bpftool build on mga8
1164 patch -p1 -R <%{SOURCE100}
1165 # breaks cifs NTLL on mga8
1166 patch -p1 -R <%{SOURCE101}
1167
1168 #
1169 # Setup Begin
1170 #
1171
1172 # install x86 defconfigs
1173 install -m 644 %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} %{SOURCE15} arch/x86/configs/
1174 # install arm64 defconfigs
1175 install -m 644 %{SOURCE16} %{SOURCE17} arch/arm64/configs/
1176 # install arm defconfigs
1177 install -m 644 %{SOURCE18} arch/arm/configs/
1178
1179 # make sure the kernel has the sublevel we know it has...
1180 LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile
1181
1182 # get rid of unwanted files
1183 find . -name '*~' -o -name '*.orig' -o -name '*.append' | %kxargs rm -f
1184
1185 # fix missing exec flag on file introduced in 4.14.10-rc1
1186 chmod 755 tools/objtool/sync-check.sh
1187
1188 %build
1189 # Common target directories
1190 %define _kerneldir /usr/src/kernel-%{kversion}-%{buildrpmrel}
1191 %define _bootdir /boot
1192 %define _modulesdir /lib/modules
1193 %define _efidir %{_bootdir}/efi/mageia
1194
1195 # Directories definition needed for building
1196 %define temp_root %{build_dir}/temp-root
1197 %define temp_source %{temp_root}%{_kerneldir}
1198 %define temp_boot %{temp_root}%{_bootdir}
1199 %define temp_modules %{temp_root}%{_modulesdir}
1200
1201 PrepareKernel() {
1202 name=$1
1203 extension=$2
1204
1205 echo "Make config for kernel $extension"
1206
1207 %smake ARCH=%{target_arch} -s mrproper
1208
1209 if [ "%{target_arch}" == "i386" -o "%{target_arch}" == "x86_64" ]; then
1210 conf_dir=arch/x86/configs
1211 else
1212 conf_dir=arch/%{target_arch}/configs
1213 fi
1214 if [ -z "$name" ]; then
1215 cp $conf_dir/defconfig-%{target_arch}-desktop .config
1216 else
1217 cp $conf_dir/defconfig-%{target_arch}-$name .config
1218 fi
1219
1220 # make sure EXTRAVERSION says what we want it to say
1221 LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -$extension/" Makefile
1222
1223 %smake ARCH=%{target_arch} oldconfig
1224 }
1225
1226 BuildKernel() {
1227 KernelVer=$1
1228
1229 echo "Building kernel $KernelVer"
1230
1231 %kmake ARCH=%{target_arch} -s all
1232
1233 # Start installing stuff
1234 install -d %{temp_boot}
1235 install -m 644 System.map %{temp_boot}/System.map-$KernelVer
1236 install -m 644 .config %{temp_boot}/config-$KernelVer
1237 xz -c Module.symvers > %{temp_boot}/symvers-$KernelVer.xz
1238
1239 %ifarch %{arm}
1240 IMAGE=zImage
1241 %else
1242 %ifarch aarch64
1243 IMAGE=Image.gz
1244 %else
1245 IMAGE=bzImage
1246 %endif
1247 %endif
1248 cp -f arch/%{target_arch}/boot/$IMAGE %{temp_boot}/vmlinuz-$KernelVer
1249
1250 %ifarch %{arm} aarch64
1251 install -d %{temp_root}%{_libdir}/linux-$KernelVer/
1252 find arch/%{target_arch}/boot/dts/ -name *.dtb -execdir install -D -m644 {} %{temp_root}%{_libdir}/linux-$KernelVer/{} \;
1253 %endif
1254
1255 # modules
1256 install -d %{temp_modules}/$KernelVer
1257 %smake ARCH=%{target_arch} INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=$KernelVer modules_install
1258 }
1259
1260 SaveDevel() {
1261 devel_flavour=$1
1262
1263 DevelRoot=/usr/src/kernel-%{kversion}-$devel_flavour-%{buildrpmrel}
1264 TempDevelRoot=%{temp_root}$DevelRoot
1265
1266 mkdir -p $TempDevelRoot
1267 for i in $(find . -name 'Makefile*'); do cp -R --parents $i $TempDevelRoot;done
1268 for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*'); do cp -R --parents $i $TempDevelRoot;done
1269 cp -fR include $TempDevelRoot
1270 cp -fR scripts $TempDevelRoot
1271 cp -fR kernel/bounds.c $TempDevelRoot/kernel
1272 cp -fR tools/include $TempDevelRoot/tools/
1273 # needed for selinux
1274 cp -R --parents security/selinux/include/*.h $TempDevelRoot
1275 %ifarch %{arm}
1276 cp -fR arch/%{target_arch}/tools $TempDevelRoot/arch/%{target_arch}/
1277 cp -fR arch/%{target_arch}/kernel/signal.h $TempDevelRoot/arch/%{target_arch}/kernel/
1278 %endif
1279 %ifarch aarch64
1280 cp -fR arch/x86/entry/syscalls/syscall_32.tbl $TempDevelRoot/arch/x86/entry/syscalls/
1281 cp -fR arch/arm64/kernel/vdso/*.{S,sh} $TempDevelRoot/arch/arm64/kernel/vdso/
1282 cp -fR arch/arm64/kernel/vdso/vgettimeofday.c $TempDevelRoot/arch/arm64/kernel/vdso/
1283 cp -fR arch/arm64/tools/{cpucaps,gen-cpucaps.awk} $TempDevelRoot/arch/arm64/tools/
1284 # aarch64 build wants x86 syscall tables
1285 cp -fR arch/x86/entry/syscalls/syscall_{32,64}.tbl $TempDevelRoot/arch/x86/entry/syscalls/
1286 cp -fR lib/vdso/gettimeofday.c $TempDevelRoot/lib/vdso/
1287 %endif
1288 %ifarch %{ix86} x86_64
1289 cp -fR arch/x86/kernel/asm-offsets.{c,s} $TempDevelRoot/arch/x86/kernel/
1290 cp -fR arch/x86/kernel/asm-offsets_{32,64}.c $TempDevelRoot/arch/x86/kernel/
1291 cp -fR arch/x86/lib/insn.c $TempDevelRoot/arch/x86/lib/
1292 cp -fR arch/x86/purgatory/* $TempDevelRoot/arch/x86/purgatory/
1293 cp -fR arch/x86/entry/syscalls/syscall* $TempDevelRoot/arch/x86/entry/syscalls/
1294 cp -fR arch/x86/include $TempDevelRoot/arch/x86/
1295 cp -fR arch/x86/tools $TempDevelRoot/arch/x86/
1296 %else
1297 cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} $TempDevelRoot/arch/%{target_arch}/kernel/
1298 for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f $TempDevelRoot; done
1299 %endif
1300 cp -fR .config Module.symvers $TempDevelRoot
1301
1302 # Needed for truecrypt build (Danny)
1303 cp -fR drivers/md/dm.h $TempDevelRoot/drivers/md/
1304
1305 # needed by include/generated/timeconst.h
1306 cp -fR kernel/time/timeconst.bc $TempDevelRoot/kernel/time/
1307
1308 # Needed for lirc_gpio (#39004)
1309 cp -fR drivers/media/pci/bt8xx/bttv{,p}.h $TempDevelRoot/drivers/media/pci/bt8xx/
1310 cp -fR drivers/media/pci/bt8xx/bt848.h $TempDevelRoot/drivers/media/pci/bt8xx/
1311 cp -fR drivers/media/common/btcx-risc.h $TempDevelRoot/drivers/media/common/
1312
1313 # aufs has a special file needed
1314 cp -fR fs/aufs/magic.mk $TempDevelRoot/fs/aufs/
1315
1316 # rtl8821ce has special files needed
1317 cp -fR 3rdparty/rtl8821ce/halmac.mk $TempDevelRoot/3rdparty/rtl8821ce/
1318 cp -fR 3rdparty/rtl8821ce/rtl8821c.mk $TempDevelRoot/3rdparty/rtl8821ce/
1319 mkdir -p $TempDevelRoot/3rdparty/rtl8821ce/hal/phydm/
1320 cp -fR 3rdparty/rtl8821ce/hal/phydm/phydm.mk $TempDevelRoot/3rdparty/rtl8821ce/hal/phydm/
1321 mkdir -p $TempDevelRoot/3rdparty/rtl8812au/hal/phydm/
1322 cp -fR 3rdparty/rtl8812au/hal/phydm/phydm.mk $TempDevelRoot/3rdparty/rtl8812au/hal/phydm/
1323
1324 %ifarch x86_64
1325 # orc unwinder needs theese
1326 cp -fR tools/build/Build{,.include} $TempDevelRoot/tools/build
1327 cp -fR tools/build/fixdep.c $TempDevelRoot/tools/build
1328 cp -fR tools/lib/{rbtree.c,ctype.c,str_error_r.c,string.c} $TempDevelRoot/tools/lib
1329 cp -fR tools/lib/subcmd/* $TempDevelRoot/tools/lib/subcmd
1330 cp -fR tools/objtool/* $TempDevelRoot/tools/objtool
1331 cp -fR tools/scripts/utilities.mak $TempDevelRoot/tools/scripts
1332 mkdir -p $TempDevelRoot/tools/arch/x86/tools
1333 cp -fR tools/arch/x86/tools/gen-insn-attr-x86.awk $TempDevelRoot/tools/arch/x86/tools/
1334 mkdir -p $TempDevelRoot/tools/arch/x86/lib
1335 cp -fR tools/arch/x86/lib/{inat.c,insn.c,x86-opcode-map.txt} $TempDevelRoot/tools/arch/x86/lib/
1336 mkdir -p $TempDevelRoot/tools/arch/x86/include/asm
1337 cp -fR tools/arch/x86/include/asm/{asm.h,emulate_prefix.h,inat.h,inat_types.h,insn.h,nops.h,orc_types.h} $TempDevelRoot/tools/arch/x86/include/asm/
1338 %endif
1339
1340 for i in alpha arc avr32 blackfin c6x cris csky frv h8300 hexagon ia64 m32r m68k m68knommu metag microblaze \
1341 mips mn10300 nds32 nios2 openrisc parisc powerpc riscv s390 score sh sparc tile unicore32 xtensa; do
1342 rm -rf $TempDevelRoot/arch/$i
1343 rm -rf $TempDevelRoot/scripts/dtc/include-prefixes/$i
1344 rm -rf $TempDevelRoot/tools/arch/$i
1345 done
1346
1347 %ifnarch %{arm} aarch64
1348 rm -rf $TempDevelRoot/arch/arm*
1349 rm -rf $TempDevelRoot/include/kvm/arm*
1350 rm -rf $TempDevelRoot/include/soc
1351 rm -rf $TempDevelRoot/scripts/dtc/include-prefixes/arm*
1352 rm -rf $TempDevelRoot/tools/arch/arm*
1353 %endif
1354 %ifnarch %{ix86} x86_64
1355 rm -rf $TempDevelRoot/arch/x86
1356 rm -rf $TempDevelRoot/tools/arch/x86
1357 # arch/x86/ras/Kconfig is included by drivers/ras/Kconfig
1358 # and kconfig's source command seems to be evaluated even under a false conditional
1359 mkdir -p $TempDevelRoot/arch/x86/ras
1360 cp -fR arch/x86/ras/Kconfig $TempDevelRoot/arch/x86/ras
1361 %endif
1362
1363 # Clean the scripts tree, and make sure everything is ok (sanity check)
1364 # running prepare+scripts (tree was already "prepared" in build)
1365 pushd $TempDevelRoot >/dev/null
1366 %smake ARCH=%{target_arch} -s prepare scripts
1367 %smake ARCH=%{target_arch} -s clean
1368 popd >/dev/null
1369 rm -f $TempDevelRoot/.config.old
1370
1371 # fix permissions
1372 chmod -R a+rX $TempDevelRoot
1373
1374 # disable mrproper in -devel rpms
1375 patch -p1 --fuzz=0 -d $TempDevelRoot -i %{SOURCE2}
1376
1377 kernel_devel_files=../kernel_devel_files.$devel_flavour
1378
1379
1380 ### Create the kernel_devel_files.*
1381 cat > $kernel_devel_files <<EOF
1382 %dir $DevelRoot
1383 %dir $DevelRoot/arch
1384 %dir $DevelRoot/include
1385 $DevelRoot/3rdparty
1386 $DevelRoot/Documentation
1387 %ifarch %{arm} aarch64
1388 $DevelRoot/arch/arm
1389 $DevelRoot/arch/arm64
1390 %endif
1391 $DevelRoot/arch/um
1392 %ifarch %{ix86} x86_64
1393 $DevelRoot/arch/x86
1394 %else
1395 $DevelRoot/arch/x86/ras
1396 %endif
1397 $DevelRoot/block
1398 $DevelRoot/certs
1399 $DevelRoot/crypto
1400 $DevelRoot/drivers
1401 $DevelRoot/fs
1402 $DevelRoot/include/acpi
1403 $DevelRoot/include/asm-generic
1404 $DevelRoot/include/clocksource
1405 $DevelRoot/include/config
1406 $DevelRoot/include/crypto
1407 $DevelRoot/include/drm
1408 $DevelRoot/include/dt-bindings
1409 $DevelRoot/include/generated
1410 $DevelRoot/include/keys
1411 $DevelRoot/include/kunit
1412 $DevelRoot/include/kvm
1413 $DevelRoot/include/linux
1414 $DevelRoot/include/math-emu
1415 $DevelRoot/include/media
1416 $DevelRoot/include/memory
1417 $DevelRoot/include/misc
1418 $DevelRoot/include/net
1419 $DevelRoot/include/pcmcia
1420 $DevelRoot/include/ras
1421 $DevelRoot/include/rdma
1422 $DevelRoot/include/scsi
1423 %ifarch %{arm} aarch64
1424 $DevelRoot/include/soc
1425 %endif
1426 $DevelRoot/include/sound
1427 $DevelRoot/include/target
1428 $DevelRoot/include/trace
1429 $DevelRoot/include/uapi
1430 $DevelRoot/include/vdso/*.h
1431 $DevelRoot/include/video
1432 $DevelRoot/include/xen
1433 $DevelRoot/init
1434 $DevelRoot/ipc
1435 $DevelRoot/kernel
1436 $DevelRoot/lib
1437 $DevelRoot/mm
1438 $DevelRoot/net
1439 $DevelRoot/samples
1440 $DevelRoot/scripts
1441 $DevelRoot/security
1442 $DevelRoot/sound
1443 $DevelRoot/tools
1444 $DevelRoot/usr
1445 $DevelRoot/virt
1446 $DevelRoot/.config
1447 $DevelRoot/Kbuild
1448 $DevelRoot/Kconfig
1449 $DevelRoot/Makefile
1450 $DevelRoot/Module.symvers
1451 $DevelRoot/arch/Kconfig
1452 %doc README.kernel-sources
1453 EOF
1454
1455
1456 ### Create -devel Post script on the fly
1457 cat > $kernel_devel_files-post <<EOF
1458 if [ -d /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel} ]; then
1459 rm -f /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/{build,source}
1460 ln -sf $DevelRoot /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/build
1461 ln -sf $DevelRoot /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/source
1462 fi
1463 EOF
1464
1465
1466 ### Create -devel Preun script on the fly
1467 cat > $kernel_devel_files-preun <<EOF
1468 if [ -L /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/build ]; then
1469 rm -f /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/build
1470 fi
1471 if [ -L /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/source ]; then
1472 rm -f /lib/modules/%{kversion}-$devel_flavour-%{buildrpmrel}/source
1473 fi
1474 exit 0
1475 EOF
1476
1477 ### Create -devel Postun script on the fly
1478 cat > $kernel_devel_files-postun <<EOF
1479 rm -rf /usr/src/kernel-%{kversion}-$devel_flavour-%{buildrpmrel} >/dev/null
1480 EOF
1481 }
1482
1483 SaveDebug() {
1484 debug_flavour=$1
1485
1486 install -m 644 vmlinux \
1487 %{temp_boot}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel}
1488 kernel_debug_files=../kernel_debug_files.$debug_flavour
1489 echo "%{_bootdir}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel}" \
1490 >> $kernel_debug_files
1491
1492 find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \
1493 -name "*.ko" | \
1494 %kxargs -I '{}' objcopy --only-keep-debug '{}' '{}'.debug
1495 find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \
1496 -name "*.ko" | %kxargs -I '{}' \
1497 sh -c 'cd `dirname {}`; \
1498 objcopy --add-gnu-debuglink=`basename {}`.debug \
1499 --strip-debug `basename {}`'
1500
1501 pushd %{temp_modules}
1502 find %{kversion}-$debug_flavour-%{buildrpmrel}/kernel \
1503 -name "*.ko.debug" > debug_module_list
1504 popd
1505 cat %{temp_modules}/debug_module_list | \
1506 sed 's|\(.*\)|%{_modulesdir}/\1|' >> $kernel_debug_files
1507 cat %{temp_modules}/debug_module_list | \
1508 sed 's|\(.*\)|%exclude %{_modulesdir}/\1|' \
1509 >> ../kernel_exclude_debug_files.$debug_flavour
1510 rm -f %{temp_modules}/debug_module_list
1511 }
1512
1513 CreateFiles() {
1514 kernel_flavour=$1
1515
1516 kernel_files=../kernel_files.$kernel_flavour
1517
1518 ker="vmlinuz"
1519 ### Create the kernel_files.*
1520 cat > $kernel_files <<EOF
1521 %{_bootdir}/System.map-%{kversion}-$kernel_flavour-%{buildrpmrel}
1522 %{_bootdir}/symvers-%{kversion}-$kernel_flavour-%{buildrpmrel}.xz
1523 %{_bootdir}/config-%{kversion}-$kernel_flavour-%{buildrpmrel}
1524 %{_bootdir}/$ker-%{kversion}-$kernel_flavour-%{buildrpmrel}
1525 %dir %{_modulesdir}/%{kversion}-$kernel_flavour-%{buildrpmrel}/
1526 %{_modulesdir}/%{kversion}-$kernel_flavour-%{buildrpmrel}/kernel
1527 %{_modulesdir}/%{kversion}-$kernel_flavour-%{buildrpmrel}/modules.*
1528 %doc README.kernel-sources
1529 %ifarch %arm aarch64
1530 %dir %{_libdir}/linux-%{kversion}-$kernel_flavour-%{buildrpmrel}
1531 %{_libdir}/linux-%{kversion}-$kernel_flavour-%{buildrpmrel}/*.dtb
1532 %endif
1533 EOF
1534
1535 %if %build_debug
1536 cat ../kernel_exclude_debug_files.$kernel_flavour >> $kernel_files
1537 %endif
1538
1539 ### Create kernel Posttrans script
1540 cat > $kernel_files-posttrans <<EOF
1541 %if %build_devel
1542 # create kernel-devel symlinks if matching -devel- rpm is installed
1543 if [ -d /usr/src/kernel-%{kversion}-$kernel_flavour-%{buildrpmrel} ]; then
1544 ln -sf /usr/src/kernel-%{kversion}-$kernel_flavour-%{buildrpmrel} /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/build
1545 ln -sf /usr/src/kernel-%{kversion}-$kernel_flavour-%{buildrpmrel} /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel}/source
1546 fi
1547 %endif
1548 if [ -z "$DURING_INSTALL" ] ; then
1549 if [ -x /usr/sbin/dkms_autoinstaller -a -d /usr/src/kernel-%{kversion}-$kernel_flavour-%{buildrpmrel} ]; then
1550 /usr/sbin/dkms_autoinstaller start %{kversion}-$kernel_flavour-%{buildrpmrel}
1551 fi
1552 fi
1553 /sbin/installkernel %{kversion}-$kernel_flavour-%{buildrpmrel}
1554 pushd /boot > /dev/null
1555 if [ -e initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img ]; then
1556 ln -sf vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel} vmlinuz-$kernel_flavour
1557 ln -sf vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel} vmlinuz
1558 ln -sf initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img initrd-$kernel_flavour.img
1559 ln -sf initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img initrd.img
1560 fi
1561 popd > /dev/null
1562 EOF
1563
1564 ### Create kernel Postun script on the fly
1565 cat > $kernel_files-postun <<EOF
1566 pushd /boot > /dev/null
1567 if [ -f "vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel}" ]; then
1568 echo "The kernel is still installed in postun, probably a reinstall, skipping cleanup." >&2
1569 exit
1570 fi
1571 if [ -L vmlinuz-$kernel_flavour ]; then
1572 if [ "$(readlink vmlinuz-$kernel_flavour)" = "vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel}" ]; then
1573 rm -f vmlinuz-$kernel_flavour
1574 fi
1575 fi
1576 if [ -L initrd-$kernel_flavour.img ]; then
1577 if [ "$(readlink initrd-$kernel_flavour.img)" = "initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img" ]; then
1578 rm -f initrd-$kernel_flavour.img
1579 fi
1580 fi
1581 popd > /dev/null
1582 rm -rf /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel} >/dev/null
1583 /sbin/kernel_remove_initrd %{kversion}-$kernel_flavour-%{buildrpmrel}
1584 /sbin/installkernel -R %{kversion}-$kernel_flavour-%{buildrpmrel}
1585 if [ -d /var/lib/dkms ]; then
1586 rm -f /var/lib/dkms/*/kernel-%{kversion}-$devel_flavour-%{buildrpmrel}-%{_target_cpu} >/dev/null
1587 rm -rf /var/lib/dkms/*/*/%{kversion}-$devel_flavour-%{buildrpmrel} >/dev/null
1588 rm -f /var/lib/dkms-binary/*/kernel-%{kversion}-$devel_flavour-%{buildrpmrel}-%{_target_cpu} >/dev/null
1589 rm -rf /var/lib/dkms-binary/*/*/%{kversion}-$devel_flavour-%{buildrpmrel} >/dev/null
1590 fi
1591 EOF
1592 }
1593
1594
1595 CreateKernel() {
1596 flavour=$1
1597
1598 PrepareKernel $flavour $flavour-%{buildrpmrel}
1599
1600 BuildKernel %{kversion}-$flavour-%{buildrpmrel}
1601 %if %build_devel
1602 SaveDevel $flavour
1603 %endif
1604 %if %build_debug
1605 SaveDebug $flavour
1606 %endif
1607 CreateFiles $flavour
1608 }
1609
1610
1611 ###
1612 # DO it...
1613 ###
1614
1615
1616 # Create a simulacro of buildroot
1617 rm -rf %{temp_root}
1618 install -d %{temp_root}
1619
1620
1621 # make sure we are in the directory
1622 cd %src_dir
1623
1624 %ifarch %{ix86}
1625 %if %build_desktop586
1626 CreateKernel desktop586
1627 %endif
1628 %endif
1629
1630 %if %build_desktop
1631 CreateKernel desktop
1632 %endif
1633
1634 %if %build_server
1635 CreateKernel server
1636 %endif
1637
1638 # set extraversion to match srpm to get nice version reported by the tools
1639 LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{rpmrel}/" Makefile
1640
1641 # build perf
1642 %if %{build_perf}
1643 # perf
1644 %smake -s -C tools/perf NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 \
1645 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 NO_JVMTI=1 prefix=%{_prefix} lib=%{_lib} all
1646 %smake -C tools/perf -s prefix=%{_prefix} man
1647 %endif
1648
1649 %if %{build_cpupower}
1650 # cpupower
1651 # make sure version-gen.sh is executable.
1652 chmod +x tools/power/cpupower/utils/version-gen.sh
1653 %make_build -C tools/power/cpupower CPUFREQ_BENCH=false
1654 %endif
1655
1656 # build bpftool
1657 %if %{build_bpftool}
1658 pushd tools/bpf/bpftool
1659 make
1660 popd
1661 %endif
1662
1663 # build libbpf
1664 %if %{build_libbpf}
1665 pushd tools/lib/bpf
1666 make V=1
1667 popd
1668 %endif
1669
1670 # We don't make to repeat the depend code at the install phase
1671 %if %build_source
1672 PrepareKernel "" %{buildrpmrel}custom
1673 %smake ARCH=%{target_arch} -s mrproper
1674 %endif
1675
1676
1677 ###
1678 ### install
1679 ###
1680 %install
1681 install -m 644 %{SOURCE4} .
1682
1683 cd %src_dir
1684
1685 # Directories definition needed for installing
1686 %define target_source %{buildroot}%{_kerneldir}
1687 %define target_boot %{buildroot}%{_bootdir}
1688 %define target_modules %{buildroot}%{_modulesdir}
1689 %define target_headers %{buildroot}%{_prefix}
1690
1691 # We want to be able to test several times the install part
1692 rm -rf %{buildroot}
1693 cp -a %{temp_root} %{buildroot}
1694
1695 # Create directories infastructure
1696 %if %build_source
1697 install -d %{target_source}
1698
1699 tar cf - . | tar xf - -C %{target_source}
1700 chmod -R a+rX %{target_source}
1701
1702 # we remove all the source files that we don't ship
1703 # first architecture files
1704 for i in alpha arc avr32 blackfin c6x cris csky frv h8300 hexagon ia64 m32r m68k m68knommu metag microblaze \
1705 mips nds32 nios2 openrisc parisc powerpc riscv s390 score sh sh64 sparc tile unicore32 v850 xtensa mn10300; do
1706 rm -rf %{target_source}/arch/$i
1707 rm -rf %{target_source}/scripts/dtc/include-prefixes/$i
1708 rm -rf %{target_source}/tools/arch/$i
1709 rm -rf %{target_source}/tools/testing/selftests/$i
1710 done
1711 %ifnarch %{arm} aarch64
1712 rm -rf %{target_source}/include/kvm/arm*
1713 rm -rf %{target_source}/scripts/dtc/include-prefixes/arm*
1714 rm -rf %{target_source}/tools/arch/arm*
1715 %endif
1716
1717 # other misc files
1718 rm -f %{target_source}/{.clang-format,.config.old,.config.cmd,.lst,.mailmap,.get_maintainer.ignore}
1719 rm -f %{target_source}/{.missing-syscalls.d,.cocciconfig,.gitattributes}
1720 rm -rf %{target_source}/.tmp_depmod/
1721
1722 # more cleaning
1723 pushd %{target_source}
1724 # lots of gitignore files
1725 find -iname ".gitignore" -delete
1726 # clean tools tree
1727 %smake -C tools clean
1728 %smake -C tools/build clean
1729 %smake -C tools/build/feature clean
1730 # dont ship generated vdso.so*
1731 %ifarch aarch64
1732 rm -f arch/arm64/kernel/vdso/vdso.so*
1733 %endif
1734 popd
1735
1736 # nuke last as it gets re-created
1737 rm -f %{target_source}/.cache.mk
1738
1739 #endif %build_source
1740 %endif
1741
1742 # compressing modules
1743 %if %{build_modxz}
1744 find %{target_modules} -name "*.ko" | %kxargs xz -6
1745 %else
1746 find %{target_modules} -name "*.ko" | %kxargs gzip -9
1747 %endif
1748
1749 # We used to have a copy of PrepareKernel here
1750 # Now, we make sure that the thing in the linux dir is what we want it to be
1751 for i in %{target_modules}/*; do
1752 rm -f $i/build $i/source
1753 done
1754
1755 # sniff, if we compressed all the modules, we change the stamp :(
1756 # we really need the depmod -ae here
1757 pushd %{target_modules}
1758 for i in *; do
1759 /sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i
1760 echo $?
1761 done
1762
1763 for i in *; do
1764 pushd $i
1765 echo "Creating modules.description for $i"
1766 modules=`find . -name "*.ko.[g,x]z"`
1767 echo $modules | xargs /sbin/modinfo \
1768 | perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description
1769 popd
1770 done
1771 popd
1772
1773 # need to set extraversion to match srpm again to avoid rebuild
1774 LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{rpmrel}/" Makefile
1775
1776 # install userspace-headers
1777 %if %{build_uheaders}
1778 %smake ARCH=%{target_arch} headers_install INSTALL_HDR_PATH=%{target_headers}
1779 # for drakx
1780 cp include/linux/pci_ids.h %{target_headers}/include/linux/
1781 %endif
1782
1783 %if %{build_perf}
1784 # perf tool binary and supporting scripts/binaries
1785 %smake -s -C tools/perf V=1 DESTDIR=%{buildroot} NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 \
1786 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 NO_JVMTI=1 prefix=%{_prefix} lib=%{_lib} install
1787
1788 # perf man pages (note: implicit rpm magic compresses them later)
1789 make -C tools/perf V=1 DESTDIR=%{buildroot} prefix=%{_prefix} install-man
1790
1791 # remove perf files we dont ship
1792 rm -rf %{buildroot}/usr/lib/perf/examples
1793 rm -rf %{buildroot}/usr/lib/perf/include/bpf
1794 rm -rf %{buildroot}/usr/include/perf/perf_dlfilter.h
1795 %endif
1796
1797 %if %{build_cpupower}
1798 make -C tools/power/cpupower DESTDIR=%{buildroot} libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
1799 rm -f %{buildroot}%{_libdir}/*.{a,la}
1800 %find_lang cpupower
1801 mv cpupower.lang ../
1802 chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
1803 mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
1804 install -m644 %{SOURCE50} %{buildroot}%{_unitdir}/cpupower.service
1805 install -m644 %{SOURCE51} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
1806 %endif
1807
1808 # install bpftool
1809 %if %{build_bpftool}
1810 pushd tools/bpf/bpftool
1811 make DESTDIR=%{buildroot} prefix=%{_prefix} bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install doc-install
1812 popd
1813 %endif
1814
1815 # install libbpf
1816 %if %{build_libbpf}
1817 pushd tools/lib/bpf
1818 make DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir} V=1 install install_headers
1819 popd
1820 %endif
1821
1822 ###
1823 ### clean
1824 ###
1825 %clean
1826 rm -rf %{buildroot}
1827
1828
1829 # We don't want to remove this, the whole reason of its existence is to be
1830 # able to do several rpm --short-circuit -bi for testing install
1831 # phase without repeating compilation phase
1832 #rm -rf %{temp_root}
1833
1834 ###
1835 ### source and doc file lists
1836 ###
1837
1838 %if %build_source
1839 %files -n %{kname}-source-%{buildrel}
1840 %doc %{_kerneldir}/LICENSES
1841 %dir %{_kerneldir}
1842 %dir %{_kerneldir}/arch
1843 %dir %{_kerneldir}/include
1844 %{_kerneldir}/3rdparty
1845 %{_kerneldir}/Documentation
1846 %{_kerneldir}/arch/Kconfig
1847 %{_kerneldir}/arch/arm
1848 %{_kerneldir}/arch/arm64
1849 %{_kerneldir}/arch/um
1850 %{_kerneldir}/arch/x86
1851 %{_kerneldir}/block
1852 %{_kerneldir}/certs
1853 %{_kerneldir}/crypto
1854 %{_kerneldir}/drivers
1855 %{_kerneldir}/fs
1856 %{_kerneldir}/include/acpi
1857 %{_kerneldir}/include/asm-generic
1858 %{_kerneldir}/include/clocksource
1859 %{_kerneldir}/include/crypto
1860 %{_kerneldir}/include/drm
1861 %{_kerneldir}/include/dt-bindings
1862 %{_kerneldir}/include/keys
1863 %{_kerneldir}/include/kunit
1864 %{_kerneldir}/include/kvm
1865 %{_kerneldir}/include/linux
1866 %{_kerneldir}/include/math-emu
1867 %{_kerneldir}/include/media
1868 %{_kerneldir}/include/memory
1869 %{_kerneldir}/include/misc
1870 %{_kerneldir}/include/net
1871 %{_kerneldir}/include/pcmcia
1872 %{_kerneldir}/include/ras
1873 %{_kerneldir}/include/rdma
1874 %{_kerneldir}/include/scsi
1875 %{_kerneldir}/include/soc
1876 %{_kerneldir}/include/sound
1877 %{_kerneldir}/include/target
1878 %{_kerneldir}/include/trace
1879 %{_kerneldir}/include/uapi
1880 %{_kerneldir}/include/vdso/*.h
1881 %{_kerneldir}/include/video
1882 %{_kerneldir}/include/xen
1883 %{_kerneldir}/init
1884 %{_kerneldir}/ipc
1885 %{_kerneldir}/kernel
1886 %{_kerneldir}/lib
1887 %{_kerneldir}/mm
1888 %{_kerneldir}/net
1889 %{_kerneldir}/virt
1890 %{_kerneldir}/samples
1891 %{_kerneldir}/scripts
1892 %{_kerneldir}/security
1893 %{_kerneldir}/sound
1894 %{_kerneldir}/tools
1895 %{_kerneldir}/usr
1896 %{_kerneldir}/COPYING
1897 %{_kerneldir}/CREDITS
1898 %{_kerneldir}/Kbuild
1899 %{_kerneldir}/Kconfig
1900 %{_kerneldir}/MAINTAINERS
1901 %{_kerneldir}/Makefile
1902 %{_kerneldir}/README
1903 %doc README.kernel-sources
1904
1905 %files -n %{kname}-source-latest
1906 %endif
1907
1908 %if %build_doc
1909 %files -n %{kname}-doc
1910 %doc linux-%{tar_ver}/Documentation/*
1911 %endif
1912
1913 %if %build_uheaders
1914 %files -n %{kname}-userspace-headers
1915 %defattr(0644,root,root,0755)
1916 %{_includedir}/asm/
1917 %{_includedir}/asm-generic/
1918 %{_includedir}/drm/
1919 %{_includedir}/linux/
1920 %{_includedir}/misc/
1921 %{_includedir}/mtd/
1922 %{_includedir}/rdma/
1923 %{_includedir}/scsi/
1924 %{_includedir}/sound/
1925 %{_includedir}/video/
1926 %{_includedir}/xen/
1927 %endif
1928
1929 %if %{build_perf}
1930 %files -n perf
1931 %{_bindir}/perf
1932 %{_bindir}/trace
1933 %{_datadir}/perf-core/strace/groups/file
1934 %{_datadir}/perf-core/strace/groups/string
1935 %{_datadir}/doc/perf-tip/tips.txt
1936 %dir %{_libdir}/traceevent
1937 %dir %{_libdir}/traceevent/plugins
1938 %{_libdir}/traceevent/plugins/plugin_*
1939 %dir %{_prefix}/libexec/perf-core
1940 %{_prefix}/libexec/perf-core/*
1941 %{_mandir}/man[1-8]/perf*
1942 %{_sysconfdir}/bash_completion.d/perf
1943 %endif
1944
1945 %if %{build_cpupower}
1946 %files -n cpupower -f cpupower.lang
1947 %config(noreplace) %{_sysconfdir}/sysconfig/cpupower
1948 %{_bindir}/cpupower
1949 %{_datadir}/bash-completion/completions/cpupower
1950 %{_libdir}/libcpupower.so.0
1951 %{_libdir}/libcpupower.so.0.0.1
1952 %{_unitdir}/cpupower.service
1953 %{_mandir}/man[1-8]/cpupower*
1954
1955 %files -n cpupower-devel
1956 %{_libdir}/libcpupower.so
1957 %{_includedir}/cpuidle.h
1958 %{_includedir}/cpufreq.h
1959 %endif
1960
1961 %if %{build_bpftool}
1962 %files -n bpftool
1963 %{_sbindir}/bpftool
1964 %{_sysconfdir}/bash_completion.d/bpftool
1965 %{_mandir}/man8/bpftool-*.8*
1966 %{_mandir}/man8/bpftool.8*
1967 %endif
1968
1969 %if %{build_libbpf}
1970 %files -n %{_lib}bpf0
1971 %{_libdir}/libbpf.so.0
1972 %{_libdir}/libbpf.so.0.5.0
1973
1974 %files -n %{_lib}bpf-devel
1975 %{_libdir}/libbpf.a
1976 %{_libdir}/libbpf.so
1977 %{_libdir}/pkgconfig/libbpf.pc
1978 %{_includedir}/bpf/bpf.h
1979 %{_includedir}/bpf/bpf_core_read.h
1980 %{_includedir}/bpf/bpf_endian.h
1981 %{_includedir}/bpf/bpf_helper_defs.h
1982 %{_includedir}/bpf/bpf_helpers.h
1983 %{_includedir}/bpf/bpf_tracing.h
1984 %{_includedir}/bpf/btf.h
1985 %{_includedir}/bpf/libbpf.h
1986 %{_includedir}/bpf/libbpf_common.h
1987 %{_includedir}/bpf/libbpf_legacy.h
1988 %{_includedir}/bpf/skel_internal.h
1989 %{_includedir}/bpf/xsk.h
1990 %endif

  ViewVC Help
Powered by ViewVC 1.1.30