/
kernel-rc.spec
1952 lines (1736 loc) · 70.4 KB
/
kernel-rc.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# utils/cpuidle-info.c:193: error: undefined reference to 'cpufreq_cpu_exists'
# investigate aarch64
%define _binaries_in_noarch_packages_terminate_build 0
#end
%define _disable_ld_no_undefined 1
%ifarch %{aarch64}
# FIXME this is a workaround for some debug files being created
# but not making it to the debug file lists.
# This should be fixed properly...
%define _unpackaged_files_terminate_build 0
# (tpg) use LLVM/polly for polyhedra optimization and automatic vector code generation
# based on https://lore.kernel.org/lkml/20210120174146.12287-1-lazerl0rd@thezest.dev/
%define pollyflags %{nil}
#-mllvm -polly -mllvm -polly-run-dce -mllvm -polly-run-inliner -mllvm -polly-reschedule=1 -mllvm -polly-loopfusion-greedy=1 -mllvm -polly-postopts=1 -mllvm -polly-ast-use-context -mllvm -polly-detect-keep-going -mllvm -polly-vectorizer=stripmine -mllvm -polly-invariant-load-hoisting
%else
%define pollyflags %{nil}
%endif
## STOP: Adding weird and unsupported upstream kernel C/LD flags of any sort
## yes , including ftlo . O3 and whatever else
# Disable useless debug rpms as we generate our own debug package
%define _enable_debug_packages %{nil}
%define debug_package %{nil}
%global __debug_package %{nil}
%global __debug_install_post %{nil}
%global _build_id_links none
# Work around incomplete debug packages
%global _empty_manifest_terminate_build 0
%global cross_header_archs aarch64-linux armv7hnl-linux i686-linux x86_64-linux x32-linux riscv32-linux riscv64-linux aarch64-linuxmusl armv7hnl-linuxmusl i686-linuxmusl x86_64-linuxmusl x32-linuxmusl riscv32-linuxmusl riscv64-linuxmusl aarch64-android armv7l-android armv8l-android x86_64-android aarch64-linuxuclibc armv7hnl-linuxuclibc i686-linuxuclibc x86_64-linuxuclibc x32-linuxuclibc riscv32-linuxuclibc riscv64-linuxuclibc ppc64le-linux ppc64-linux ppc64le-linuxmusl ppc64-linuxmusl ppc64le-linuxuclibc ppc64-linuxuclibc loongarch64-linux loongarch64-linuxmusl loongarch64-linuxuclibc
%global long_cross_header_archs %(
for i in %{cross_header_archs}; do
CPU=$(echo $i |cut -d- -f1)
OS=$(echo $i |cut -d- -f2)
echo -n "$(rpm --target=${CPU}-${OS} -E %%{_target_platform}) "
done
)
# Parallelize xargs invocations on smp machines
%define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\
&& RPM_BUILD_NCPUS="$(/usr/bin/getconf _NPROCESSORS_ONLN)"; \\\
[ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS")
%define target_arch %(echo %{_arch} | sed -e 's/mips.*/mips/' -e 's/arm.*/arm/' -e 's/aarch64/arm64/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/znver1/x86/' -e 's/riscv.*/riscv/' -e 's/ppc.*/powerpc/')
# (tpg) define here per arch which kernel flavours you would like to build
%define kernel_flavours desktop server desktop-gcc server-gcc
# possible options are: desktop server desktop-gcc server-gcc
# (tpg) package these kernel modules as subpackages
%ifarch %{aarch64}
%define modules_subpackages appletalk decnet fddi can
%else
%define modules_subpackages appletalk arcnet comedi infiniband isdn can
%endif
# IMPORTANT
# This is the place where you set kernel version i.e 4.5.0
# compose tar.xz name and release
%define kernelversion 6
%define patchlevel 9
%define sublevel 0
%define relc 7
# Having different top level names for packges means that you have to remove
# them by hard :(
%define top_dir_name %{name}-%{_arch}
%define build_dir ${RPM_BUILD_DIR}/%{top_dir_name}
# Common target directories
%define _kerneldir %{_prefix}/src/linux-%{version}-%{release}%{disttag}
%define _bootdir /boot
# Should really be %{_prefix}/lib/modules, but there's a few hardcodes
# inside kernel Makefiles and it doesn't really matter given /lib is
# a symlink to %{_prefix}/lib anyway
%define _modulesdir /lib/modules
# Directories definition needed for building
%define temp_root %{build_dir}/temp-root
%define temp_source %{temp_root}%{_kerneldir}
%define temp_boot %{temp_root}%{_bootdir}
%define temp_modules %{temp_root}%{_modulesdir}
# Build defines
%bcond_with build_doc
%bcond_with uksm
%bcond_without build_source
%bcond_without build_devel
%bcond_without cross_headers
%bcond_with lazy_developer
%bcond_with build_debug
%bcond_without clr
%bcond_with vbox_orig_mods
# FIXME re-enable by default when the patches have been adapted to 5.8
%bcond_with saa716x
%bcond_with rtl8821ce
# build perf and cpupower tools
%if %{cross_compiling}
%bcond_with bpftool
%bcond_with perf
%else
%bcond_without bpftool
%bcond_without perf
%endif
%bcond_without build_x86_energy_perf_policy
%bcond_without build_turbostat
%ifarch %{ix86} %{x86_64} %{aarch64}
%bcond_without hyperv
%endif
%ifarch %{ix86} %{x86_64}
%bcond_without build_cpupower
%else
# cpupower is currently x86 only
%bcond_with build_cpupower
%endif
# End of user definitions
# For the .nosrc.rpm
%bcond_with build_nosrc
#
# SRC RPM description
#
Summary: Linux kernel built for %{distribution}
Name: kernel%{?relc:-rc}
Version: %{kernelversion}.%{patchlevel}%{?sublevel:.%{sublevel}}
Release: %{?relc:0.rc%{relc}.}3
License: GPLv2
Group: System/Kernel and hardware
ExclusiveArch: %{ix86} %{x86_64} %{armx} %{riscv}
ExclusiveOS: Linux
URL: http://www.kernel.org
####################################################################
#
# Sources
#
### This is for full SRC RPM
%if 0%{?relc:1}
Source0: https://git.kernel.org/torvalds/t/linux-%{kernelversion}.%{patchlevel}-rc%{relc}.tar.gz
%else
Source0: http://www.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{kernelversion}.%{patchlevel}.tar.xz
Source1: http://www.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{kernelversion}.%{patchlevel}.tar.sign
%endif
### This is for stripped SRC RPM
%if %{with build_nosrc}
NoSource: 0
%endif
Source3: README.kernel-sources
Source4: %{name}.rpmlintrc
## all in one configs for each kernel
Source10: x86-omv-defconfig
Source11: i386-omv-defconfig
Source12: arm-omv-defconfig
Source13: arm64-omv-defconfig
Source14: riscv-omv-defconfig
Source15: powerpc-omv-defconfig
Source16: loongarch-omv-defconfig
# Fragments to be used with all/multiple kernel types
Source20: filesystems.fragment
Source21: framer.fragment
Source22: debug.fragment
Source23: networking.fragment
# Overrides (highest priority) for configs
Source30: znver1.overrides
# config and systemd service file from fedora
Source300: cpupower.service
Source301: cpupower.config
# Patches
# Numbers 0 to 9 are reserved for upstream patches
# (-stable patch, -rc, ...)
# Added as a Source rather that Patch because it needs to be
# applied with "git apply" -- may contain binary patches.
# Patches to VirtualBox and other external modules are
# pulled in as Source: rather than Patch: because it's arch specific
# and can't be applied by %%autopatch -p1
%if 0%{?sublevel:%{sublevel}}
# The big upstream patch is added as source rather than patch
# because "git apply" is needed to handle binary patches it
# frequently contains (firmware updates etc.)
Source1000: https://cdn.kernel.org/pub/linux/kernel/v%(echo %{version}|cut -d. -f1).x/patch-%{version}.xz
%endif
# FIXME git bisect shows upstream commit
# 7a8b64d17e35810dc3176fe61208b45c15d25402 breaks
# booting SynQuacer from USB flash drives on old firmware
# 9d55bebd9816903b821a403a69a94190442ac043 builds on
# 7a8b64d17e35810dc3176fe61208b45c15d25402.
Source1001: revert-7a8b64d17e35810dc3176fe61208b45c15d25402.patch
Source1002: revert-9d55bebd9816903b821a403a69a94190442ac043.patch
Patch30: https://gitweb.gentoo.org/proj/linux-patches.git/plain/5010_enable-cpu-optimizations-universal.patch?h=6.7#/cpu-optimizations.patch
Patch31: die-floppy-die.patch
Patch32: 0001-Add-support-for-Acer-Predator-macro-keys.patch
Patch33: acer-wmi-Predator-PH18-71.patch
Patch34: kernel-5.6-kvm-gcc10.patch
Patch35: linux-6.7-BTF-deps.patch
# Work around rpm dependency generator screaming about
# error: Illegal char ']' (0x5d) in: 1.2.1[50983]_custom
# caused by aacraid versioning ("1.2.1[50983]-custom")
Patch36: aacraid-dont-freak-out-dependency-generator.patch
# Make uClibc-ng happy
Patch37: socket.h-include-bitsperlong.h.patch
# Make Nouveau work on SynQuacer (and probably all other non-x86 boards)
# FIXME this may need porting, not sure where WC is set in 5.10
#Patch38: kernel-5.8-nouveau-write-combining-only-on-x86.patch
Patch40: kernel-5.8-aarch64-gcc-10.2-workaround.patch
# (tpg) https://github.com/ClangBuiltLinux/linux/issues/1341
Patch42: linux-5.11-disable-ICF-for-CONFIG_UNWINDER_ORC.patch
# (tpg)
# The Ultra Kernel Same Page Deduplication
# http://kerneldedup.org/en/projects/uksm/download/
# sources can be found here https://github.com/dolohow/uksm
# Usually faster ports to new kernel releases can be found at
# https://github.com/sirlucjan/kernel-patches/tree/master/5.16/uksm-patches
%if %{with uksm}
Patch43: https://raw.githubusercontent.com/sirlucjan/kernel-patches/master/5.18/uksm-patches/0001-UKSM-for-5.18.patch
%endif
# (crazy) see: https://forum.openmandriva.org/t/nvme-ssd-m2-not-seen-by-omlx-4-0/2407
Patch45: Unknow-SSD-HFM128GDHTNG-8310B-QUIRK_NO_APST.patch
# Restore ACPI loglevels to sane values
Patch46: https://gitweb.frugalware.org/wip_kernel/raw/86234abea5e625043153f6b8295642fd9f42bff0/source/base/kernel/acpi-use-kern_warning_even_when_error.patch
Patch47: https://gitweb.frugalware.org/wip_kernel/raw/23f5e50042768b823e18613151cc81b4c0cf6e22/source/base/kernel/fix-acpi_dbg_level.patch
Patch51: linux-5.5-corsair-strafe-quirks.patch
Patch52: http://crazy.dev.frugalware.org/smpboot-no-stack-protector-for-gcc10.patch
Patch55: linux-5.16-clang-no-attribute-symver.patch
### Additional hardware support
### TV tuners:
# SAA716x DVB driver
# git clone git@github.com:crazycat69/linux_media
# cd linux_media
# tar cJf saa716x-driver.tar.xz drivers/media/pci/saa716x drivers/media/dvb-frontends/tas2101* drivers/media/dvb-frontends/isl6422* drivers/media/dvb-frontends/stv091x.h drivers/media/tuners/av201x* drivers/media/tuners/stv6120*
# Patches 141 to 145 are a minimal set of patches to the DVB stack to make
# the added driver work.
Source1003: saa716x-driver.tar.xz
Patch200: 0023-tda18212-Added-2-extra-options.-Based-on-CrazyCat-re.patch
Patch201: 0075-cx24117-Use-a-pointer-to-config-instead-of-storing-i.patch
Patch202: 0076-cx24117-Add-LNB-power-down-callback.-TBS6984-uses-pc.patch
#Patch203: 0124-Extend-FEC-enum.patch
Patch204: saa716x-driver-integration.patch
Patch205: saa716x-4.15.patch
Patch206: saa716x-linux-4.19.patch
Patch207: saa716x-5.4.patch
# Additional WiFi drivers taken from the Endless kernel
# git clone https://github.com/endlessm/linux.git
# cd linux
# tar cf extra-wifi-drivers-`date +%Y%m%d`.tar drivers/net/wireless/rtl8*
# zstd -19 extra-wifi-drivers*.tar
Source1004: extra-wifi-drivers-20200301.tar.zst
Patch208: extra-wifi-drivers-compile.patch
Patch209: extra-wifi-drivers-port-to-5.6.patch
# VirtualBox patches -- added as Source: rather than Patch:
# because they need to be applied after stuff from the
# virtualbox-kernel-module-sources package is copied around
Source1005: vbox-6.1-fix-build-on-znver1-hosts.patch
Source1007: vboxnet-clang.patch
Source1008: vboxvideo-kernel-6.3.patch
# EVDI Extensible Virtual Display Interface
# Needed by DisplayLink cruft
%define evdi_version 1.14.2
Source1010: https://github.com/DisplayLink/evdi/archive/refs/tags/v%{evdi_version}.tar.gz
# Assorted fixes
# Bring back ashmem -- anbox and waydroid still need it
Patch211: revert-721412ed3d819e767cac2b06646bf03aa158aaec.patch
# Modular binder and ashmem -- let's try to make anbox happy
Patch212: https://salsa.debian.org/kernel-team/linux/raw/master/debian/patches/debian/android-enable-building-ashmem-and-binder-as-modules.patch
Patch213: https://salsa.debian.org/kernel-team/linux/raw/master/debian/patches/debian/export-symbols-needed-by-android-drivers.patch
Patch214: ras-fix-build-without-debugfs.patch
Patch215: linux-5.19-prefer-amdgpu-over-radeon.patch
Patch217: acpi-chipset-workarounds-shouldnt-be-necessary-on-non-x86.patch
# Revert minimum power limit lock on amdgpu. If you bought a GPU, it means you own it at every level. That a power of Free Software,
# AMD cannot limit the right to own and prohibit people under volting/under power when they need it or when AMD cards are poorly designed to the point that they heat up, restart and cause very noisy operation.
Patch218: amdgpu-ignore-min-pcap.patch
# Imported from Nobara. Enable full AMD GPU controls like fan speed etc (needed for corectrl and others)
Patch219: https://raw.githubusercontent.com/Nobara-Project/rpm-sources/main/baseos/kernel/6.7.6/0001-Set-amdgpu.ppfeaturemask-0xffffffff-as-default.patch
# Fix CPU frequency governor mess caused by recent Intel patches
Patch225: https://gitweb.frugalware.org/frugalware-current/raw/50690405717979871bb17b8e6b553799a203c6ae/source/base/kernel/0001-Revert-cpufreq-Avoid-configuring-old-governors-as-de.patch
Patch226: https://gitweb.frugalware.org/frugalware-current/raw/50690405717979871bb17b8e6b553799a203c6ae/source/base/kernel/revert-parts-of-a00ec3874e7d326ab2dffbed92faddf6a77a84e9-no-Intel-NO.patch
# Fix perf
Patch230: linux-5.11-perf-compile.patch
#Patch231: ce71038e673ee8291c64631359e56c48c8616dc7.patch
# (tpg) Armbian ARM Patches
Patch240: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/board-rockpro64-fix-emmc.patch
Patch241: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/board-rockpro64-fix-spi1-flash-speed.patch
Patch242: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/board-rockpro64-work-led-heartbeat.patch
Patch243: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/general-fix-mmc-signal-voltage-before-reboot.patch
Patch244: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/general-fix-inno-usb2-phy-init.patch
Patch245: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/rk3399-unlock-temperature.patch
Patch246: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/general-increasing_DMA_block_memory_allocation_to_2048.patch
Patch247: https://raw.githubusercontent.com/armbian/build/main/patch/kernel/archive/rockchip64-6.5/general-rk808-configurable-switch-voltage-steps.patch
Patch248: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/rk3399-sd-drive-level-8ma.patch
Patch249: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/rk3399-pci-rockchip-support-ep-gpio-undefined-case.patch
Patch250: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/rk3399-enable-dwc3-xhci-usb-trb-quirk.patch
Patch251: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/add-rockchip-iep-driver.patch
Patch252: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/general-legacy-rockchip-hwrng.patch
Patch253: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/general-legacy-rockchip-hwrng_5.10.patch
Patch254: https://raw.githubusercontent.com/armbian/build/master/patch/kernel/archive/rockchip64-6.0/rk3399-rp64-rng.patch
# (tpg) Manjaro ARM Patches
#Patch260: https://gitlab.manjaro.org/manjaro-arm/packages/core/linux/-/raw/master/1005-panfrost-Silence-Panfrost-gem-shrinker-loggin.patch
# Other ARM64 patches
Patch261: https://raw.githubusercontent.com/immortalwrt/immortalwrt/master/target/linux/rockchip/patches-5.15/992-rockchip-rk3399-overclock-to-2.2-1.8-GHz.patch
# (tpg) patches taken from https://github.com/OpenMandrivaSoftware/os-image-builder/tree/master/device/rockchip/generic/kernel-patches
Patch300: add-board-orangepi-4.patch
Patch303: rk3399-add-sclk-i2sout-src-clock.patch
#Patch304: rtl8723cs-compile.patch
Patch305: kernel-6.0-rc2-perf-x86-compile.patch
#Patch306: linux-6.1-binutils-2.40.patch
# https://gitlab.freedesktop.org/drm/amd/-/issues/3343
Patch308: https://gitlab.freedesktop.org/drm/amd/uploads/5c1819cbc498fb75de7d4be7159cd5ca/0001-drm-amdgpu-fix-off-by-one-in-amdgpu_res_cpu_visible.patch
# V4L2 loopback
# https://github.com/umlaeute/v4l2loopback
Source400: https://raw.githubusercontent.com/umlaeute/v4l2loopback/main/v4l2loopback.c
Source401: https://raw.githubusercontent.com/umlaeute/v4l2loopback/main/v4l2loopback.h
Source402: https://raw.githubusercontent.com/umlaeute/v4l2loopback/main/v4l2loopback_formats.h
# Patches to external modules
# Marked SourceXXX instead of PatchXXX because the modules
# being touched aren't in the tree at the time %%autopatch -p1
# runs...
%if %{with clr}
# (tpg) some patches from ClearLinux
# https://github.com/clearlinux-pkgs/linux/
Patch900: 0101-i8042-decrease-debug-message-level-to-info.patch
Patch901: 0102-increase-the-ext4-default-commit-age.patch
Patch903: 0104-pci-pme-wakeups.patch
Patch904: 0105-ksm-wakeups.patch
#Patch905: 0106-intel_idle-tweak-cpuidle-cstates.patch
Patch907: 0108-smpboot-reuse-timer-calibration.patch
Patch908: 0109-initialize-ata-before-graphics.patch
Patch910: 0111-ipv4-tcp-allow-the-memory-tuning-for-tcp-to-go-a-lit.patch
Patch913: 0117-migrate-some-systemd-defaults-to-the-kernel-defaults.patch
Patch914: 0120-use-lfence-instead-of-rep-and-nop.patch
%endif
Autoreqprov: no
BuildRequires: zstd
BuildRequires: findutils
BuildRequires: bc
BuildRequires: flex
BuildRequires: bison
BuildRequires: binutils
BuildRequires: hostname
BuildRequires: clang
BuildRequires: llvm
BuildRequires: lld
BuildRequires: pkgconfig(libcap)
BuildRequires: pkgconfig(libssl)
BuildRequires: diffutils
# For git apply
BuildRequires: git-core
# For power tools
BuildRequires: pkgconfig(ncurses)
BuildRequires: pkgconfig(libkmod)
# For sign-file
BuildRequires: pkgconfig(openssl)
BuildRequires: openssl
%ifarch %{x86_64} %{aarch64}
BuildRequires: pkgconfig(numa)
%endif
# for cpupower
%if %{with build_cpupower}
# As of 6.6-rc5, cpupower's FR translation uses iso-8859-1
BuildRequires: locales-extra-charsets
BuildRequires: pkgconfig(libpci)
%endif
# (Unconditional because it's small and may also be used by other tools)
BuildRequires: gettext
%if %{with build_turbostat}
BuildRequires: pkgconfig(libpcap)
%endif
# for docs
%if %{with build_doc}
BuildRequires: xmlto
%endif
# for ORC unwinder and perf
BuildRequires: pkgconfig(libelf)
%if %{with bpftool}
# for bpf
BuildRequires: pahole
%endif
# for perf
%if %{with perf}
# The Makefile prefers python2, python3, python in that
# order. Unless and until we fix that, make sure we use
# the right version by conflicting with the other.
BuildConflicts: python2
BuildRequires: asciidoc
BuildRequires: xmlto
BuildRequires: pkgconfig(audit)
BuildRequires: binutils-devel
BuildRequires: bison
BuildRequires: flex
BuildRequires: pkgconfig(libunwind)
BuildRequires: pkgconfig(libnewt)
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(python3)
BuildRequires: python%{py_ver}dist(setuptools)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(babeltrace2)
BuildRequires: jdk-current
BuildRequires: perl-devel
BuildRequires: perl(ExtUtils::Embed)
BuildRequires: %mklibname pfm
%endif
%ifarch %{arm}
BuildRequires: uboot-mkimage
%endif
# Let's pull in some of the most commonly used DKMS modules
# so end users don't have to install compilers (and worse,
# get compiler error messages on failures)
%ifarch %{x86_64}
BuildRequires: virtualbox-kernel-module-sources >= 7.0.8b
%if %{with vbox_orig_mods}
BuildRequires: virtualbox-guest-kernel-module-sources >= 7.0.8b
%endif
%endif
%description
The kernel package contains the Linux kernel (vmlinuz), the core of your
%{distribution} operating system. The kernel handles the basic functions
of the operating system: memory allocation, process allocation, device
input and output, etc.
#
# (tpg) generate subpackages for kernel flavours
#
%(for flavour in %{kernel_flavours}; do
cat <<EOF
%package -n %{name}-${flavour}
Summary: The heart of the %{distribution} built for ${flavour}
Version: %{version}
Release: %{release}
Group: System/Kernel and hardware
%if "${flavour}" == "desktop-gcc" || "${flavour}" == "server-gcc"
BuildRequires: gcc
BuildRequires: gcc-c++
%else
Provides: kernel-release-${flavour}-clang
Provides: kernel-release-${flavour}-clang-%{version}-%{release}%{disttag} = %{version}-%{release}
Provides: kernel-release-${flavour}-clang%_isa = %{version}-%{release}
%endif
Requires(posttrans): kmod >= 27-3
Recommends: kernel-firmware
Provides: kernel = %{kernelversion}.%{patchlevel}
Provides: %{name} = %{version}-%{release}
Provides: %{name}-${flavour}-%{version}-%{release}%{disttag}
Obsoletes: dkms-r8192se <= 0019.1207.2010-2
Obsoletes: dkms-lzma <= 4.43-32
Obsoletes: dkms-psb <= 4.41.1-7
Conflicts: dkms-broadcom-wl < 5.100.82.112-12
Conflicts: dkms-fglrx < 13.200.5-1
Conflicts: dkms-nvidia-current < 325.15-1
Conflicts: dkms-nvidia-long-lived < 319.49-1
Conflicts: dkms-nvidia304 < 304.108-1
Conflicts: %{name}-${flavour}-latest <= %{version}-%{release}
Obsoletes: %{name}-${flavour}-latest <= %{version}-%{release}
Provides: kernel-release
Provides: kernel-release-${flavour}
Provides: installonlypkg(kernel)
Recommends: iw
%ifarch %{ix86} %{x86_64}
Requires(post): grub2 >= 2.02-27
%endif
%ifnarch %{armx}
Recommends: cpupower
Recommends: microcode-intel
Suggests: dracut >= 047
%endif
%ifarch %{ix86}
Conflicts: arch(x86_64)
Conflicts: arch(znver1)
%endif
%ifnarch %{armx} %{riscv}
# might be useful too:
Suggests: microcode-intel
%endif
%description -n %{name}-${flavour}
%summary .
%posttrans -n %{name}-${flavour} -f kernel_files.${flavour}-posttrans
%postun -n %{name}-${flavour} -f kernel_files.${flavour}-postun
%files -n %{name}-${flavour} -f kernel_files.${flavour}
EOF
done
)
#
# kernel-devel
#
%if %{with build_devel}
%(for flavour in %{kernel_flavours}; do
cat <<EOF
%package -n %{name}-${flavour}-devel
Summary: The kernel-devel files for %{name}-${flavour}-%{version}-%{release}%{disttag}
Version: %{version}
Release: %{release}
Group: Development/Kernel
Requires: glibc-devel
Requires: ncurses-devel
Requires: make
%ifarch %{x86_64}
Requires: pkgconfig(libelf)
%endif
Provides: kernel-devel = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
Provides: %{name}-${flavour}-devel-%{version}-%{release}%{disttag}
Conflicts: %{name}-${flavour}-devel-latest <= %{version}-%{release}
Obsoletes: %{name}-${flavour}-devel-latest <= %{version}-%{release}
Provides: installonlypkg(kernel)
Requires: %{name}-${flavour} = %{version}-%{release}
%rename kernel-release-${flavour}-devel
AutoReqProv: no
%ifarch %{ix86}
Conflicts: arch(x86_64)
Conflicts: arch(znver1)
%endif
%description -n %{name}-${flavour}-devel
This package contains the kernel files (headers and build tools)
that should be enough to build additional drivers for
use with %{name}-${flavour}-%{version}-%{release}%{disttag}.
If you want to build your own kernel, you need to install the full
%{name}-source-%{version}-%{release}%{disttag}.
%post -n %{name}-${flavour}-devel -f kernel_devel_files.${flavour}-post
%preun -n %{name}-${flavour}-devel -f kernel_devel_files.${flavour}-preun
%postun -n %{name}-${flavour}-devel -f kernel_devel_files.${flavour}-postun
%files -n %{name}-${flavour}-devel -f kernel_devel_files.${flavour}
EOF
done
)
# end build_devel
%endif
#
# kernel-debuginfo
#
%if %{with build_debug}
%(for flavour in %{kernel_flavours}; do
cat <<EOF
%package -n %{name}-${flavour}-debuginfo
Summary: Files with debuginfo for %{name}-${flavour}-%{version}-%{release}%{disttag}
Version: %{version}
Release: %{release}
Group: Development/Debug
Provides: kernel-debug = %{version}-%{release}
Provides: kernel-${flavour}-%{version}-%{release}%{disttag}-debuginfo
Provides: installonlypkg(kernel)
Requires: %{name}-${flavour} = %{version}-%{release}
%rename kernel-release-${flavour}-debuginfo
AutoReqProv: no
%ifarch %{ix86}
Conflicts: arch(x86_64)
Conflicts: arch(znver1)
%endif
%description -n %{name}-${flavour}-debuginfo
This package contains the files with debuginfo to aid in debug tasks
when using %{name}-${flavour}-%{version}-%{release}%{disttag}.
If you need to look at debug information or use some application that
needs debugging info from the kernel, this package may help.
%files -n %{name}-${flavour}-debuginfo -f kernel_debug_files.${flavour}
EOF
done
)
# end build_debug
%endif
#
# kernel extra modules
#
%(for modules in %{modules_subpackages}; do
for flavour in %{kernel_flavours}; do
cat <<EOF
%package -n %{name}-${flavour}-modules-${modules}
Summary: ${modules} for kernel %{name}-${flavour}
Group: System/Kernel and hardware
Requires: %{name}-${flavour} = %{version}-%{release}
Provides: installonlypkg(kernel-module)
AutoReq: no
AutoProv: yes
Requires(posttrans,postun): kmod
%description -n %{name}-${flavour}-modules-${modules}
%{modules} modules for kernel %{name}-${flavour} .
%postun -n %{name}-${flavour}-modules-${modules}
[ -x %{_bindir}/depmod ] && %{_bindir}/depmod -A %{version}-$kernel_flavour-%{release}%{disttag}
%files -n %{name}-${flavour}-modules-${modules}
%optional %{_modulesdir}/%{version}-${flavour}-%{release}%{disttag}/kernel/net/${modules}
%optional %{_modulesdir}/%{version}-${flavour}-%{release}%{disttag}/kernel/drivers/${modules}
%optional %{_modulesdir}/%{version}-${flavour}-%{release}%{disttag}/kernel/drivers/net/${modules}
EOF
done
done
)
#
# kernel-source
#
%if %{with build_source}
%package -n %{name}-source
Summary: The Linux source code for %{name}-%{version}-%{release}%{disttag}
Version: %{version}
Release: %{release}
Group: Development/Kernel
Requires: glibc-devel
Requires: ncurses-devel
Requires: make
Requires: gcc >= 7.2.1_2017.11-3
Requires: perl
Requires: diffutils
Autoreqprov: no
Provides: kernel-source = %{version}-%{release}
Provides: kernel-source-%{version}-%{release}%{disttag}
Provides: installonlypkg(kernel)
Conflicts: %{name}-source-latest <= %{version}-%{release}
Obsoletes: %{name}-source-latest <= %{version}-%{release}
Conflicts: kernel-release-source-latest <= %{version}-%{release}
Obsoletes: kernel-release-source-latest <= %{version}-%{release}
%rename kernel-release-source
Buildarch: noarch
%description -n %{name}-source
The %{name}-source package contains the source code files for the %{distribution}
kernel. These source files are only needed if you want to build your own
custom kernel that is better tuned to your particular hardware.
If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...)
drivers against, install the *-devel rpm that is matching your kernel.
%endif
#
# kernel-doc: documentation for the Linux kernel
#
%if %with build_doc
%package -n %{name}-doc
Summary: Various documentation bits for %{distribution} %{name}
Version: %{version}
Release: %{release}
Group: Documentation
Buildarch: noarch
%description -n %{name}-doc
This package contains documentation files from the %{name} source.
Various bits of information about the Linux kernel and the device drivers
shipped with it are documented in these files. You also might want install
this package if you need a reference to the options that can be passed to
Linux kernel modules at load time.
%endif
#
# kernel/tools
#
%if %{with perf}
%package -n perf
Summary: perf tool and the supporting documentation
Version: %{version}
Release: %{release}
Group: System/Kernel and hardware
%description -n perf
The perf tool and the supporting documentation.
%endif
%if %{with build_cpupower}
%package -n cpupower
Summary: The cpupower tools
Version: %{version}
Release: %{release}
Group: System/Kernel and hardware
Obsoletes: cpufreq < 2.0-3
Provides: cpufreq = 2.0-3
Obsoletes: cpufrequtils < 008-6
Provides: cpufrequtils = 008-6
%description -n cpupower
The cpupower tools.
%package -n cpupower-devel
Summary: Devel files for cpupower
Version: %{version}
Release: %{release}
Group: Development/Kernel
Requires: cpupower = %{version}-%{release}
Conflicts: %{_lib}cpufreq-devel
%description -n cpupower-devel
This package contains the development files for cpupower.
%endif
%if %{with build_x86_energy_perf_policy}
%package -n x86_energy_perf_policy
Summary: Tool to control energy vs. performance on recent X86 processors
Version: %{version}
Release: %{release}
Group: System/Kernel and hardware
%description -n x86_energy_perf_policy
Tool to control energy vs. performance on recent X86 processors.
%endif
%if %{with build_turbostat}
%package -n turbostat
Summary: Tool to report processor frequency and idle statistics
Version: %{version}
Release: %{release}
Group: System/Kernel and hardware
%description -n turbostat
Tool to report processor frequency and idle statistics.
%endif
%if %{with hyperv}
%package -n hyperv-tools
Summary: Tools needed to communicate with a Hyper-V host
Source7000: https://src.fedoraproject.org/rpms/hyperv-daemons/raw/rawhide/f/hypervkvpd.service
Source7001: https://src.fedoraproject.org/rpms/hyperv-daemons/raw/rawhide/f/hypervkvp.rules
Source7002: https://src.fedoraproject.org/rpms/hyperv-daemons/raw/rawhide/f/hypervvssd.service
Source7003: https://src.fedoraproject.org/rpms/hyperv-daemons/raw/rawhide/f/hypervvss.rules
Source7004: https://src.fedoraproject.org/rpms/hyperv-daemons/raw/rawhide/f/hypervfcopyd.service
Source7005: https://src.fedoraproject.org/rpms/hyperv-daemons/raw/rawhide/f/hypervfcopy.rules
%description -n hyperv-tools
Tools needed to communicate with a Hyper-V host.
%files -n hyperv-tools
%{_sbindir}/hv_kvp_daemon
%{_unitdir}/hypervkvpd.service
%{_udevrulesdir}/70-hypervkvp.rules
%{_sbindir}/hv_vss_daemon
%{_unitdir}/hypervvssd.service
%{_udevrulesdir}/70-hypervvss.rules
%{_sbindir}/hv_fcopy_daemon
%{_unitdir}/hypervfcopyd.service
%{_udevrulesdir}/70-hypervfcopy.rules
%{_sbindir}/lsvmbus
%{_libexecdir}/hypervkvpd
%endif
%if %{with bpftool}
%package -n bpftool
Summary: Inspection and simple manipulation of eBPF programs and maps
Group: System/Kernel and hardware
%description -n bpftool
This package contains the bpftool, which allows inspection and simple
manipulation of eBPF programs and maps.
%endif
%package headers
Summary: Linux kernel header files mostly used by your C library
Version: %{version}
Release: %{release}
Group: System/Kernel and hardware
Epoch: 1
%if 0%{!?relc:1}
# (tpg) fix bug https://issues.openmandriva.org/show_bug.cgi?id=1580
Provides: kernel-headers = 1:%{version}-%{release}
Obsoletes: kernel-headers < 1:%{version}-%{release}
%rename linux-userspace-headers
%rename kernel-release-headers
%endif
%description headers
C header files from the Linux kernel. The header files define
structures and constants that are needed for building most
standard programs, notably the C library.
This package is not suitable for building kernel modules, you
should use the 'kernel-devel' package instead.
%files headers
%{_includedir}/*
# Don't conflict with cpupower-devel
%if %{with build_cpupower}
%exclude %{_includedir}/cpufreq.h
%endif
%if %{with cross_headers}
%(
for i in %{long_cross_header_archs}; do
[ "$i" = "%{_target_platform}" ] && continue
cat <<EOF
%package -n cross-${i}-%{name}-headers
Version: %{version}
Release: %{release}
Summary: Linux kernel header files for ${i} cross toolchains
Group: System/Kernel and hardware
BuildArch: noarch
%if "%{name}" != "kernel"
Provides: cross-${i}-kernel-headers = %{EVRD}
%endif
%rename cross-${i}-kernel-release-headers
%description -n cross-${i}-%{name}-headers
C header files from the Linux kernel. The header files define
structures and constants that are needed for building most
standard programs, notably the C library.
This package is only of interest if you're cross-compiling for
${i} targets.
%files -n cross-${i}-%{name}-headers
%{_prefix}/${i}/include/*
EOF
done
)
%endif
#
# End packages - here begins build stage
#
%prep
%setup -q -n linux-%{kernelversion}.%{patchlevel}%{?relc:-rc%{relc}} -a 1003 -a 1004 -a 1010
%if 0%{?sublevel:%{sublevel}}
[ -e .git ] || git init
xzcat %{SOURCE1000} |git apply - || git apply %{SOURCE1000}
rm -rf .git
%endif
%autopatch -p1
# Apparently, vm_clean was added in tools/Makefile before tools/vm was added
if [ -d tools/vm ]; then
echo "Remove the vm_clean workaround, it should work now"
exit 1
fi
sed -i -e 's,vm_clean ,,' tools/Makefile
%if %{with saa716x}
# merge SAA716x DVB driver from extra tarball
sed -i -e '/saa7164/isource "drivers/media/pci/saa716x/Kconfig"' drivers/media/pci/Kconfig
sed -i -e '/saa7164/iobj-$(CONFIG_SAA716X_CORE) += saa716x/' drivers/media/pci/Makefile
find drivers/media/tuners drivers/media/dvb-frontends -name "*.c" -o -name "*.h" -type f | xargs sed -i -e 's,"dvb_frontend.h",<media/dvb_frontend.h>,g'
%endif
# Merge EVDI
mv evdi-%{evdi_version}/module drivers/gpu/drm/evdi
rm -rf evdi-%{evdi_version}
sed -i -e '/imagination/isource "drivers/gpu/drm/evdi/Kconfig"' drivers/gpu/drm/Kconfig
# The dkms makefile is not really useful for a proper in-tree build
cat >drivers/gpu/drm/evdi/Makefile <<'EOF'
evdi-y := evdi_platform_drv.o evdi_platform_dev.o evdi_sysfs.o evdi_modeset.o evdi_connector.o evdi_encoder.o evdi_drm_drv.o evdi_fb.o evdi_gem.o evdi_painter.o evdi_params.o evdi_cursor.o evdi_debug.o evdi_i2c.o
evdi-$(CONFIG_COMPAT) += evdi_ioc32.o
obj-$(CONFIG_DRM_EVDI) := evdi.o
EOF
echo 'obj-$(CONFIG_DRM_EVDI) += evdi/' >>drivers/gpu/drm/Makefile
%if %{with rtl8821ce}
# Merge RTL8723DE and RTL8821CE drivers
cd drivers/net/wireless
sed -i -e '/quantenna\/Kconfig/asource "drivers/net/wireless/rtl8821ce/Kconfig' Kconfig
sed -i -e '/quantenna\/Kconfig/asource "drivers/net/wireless/rtl8723de/Kconfig' Kconfig
sed -i -e '/QUANTENNA/aobj-$(CONFIG_RTL8821CE) += rtl8821ce/' Makefile
sed -i -e '/QUANTENNA/aobj-$(CONFIG_RTL8723DE) += rtl8723de/' Makefile
cd -
%endif
%if 0%{?sublevel:1}
# make sure the kernel has the sublevel we know it has...
LC_ALL=C sed -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile
%endif
# Pull in some externally maintained modules
%ifarch %{x86_64}
# === VirtualBox guest additions ===
%if %{with vbox_orig_mods}
# There is an in-kernel version of vboxvideo -- unfortunately
# it doesn't seem to work properly with vbox just yet
# Let's replace it with the one that comes with VB for now
rm -rf drivers/gpu/drm/vboxvideo
cp -a $(ls --sort=time -1d /usr/src/vboxadditions-*|head -n1)/vboxvideo drivers/gpu/drm/
cat >drivers/gpu/drm/vboxvideo/Kconfig <<'EOF'
config DRM_VBOXVIDEO
tristate "Virtual Box Graphics Card"
depends on DRM && X86 && PCI
select DRM_KMS_HELPER
select DRM_TTM
select GENERIC_ALLOCATOR
help
This is a KMS driver for the virtual Graphics Card used in
Virtual Box virtual machines.
Although it is possible to build this driver built-in to the
kernel, it is advised to build it as a module, so that it can
be updated independently of the kernel. Select M to build this
driver as a module and add support for these devices via drm/kms
interfaces.
EOF
sed -i -e 's,\$(KBUILD_EXTMOD),drivers/gpu/drm/vboxvideo,g' drivers/gpu/drm/vboxvideo/Makefile*
sed -i -e "s,^KERN_DIR.*,KERN_DIR := $(pwd)," drivers/gpu/drm/vboxvideo/Makefile*
patch -p1 -z .1008~ -b <%{S:1008}
%endif
# 800x600 is too small to be useful -- even calamares doesn't
# fit into that anymore (this fix is needed for both the in-kernel
# version and the vbox version of the driver)
sed -i -e 's|800, 600|1024, 768|g' drivers/gpu/drm/vboxvideo/vbox_mode.c
# VirtualBox shared folders now come in through patch 300
## NONE upstream this stuff will be here for a while
# === VirtualBox host modules ===
# VirtualBox
cp -a $(ls --sort=time -1d /usr/src/virtualbox-*|head -n1)/vboxdrv drivers/virt/
sed -i -e 's,\$(VBOXDRV_DIR),drivers/virt/vboxdrv/,g' drivers/virt/vboxdrv/Makefile*
sed -i -e "s,^KERN_DIR.*,KERN_DIR := $(pwd)," drivers/virt/vboxdrv/Makefile*
echo 'obj-m += vboxdrv/' >>drivers/virt/Makefile
# VirtualBox network adapter
cp -a $(ls --sort=time -1d /usr/src/virtualbox-*|head -n1)/vboxnetadp drivers/net/
sed -i -e 's,\$(VBOXNETADP_DIR),drivers/net/vboxnetadp/,g' drivers/net/vboxnetadp/Makefile*
sed -i -e "s,^KERN_DIR.*,KERN_DIR := $(pwd)," drivers/net/vboxnetadp/Makefile*
echo 'obj-m += vboxnetadp/' >>drivers/net/Makefile
# VirtualBox network filter
cp -a $(ls --sort=time -1d /usr/src/virtualbox-*|head -n1)/vboxnetflt drivers/net/
sed -i -e 's,\$(VBOXNETFLT_DIR),drivers/net/vboxnetflt/,g' drivers/net/vboxnetflt/Makefile*
sed -i -e "s,^KERN_DIR.*,KERN_DIR := $(pwd)," drivers/net/vboxnetflt/Makefile*
echo 'obj-m += vboxnetflt/' >>drivers/net/Makefile
%if 0
# VirtualBox PCI
# https://forums.gentoo.org/viewtopic-t-1105508-start-0.html -- not very
# useful (yet), but a source of many errors.
# Potentially re-enable if it ever gets fixed to support PCIE.
cp -a $(ls --sort=time -1d /usr/src/virtualbox-*|head -n1)/vboxpci drivers/pci/
sed -i -e 's,\$(VBOXPCI_DIR),drivers/pci/vboxpci/,g' drivers/pci/vboxpci/Makefile*
sed -i -e "s,^KERN_DIR.*,KERN_DIR := $(pwd)," drivers/pci/vboxpci/Makefile*
echo 'obj-m += vboxpci/' >>drivers/pci/Makefile
%endif
patch -p1 -z .1005~ -b <%{S:1005}
patch -p1 -z .1007~ -b <%{S:1007}
%endif
# V4L2 loopback support
cp %{S:401} %{S:402} include/media
sed -e 's,"v4l2loopback.h",<media/v4l2loopback.h>,g;s,"v4l2loopback_formats.h",<media/v4l2loopback_formats.h>,g' %{S:400} >drivers/media/v4l2-core/v4l2loopback.c
cat >>drivers/media/v4l2-core/Kconfig <<'EOF'
config V4L2_LOOPBACK
tristate "Video4Linux loopback support"
help
This module allows you to create "virtual video devices". Normal (v4l2)
applications will read these devices as if they were ordinary video devices,
but the video will not be read from e.g. a capture card but instead it is
generated by another application.
EOF
cat >>drivers/media/v4l2-core/Makefile <<'EOF'
obj-$(CONFIG_V4L2_LOOPBACK) += v4l2loopback.o
EOF
# get rid of unwanted files
find . -name '*~' -o -name '*.orig' -o -name '*.append' -o -name '*.g*ignore' | %kxargs rm -f
# fix missing exec flag on file introduced in 4.14.10-rc1
chmod 755 tools/objtool/sync-check.sh
%ifarch znver1 znver2 znver3
# Workaround for https://github.com/llvm/llvm-project/issues/82431
echo 'CFLAGS_ip6_input.o += -march=x86-64-v3' >>net/ipv6/Makefile