forked from intel-gpu/intel-gpu-i915-backports
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile.backport
991 lines (795 loc) · 39.1 KB
/
Makefile.backport
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
#
# Backports Makefile
#
#------------------------------------------------------------------------------
#
## GLOBAL VARIABLES
#
##------------------------------------------------------------------------------
#
# KERNEL VARIABLES
#
# EXTENDED_VERSION_X/_Y/_X : Extracts Extended kernel version from specific osv provided
# generated source file.
# Ex: RHEL provides extended version info with include/generated/uapi/linux/version.h header
# with RHEL_RELEASE macro.
# Expected input: #define RHEL_RELEASE "372.32.1"
# Filtered output: EXTENDED_VERSION_X:372 , EXTENDED_VERSION_Y:32, EXTENDED_VERSION_Z:1
EXTENDED_VERSION_X = 0
EXTENDED_VERSION_Y = 0
EXTENDED_VERSION_Z = 0
UTS_RELEASE = ""
KERN_VER_XY = 0
KERN_VER_XYZ = 0
#
# BACKPORT VARIABLES
#
#TBD: we are not generating BASE_KERNEL_NAME anymore. we should change it
BASE_KERNEL_NAME = ""
BUILD_KERNEL_VARIANT = ""
BKPT_VER = ""
DII_TAG_PREFIX = ""
DII_TAG = ""
KER_VER = ""
ADD_KER_VER = 0
KERN_TYPE = ""
KER_VER_BIN = ""
MODULES_VARIANT := pmt
BUILD_CONFIG ?=
BUILD_CONFIG_VARIANT := CUSTOM_KERN_1 CUSTOM_KERN_3 sp2 nodrm nosvm $(MODULES_VARIANT) disabledisplay
BUILD_CONFIG_DISTRO = ""
RPM_DISTRIBUTIONS := RHEL_8.9 RHEL_8.8 RHEL_8.7 RHEL_8.6 RHEL_8.5 RHEL_8.4 CUSTOM_KERN_3 CUSTOM_KERN_1 VANILLA_5.10LTS VANILLA_5.4LTS
RELEASE_TYPE ?= opensource
#
# OSV GENERIC VARIABLES
#
# OSV_NAME
# Identifies OSV Name
# Example Value: REDHAT/UBUNTU
OSV_NAME = ""
# OSV_VER
# Identifies OSV version
# Example Value: 20.04/8.6
OSV_VER = 0
OSV_KV_SUPPORTED = ""
#Add Kernel version to dkms package name only when OS_DISTRIBUTION argument is set
ifneq (, $(OS_DISTRIBUTION))
ADD_KER_VER = 1
endif
ifneq (,$(filter $(PKG_DISTRO_TARGETS), $(MAKECMDGOALS)))
OS_DISTRIBUTION ?= RHEL_8.9
endif
ifneq (,$(filter $(filter-out $(MODULES_VARIANT), $(BUILD_CONFIG_VARIANT)), $(BUILD_CONFIG)))
BUILD_CONFIG_DISTRO = $(BUILD_CONFIG)
endif
#
# OSV specific variables.
#
#
# RedHat Specific.
#
# RHEL_MAJOR consist of RedHat release major version
# Expected input: #define RHEL_MAJOR 8
# Filtered output: 8
RHEL_MAJOR = ""
# RHEL_MINOR consist of RedHat release minor version
# Expected input: #define RHEL_MINOR 6
# Filtered output: 6
RHEL_MINOR = ""
#
# Ubuntu Specific.
#
UBUNTU_MAJOR = ""
UBUNTU_MINOR = ""
#
# SUSE Specific.
#
SUSE_VERSION = ""
# SUSE_PATCHLEVEL consist of SUSE release patchlevel
# Expected input: #define CONFIG_SUSE_PATCHLEVEL 4
# Filtered Output: 4
SUSE_PATCHLEVEL = ""
# SUSE_AUXRELEASE consist of SUSE auxrelease
# Expected input: #define CONFIG_SUSE_AUXRELEASE 0
# Filtered Output: 0
SUSE_AUXRELEASE = ""
#
#Custom kernel specific
#
CUSTOM_KERN_ID ?=
CUSTOM_KERN_1_NAME = ""
CUSTOM_KERN_1_VER = ""
CUSTOM_KERN_1_MAJOR = ""
CUSTOM_KERN_1_MINOR = ""
CUSTOM_ARG = ""
#
#Custom kernel 3 specific
#
CUSTOM_KERN_3_NAME = ""
CUSTOM_KERN_3_VER = ""
CUSTOM_KERN_3_MAJOR = ""
CUSTOM_KERN_3_MINOR_XX_P = ""
CUSTOM_KERN_3_MINOR_XX_Q = ""
#------------------------------------------------------------------------------
# Start Variable Extraction
#
# Extraction Flow
# -----------------------------------------------
# if !PKG_DISTRO_TARGETS
# if suse
# extract suse
# else
# if ubuntu
# extract ubuntu
# else
# if rhel
# extract rhel
# else
# check non-osv
# endif
# endif
# endif
# else
# PKG_DISTRO_TARGETS
# endif
# -----------------------------------------------
#------------------------------------------------------------------------------
# BKPT_VER consist of backported release version.
# Expected input: 'BACKPORTS_RELEASE_TAG="BKPT_6365_PRERELEASE_221021.0"' (TBD: Need to change as per final unification tag)
# Filtered output: 221021.0
BKPT_VER=$(shell cat versions | grep BACKPORTS_RELEASE_TAG | cut -d "_" -f 7 | cut -d "\"" -f 1 | cut -d "-" -f 1 2>/dev/null || echo 1)
get_kernel_version = $(strip $(shell expr $(1).$(2)))
#DII_TAG is extracted from DII_KERNEL_TAG, which is auto genereated from base kernel source.
#Tagging is needed for decoding this,
#Ex: For DII_KERNEL_TAG="DII_6001_prerelease" : DII_TAG will be 6001
# For DII_KERNEL_TAG="PROD_I915_6469.0.7" : DII_TAG will be 6469.0.7
# For DII_KERNEL_TAG="I915-23.4.0" : DII_TAG will be 23.4.0
#for DII_TAG_PREFIX output will be DII or PROD or I915-23.4.0.
DII_TAG_PREFIX=$(shell cat versions | grep DII_KERNEL_TAG | cut -f 2 -d "\"" | cut -d "_" -f 1 2>/dev/null || echo 1)
ifeq ($(DII_TAG_PREFIX) , PROD)
DII_TAG=$(shell cat versions | grep DII_KERNEL_TAG | cut -f 2 -d "\"" | cut -d "_" -f 3 2>/dev/null || echo 1)
else ifeq ($(DII_TAG_PREFIX) , DII)
DII_TAG=$(shell cat versions | grep DII_KERNEL_TAG | cut -f 2 -d "\"" | cut -d "_" -f 2 2>/dev/null || echo 1)
else
DII_TAG=$(shell cat versions | grep DII_KERNEL_TAG | cut -f 2 -d "\"" | cut -d "-" -f 2 2>/dev/null || echo 1)
endif
ifeq (,$(filter $(PKG_DISTRO_TARGETS), $(MAKECMDGOALS))) # Start - OSV Extraction
# Read kernel version from the utsrelease.h which is common among the all the supported OSVs.
# Expected input: #define UTS_RELEASE "5.17.15" OR #define UTS_RELEASE "5.14.21-150400.24.18-default"
# Filtered output: 5.17.15 OR 5.14.21-150400.24.18-default
UTS_RELEASE=$(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep "UTS_RELEASE" | cut -d "\"" -f 2 | tr -d '~+')
# KERN_VER_XYZ consist of release kernel major.minor.extended version.
# Expected input: #define UTS_RELEASE "5.17.15" OR #define UTS_RELEASE "5.14.21-150400.24.18-default"
# Filtered output: 5.17.15 OR 5.14.21
KERN_VER_XYZ=$(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep "UTS_RELEASE" | cut -d '"' -f2 | cut -d '.' -f1-3 | cut -d '-' -f1 | tr -d '+')
# KERN_VER_XY consist of release kernel major and minor version.
# Expected input: #define UTS_RELEASE "5.17.15" OR #define UTS_RELEASE "5.14.21-150400.24.18-default"
# Filtered output: 5.17 OR 5.14
KERN_VER_XY=$(shell echo $(KERN_VER_XYZ) | cut -d '.' -f-2)
# Check if autoconf provides OSV information.
# For SLES verify if CONFIG_SUSE_KERNEL is defined
OSV_NAME = $(shell cat $(KLIB_BUILD)/include/generated/autoconf.h | grep "CONFIG_SUSE_KERNEL " | cut -d " " -f 2 | cut -d "_" -f 2)
ifeq ($(OSV_NAME),SUSE) # Check for SUSE
#
# Extract SUSE Variables
#
# Read suse version info
# SUSE_VERSION consist of SUSE release version
# Expected input: #define CONFIG_SUSE_VERSION 15
# Filtered Output: 15
SUSE_VERSION = $(shell cat $(KLIB_BUILD)/include/generated/autoconf.h | grep CONFIG_SUSE_VERSION | cut -d " " -f3)
# SUSE_PATCHLEVEL consist of SUSE release patchlevel
# Expected input: #define CONFIG_SUSE_PATCHLEVEL 4
# Filtered Output: 4
SUSE_PATCHLEVEL = $(shell cat $(KLIB_BUILD)/include/generated/autoconf.h | grep CONFIG_SUSE_PATCHLEVEL | cut -d " " -f3)
# SUSE_AUXRELEASE consist of SUSE auxrelease
# Expected input: #define CONFIG_SUSE_AUXRELEASE 0
# Filtered Output: 0
SUSE_AUXRELEASE = $(shell cat $(KLIB_BUILD)/include/generated/autoconf.h | grep CONFIG_SUSE_AUXRELEASE | cut -d " " -f3)
OSV_VER = $(SUSE_VERSION)0$(SUSE_PATCHLEVEL)0$(SUSE_AUXRELEASE)
EXTENDED_VERSION_X = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep UTS_RELEASE | cut -d '"' -f2 | cut -d '-' -f2 | cut -d '.' -f2)
EXTENDED_VERSION_Y = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep UTS_RELEASE | cut -d '"' -f2 | cut -d '-' -f2 | cut -d '.' -f3)
OSV_KV_SUPPORTED = $(shell cat versions | grep "SLES15_SP$(SUSE_PATCHLEVEL)_KERNEL_VERSION" | cut -d '"' -f 2)
# TBD: What is KERN_VERN
BASE_KERNEL_NAME = $(KERN_VER)-$(OSV_VER).$(EXTENDED_VERSION_X)
ifneq ($(EXTENDED_VERSION_Y),)
BASE_KERNEL_NAME := $(BASE_KERNEL_NAME).$(EXTENDED_VERSION_Y)
endif
else
# In case of Ubuntu use CONFIG_VERSION_SIGNATURE data and verify tag "ubuntu"
OSV_NAME = $(shell cat $(KLIB_BUILD)/include/generated/autoconf.h | grep CONFIG_VERSION_SIGNATURE | cut -d ' ' -f 3 | cut -d "\"" -f 2)
ifeq ($(OSV_NAME), Ubuntu)
#
# Extract Ubuntu Variables
#
OSV_NAME := $(shell echo $(OSV_NAME) | tr '[:lower:]' '[:upper:]')
# Get the ubuntu version information from the autoconf.h
KERN_VER_XYZ := $(shell cat $(KLIB_BUILD)/include/generated/autoconf.h | grep CONFIG_VERSION_SIGNATURE | cut -d '"' -f2 | cut -d ' ' -f2 | cut -d '-' -f1)
KERN_TYPE = $(shell cat $(KLIB_BUILD)/include/generated/autoconf.h | grep CONFIG_VERSION_SIGNATURE | cut -d "-" -f3 | cut -d ' ' -f1 | tr -d "\"")
# Get the osv version by comparing the kernel versions
ifeq ($(shell expr $(KERN_VER_XY) \<= 5.16), 1)
OSV_VER = 20.04
UBUNTU_MAJOR=$(shell echo $(OSV_VER) | cut -d '.' -f 1)
UBUNTU_MINOR=$(shell echo $(OSV_VER) | cut -d '.' -f 2)
else ifeq ($(shell expr $(KERN_VER_XY) \>= 5.17), 1)
OSV_VER = 22.04
UBUNTU_MAJOR=$(shell echo $(OSV_VER) | cut -d '.' -f 1)
UBUNTU_MINOR=$(shell echo $(OSV_VER) | cut -d '.' -f 2)
endif
EXTENDED_VERSION_X = $(shell cat $(KLIB_BUILD)/include/generated/autoconf.h | grep CONFIG_VERSION_SIGNATURE | cut -d '-' -f 2 | awk -F '[.~+]' '{print $$1}' 2> /dev/null)
EXTENDED_VERSION_Y = $(shell cat $(KLIB_BUILD)/include/generated/autoconf.h | grep CONFIG_VERSION_SIGNATURE | cut -d '-' -f 2 | awk -F '[.~+]' '{print $$2}' 2> /dev/null)
BASE_KERNEL_NAME = $(KERN_VER_XYZ)-$(EXTENDED_VERSION_X)
ifeq ($(KERN_TYPE), oem)
OSV_KV_SUPPORTED = $(shell cat versions | grep "UBUNTU_OEM_$(OSV_VER)_KERNEL_VERSION" | cut -d '"' -f 2)
else
OSV_KV_SUPPORTED = $(shell cat versions | grep "UBUNTU_GENERIC_KERNEL_VERSION" | cut -d '"' -f 2)
endif
else
# If the osv name is rhel then read the version info from version.h
OSV_NAME = $(shell cat $(KLIB_BUILD)/include/generated/uapi/linux/version.h | grep "RHEL_RELEASE " | cut -d " " -f2 | cut -d "_" -f1)
ifeq ($(OSV_NAME), RHEL)
#
# Extract RHEL Variables
#
# RHEL_MAJOR consist of RedHat release major version
# Expected input: #define RHEL_MAJOR 8
# Filtered output: 8
RHEL_MAJOR = $(shell cat $(KLIB_BUILD)/include/generated/uapi/linux/version.h | grep RHEL_MAJOR | cut -d ' ' -f3)
# RHEL_MINOR consist of RedHat release minor version
# Expected input: #define RHEL_MINOR 6
# Filtered output: 6
RHEL_MINOR = $(shell cat $(KLIB_BUILD)/include/generated/uapi/linux/version.h | grep RHEL_MINOR | cut -d ' ' -f3)
#RHEL_RELEASE_CODE consist of RedHat release code. exporting variable to access in out of this file
RHEL_RELEASE_VERSION = $(shell cat $(KLIB_BUILD)/include/generated/uapi/linux/version.h | grep "RHEL_RELEASE_CODE" | cut -d ' ' -f3)
export RHEL_RELEASE_VERSION
OSV_VER = $(RHEL_MAJOR).$(RHEL_MINOR)
EXTENDED_VERSION_X = $(shell cat $(KLIB_BUILD)/include/generated/uapi/linux/version.h | grep "RHEL_RELEASE " | cut -d '"' -f2 | cut -d "." -f1)
EXTENDED_VERSION_Y = $(shell cat $(KLIB_BUILD)/include/generated/uapi/linux/version.h | grep "RHEL_RELEASE " | cut -d '"' -f2 | cut -d "." -s -f2)
EXTENDED_VERSION_Z = $(shell cat $(KLIB_BUILD)/include/generated/uapi/linux/version.h | grep "RHEL_RELEASE " | cut -d '"' -f2 | cut -d "." -s -f3)
# OSV_KV_SUPPORTED consist of rhel kernel version available in versions file.
# Expected input: RHEL_8.6_KERNEL_VERSION="4.18.0-372.32.1"
# Filtered output: 4.18.0-372.32.1
OSV_KV_SUPPORTED = $(shell cat versions | grep RHEL_$(RHEL_MAJOR).$(RHEL_MINOR)_KERNEL_VERSION | cut -d "\"" -f 2 2>/dev/null || echo 1)
BASE_KERNEL_NAME = $(KERN_VER_XYZ).$(EXTENDED_VERSION_X)
# BASE_KERNEL_NAME consist of kernel version
# Output: 4.18.0-372.32.1
ifneq ($(EXTENDED_VERSION_Y),)
BASE_KERNEL_NAME := $(BASE_KERNEL_NAME).$(EXTENDED_VERSION_Y)
endif
ifneq ($(EXTENDED_VERSION_Z),)
BASE_KERNEL_NAME := $(BASE_KERNEL_NAME).$(EXTENDED_VERSION_Z)
endif
else ifeq ($(OSV_NAME),)
ifeq ($(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep UTS_RELEASE | cut -d '"' -f2 | awk -F- '{print $$NF}'), pve)
OSV_NAME = PVE
EXTENDED_VERSION_X = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep UTS_RELEASE | cut -d '"' -f2 | cut -d '-' -f2)
BASE_KERNEL_NAME = $(KERN_VER)-$(EXTENDED_VERSION_X)-pve
#
# Extract Vanilla/Mainline Variables
#
else ifeq ($(shell expr $(KERN_VER_XY) \== $(call get_kernel_version,5,4)), 1)
OSV_NAME = VANILLA_5.4LTS
OSV_KV_SUPPORTED = $(shell cat versions | grep "$(OSV_NAME)_KERNEL_VERSION" | cut -d '"' -f 2)
else ifeq ($(shell test $(KERN_VER_XY) = 5.10 && test "$(BUILD_CONFIG)" != CUSTOM_KERN_3 && echo 1), 1)
OSV_NAME = VANILLA_5.10LTS
OSV_KV_SUPPORTED = $(shell cat versions | grep "$(OSV_NAME)_KERNEL_VERSION" | cut -d '"' -f 2)
else ifeq ($(shell expr $(KERN_VER_XY) \== 5.15), 1)
OSV_NAME = MAINLINE
# Check for mainline and vanilla kernels using kernel versions
OSV_KV_SUPPORTED = $(shell cat versions | grep "$(OSV_NAME)_KERNEL_VERSION" | cut -d '"' -f 2)
else ifeq ($(shell expr $(KERN_VER_XY) \== 5.18), 1)
OSV_NAME = VANILLA
OSV_KV_SUPPORTED = $(shell cat versions | grep "$(OSV_NAME)_KERNEL_VERSION" | cut -d '"' -f 2)
else ifneq ($(CUSTOM_KERN_ID), )
CUSTOM_ARG = -t $(CUSTOM_KERN_ID)
ifeq ($(BUILD_CONFIG), CUSTOM_KERN_1)
CUSTOM_KERN_1_NAME = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep $(CUSTOM_KERN_ID) | cut -d '_' -f3 | cut -c 1-3 2>/dev/null || echo 1)
CUSTOM_KERN_1_VER = $(BUILD_CONFIG)
CUSTOM_KERN_1_MAJOR = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep UTS_RELEASE | cut -d '_' -f3 | cut -d '-' -f1 | sed 's/[^0-9]//g' 2>/dev/null || echo 1)
CUSTOM_KERN_1_MINOR = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep UTS_RELEASE | cut -d '_' -f4 | sed 's/[^0-9]//g' 2>/dev/null || echo 1)
ifeq ($(CUSTOM_KERN_1_MINOR),)
CUSTOM_KERN_1_MINOR = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep UTS_RELEASE | cut -d '_' -f5 | sed 's/[^0-9]//g' 2>/dev/null || echo 1)
endif
OS_DISTRIBUTION = $(CUSTOM_KERN_1_VER)
OSV_NAME := $(shell echo $(CUSTOM_KERN_1_VER) | tr '[:lower:]' '[:upper:]')
else ifeq ($(BUILD_CONFIG), CUSTOM_KERN_3)
#check for CUSTOM_KERN_3
CUSTOM_KERN_3_NAME = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep $(CUSTOM_KERN_ID) | cut -d '.' -f8 | cut -c1-2)
ifneq ($(CUSTOM_KERN_3_NAME),)
CUSTOM_KERN_3_VER = $(BUILD_CONFIG)
CUSTOM_KERN_3_MAJOR = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | cut -d '.' -f 3 | cut -d '-' -f 2)
CUSTOM_KERN_3_MINOR_XX_P = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | cut -d '.' -f 4)
CUSTOM_KERN_3_MINOR_XX_Q = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | cut -d '.' -f 5)
OS_DISTRIBUTION = $(CUSTOM_KERN_3_VER)
OSV_NAME := $(shell echo $(CUSTOM_KERN_3_VER) | tr '[:lower:]' '[:upper:]')
endif
else
$(error "Please provide valid BUILD_CONFIG value.")
endif
else
$(info "OSV_NOT SUPPORTED")
endif
ifneq ($(OSV_NAME),)
BASE_KERNEL_NAME = $(KERN_VER_XYZ)
endif
endif
endif
endif
else #else - Start OSV Extraction
OS_DISTRIBUTION := $(shell echo $(OS_DISTRIBUTION) | tr '[:lower:]' '[:upper:]')
ifeq ($(BUILD_CONFIG), sp2)
BUILD_CONFIG_DISTRO := $(shell echo $(BUILD_CONFIG_DISTRO) | tr '[:lower:]' '[:upper:]')
BASE_KERNEL_NAME = $(shell cat versions | grep -w "SLES15_$(BUILD_CONFIG_DISTRO)_KERNEL_VERSION" | cut -d '"' -f 2)
else
BASE_KERNEL_NAME = $(shell cat versions | grep -w "$(OS_DISTRIBUTION)_KERNEL_VERSION" | cut -d '"' -f 2)
endif
ifneq ($(CUSTOM_KERN_ID), )
CUSTOM_ARG = -t $(CUSTOM_KERN_ID)
endif
ifeq ($(BASE_KERNEL_NAME),)
$(error "Unsupported os. Please see i915dkmsdeb-pkg-help (or) i915dkmsrpm-pkg-help and provide supported kernel name")
else ifeq (dkmsrpm-pkg, $(MAKECMDGOALS))
ifeq (,$(filter $(RPM_DISTRIBUTIONS), $(OS_DISTRIBUTION)))
# TBD: No debian support
$(error rpm package cannot be generated for $(OS_DISTRIBUTION), please use i915dkmsdeb-pkg)
endif
endif
endif # End - Start OSV Extraction
#------------------------------------------------------------------------------
# End of Variable Extraction
#------------------------------------------------------------------------------
ifeq ($(KERNELRELEASE),)
# Disable built-in rules for this file
.SUFFIXES:
#------------------------------------------------------------------------------
#
# Make Targets
#
# Add all make targets for generative, packaging, build Targets.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Make build Generative Targets
#-----------------------------------------------------------------------------
version_h := $(BACKPORT_DIR)/backport-include/linux/osv_version.h
backport_path_h := backport-include/backport/backport_path.h
export version_h backport_path_h
.PHONY: modules
modules: $(backport_path_h) $(version_h) versions_update
$(backport_path_h): .config Kconfig.versions Kconfig.kernel
@echo -n "Building $(backport_path_h) ..."
@grep -f local-symbols .config | ( \
echo "#ifndef COMPAT_BACKPORTED_PATH_INCLUDED" ;\
echo "#define COMPAT_BACKPORTED_PATH_INCLUDED" ;\
echo "/*" ;\
echo " * Automatically generated file, don't edit!" ;\
echo " * Changes will be overwritten" ;\
echo " */" ;\
echo "" ;\
echo "#define BACKPORT_PATH $(shell pwd)" ;\
echo "" ;\
echo "#endif /* BACKPORTED_PATH_INCLUDED */" ;\
) > $(backport_path_h)
@echo " done."
ifeq (,$(filter $(PKG_DISTRO_TARGETS), $(MAKECMDGOALS)))
# Easy method for doing a status message
kecho := :
quiet_kecho := echo
silent_kecho := :
kecho := $($(quiet)kecho)
# filechk is used to check if the content of a generated file is updated.
# Sample usage:
# define filechk_sample
# echo $KERNELRELEASE
# endef
# version.h : Makefile
# $(call filechk,sample)
# The rule defined shall write to stdout the content of the new file.
# The existing file will be compared with the new one.
# - If no file exist it is created
# - If the content differ the new file is used
# - If they are equal no change, and no timestamp update
# - stdin is piped in from the first prerequisite ($<) so one has
# to specify a valid file as first prerequisite (often the kbuild file)
define filechk
@set -e; \
mkdir -p $(dir $@); \
{ $(filechk_$(1)); } > $@.tmp; \
if [ -r $@ ] && cmp -s $@ $@.tmp; then \
rm -f $@.tmp; \
else \
$(kecho) ' UPD $@'; \
mv -f $@.tmp $@; \
fi
endef
define filechk_osv_version_ubuntu.h
echo '#define UBUNTU_BACKPORT_MAJOR $(EXTENDED_VERSION_X)'; \
echo '#define UBUNTU_BACKPORT_MINOR $(EXTENDED_VERSION_Y)'; \
echo '#define UBUNTU_BACKPORT_RELEASE_VERSION(a,b) (((a) << 16) + ((b) << 8))'; \
echo '#define UBUNTU_BACKPORT_RELEASE_CODE $(shell \
expr $(EXTENDED_VERSION_X) \* 65536 + 0$(EXTENDED_VERSION_Y) \* 256)'; \
echo '#define UBUNTU_RELEASE_VERSION(x,y) (((x) << 16) + ((y) << 8))'; \
echo '#define UBUNTU_RELEASE_CODE \
$(shell expr $(UBUNTU_MAJOR) \* 65536 + 0$(UBUNTU_MINOR) \* 256)'
endef
define filechk_osv_version_sles.h
echo '#define SUSE_LOCALVERSION_MAJOR $(EXTENDED_VERSION_X)'; \
echo '#define SUSE_LOCALVERSION_MINOR $(EXTENDED_VERSION_Y)'; \
echo '#define SUSE_LOCALVERSION(a,b) (((a) << 8) + (b))'; \
echo '#define SUSE_LOCALVERSION_RELEASE_CODE \
$(shell expr $(EXTENDED_VERSION_X) \* 256 + 0$(EXTENDED_VERSION_Y))'
endef
define filechk_osv_version_rhel.h
echo '#define RHEL_BACKPORT_MAJOR $(EXTENDED_VERSION_X)'; \
echo '#define RHEL_BACKPORT_MINOR_XX_P $(EXTENDED_VERSION_Y)'; \
echo '#define RHEL_BACKPORT_MINOR_YY_Q $(EXTENDED_VERSION_Z)'; \
echo '#define RHEL_BACKPORT_RELEASE_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
echo '#define RHEL_BACKPORT_RELEASE_CODE \
$(shell expr $(EXTENDED_VERSION_X) \* 65536 + 0$(EXTENDED_VERSION_Y) \* 256 + 0$(EXTENDED_VERSION_Z))'
endef
define filechk_osv_version_pve.h
echo '#define PVE_BACKPORT_RELEASE_CODE $(EXTENDED_VERSION_X)'
endef
define filechk_osv_version_generic.h
echo '#define GENERIC_BACKPORT_MAJOR $(EXTENDED_VERSION_X)'; \
echo '#define GENERIC_BACKPORT_MINOR $(EXTENDED_VERSION_Y)'; \
echo '#define GENERIC_BACKPORT_RELEASE_VERSION(a,b) (((a) << 16) + ((b) << 8))'; \
echo '#define GENERIC_BACKPORT_RELEASE_CODE $(shell \
expr $(EXTENDED_VERSION_X) \* 65536 + 0$(EXTENDED_VERSION_Y) \* 256)'
endef
define filechk_osv_custom_kernel_1.h
echo '#define CUSTOM_KERN_1_VER $(CUSTOM_KERN_1_VER)'; \
echo '#define CUSTOM_KERN_1_MAJOR $(CUSTOM_KERN_1_MAJOR)'; \
echo '#define CUSTOM_KERN_1_MINOR $(CUSTOM_KERN_1_MINOR)'; \
echo '#define CUSTOM_KERN_1_RELEASE_VERSION(a,b) (((a) << 16) + (b))'; \
echo '#define CUSTOM_KERN_1_RELEASE_CODE $(shell \
expr $(CUSTOM_KERN_1_MAJOR) \* 65536 + 0$(CUSTOM_KERN_1_MINOR))'
endef
define filechk_osv_custom_kernel_3.h
echo '#define CUSTOM_KERN_3_MAJOR $(CUSTOM_KERN_3_MAJOR)'; \
echo '#define CUSTOM_KERN_3_MINOR_XX_P $(CUSTOM_KERN_3_MINOR_XX_P)'; \
echo '#define CUSTOM_KERN_3_MINOR_YY_Q $(CUSTOM_KERN_3_MINOR_YY_Q)'; \
echo '#define CUSTOM_KERN_3_RELEASE_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
echo '#define CUSTOM_KERN_3_RELEASE_CODE \
$(shell expr $(CUSTOM_KERN_3_MAJOR) \* 65536 + 0$(CUSTOM_KERN_3_MINOR_XX_P) \* 256 + 0$(CUSTOM_KERN_3_MINOR_YY_Q))'
endef
# version_h
# Creates Backports dmabuf dkms package
# Rpm generated can be copied to client machine and install
#------------------------------------------------------------------------------
$(version_h): $(BACKPORT_DIR)/Makefile FORCE
ifeq ($(OSV_NAME), UBUNTU)
$(call filechk,osv_version_ubuntu.h)
else ifeq ($(OSV_NAME), SUSE)
$(call filechk,osv_version_sles.h)
else ifeq ($(OSV_NAME), RHEL)
$(call filechk,osv_version_rhel.h)
else ifeq ($(OSV_NAME), PVE)
$(call filechk,osv_version_pve.h)
else ifeq ($(CUSTOM_KERN_1_VER), CUSTOM_KERN_1)
$(call filechk,osv_custom_kernel_1.h)
else ifeq ($(CUSTOM_KERN_3_VER), CUSTOM_KERN_3)
$(call filechk,osv_custom_kernel_3.h)
else
$(call filechk,osv_version_generic.h)
endif
# versions_update
# Update versions file with verified headers
#------------------------------------------------------------------------------
.PHONY: versions_update
versions_update:
ifeq ($(OSV_KV_SUPPORTED), )
ifeq ($(OSV_NAME), UBUNTU)
ifeq ($(KERN_TYPE), oem)
@echo 'UBUNTU_OEM_$(OSV_VER)_KERNEL_VERSION="$(KERN_VER_XYZ)-$(EXTENDED_VERSION_X)"' >> versions
else
@echo 'UBUNTU_GENERIC_KERNEL_VERSION="$(KERN_VER_XYZ)-$(EXTENDED_VERSION_X)"' >> versions
endif
else ifeq ($(OSV_NAME), SUSE)
@echo 'SLES15_SP$(SUSE_PATCHLEVEL)_KERNEL_VERSION="$(KERN_VER_XYZ)-$(OSV_VER).$(EXTENDED_VERSION_X).$(EXTENDED_VERSION_Y)"' >> versions
else ifeq ($(OSV_NAME), RHEL)
ifneq ($(EXTENDED_VERSION_Y),)
ifneq ($(EXTENDED_VERSION_Z),)
@echo 'RHEL_$(OSV_VER)_KERNEL_VERSION="$(KERN_VER_XYZ)-$(EXTENDED_VERSION_X).$(EXTENDED_VERSION_Y).$(EXTENDED_VERSION_Z)"' >> versions
else
@echo 'RHEL_$(OSV_VER)_KERNEL_VERSION="$(KERN_VER_XYZ)-$(EXTENDED_VERSION_X).$(EXTENDED_VERSION_Y)"' >> versions
endif
else
@echo 'RHEL_$(OSV_VER)_KERNEL_VERSION="$(KERN_VER_XYZ)-$(EXTENDED_VERSION_X)"' >> versions
endif
else
@echo '$(OSV_NAME)_KERNEL_VERSION="$(KERN_VER_XYZ)"' >> versions
endif
endif # End - ($(OSV_KV_SUPPORTED), )
endif # ifeq (,$(filter $(PKG_DISTRO_TARGETS), $(MAKECMDGOALS)))
KER_VER = $(subst -,.,$(BASE_KERNEL_NAME))
VERSION := 1.$(DII_TAG).$(BKPT_VER)
ifeq ($(ADD_KER_VER), 1)
VERSION := $(VERSION).$(KER_VER)
endif
ifeq ($(BUILD_CONFIG), nodrm)
VERSION := $(VERSION).$(BUILD_CONFIG)
endif
ifneq ($(BUILD_VERSION), )
RELEASE := $(BUILD_VERSION)
else
RELEASE := 1
endif
ifeq ($(RELEASE_TYPE), opensource)
PKG_SUFFIX=
else
PKG_SUFFIX=-$(RELEASE_TYPE)
endif
#------------------------------------------------------------------------------
# DKMS Package Targets
#------------------------------------------------------------------------------
I915_PKG_NAME_BASENAME=intel-i915-dkms
I915_PKG_NAME := $(I915_PKG_NAME_BASENAME)$(PKG_SUFFIX)
I915_PKG_VERSION := $(VERSION)
I915_PKG_RELEASE := $(RELEASE)
DMA_PKG_NAME_BASENAME=intel-dmabuf-dkms
DMA_PKG_NAME := $(DMA_PKG_NAME_BASENAME)$(PKG_SUFFIX)
DMA_PKG_VERSION := $(VERSION)
DMA_PKG_RELEASE := $(RELEASE)
ifneq (,$(filter $(BUILD_CONFIG_VARIANT), $(BUILD_CONFIG)))
BUILD_KERNEL_VARIANT = $(BUILD_CONFIG)
endif
# dmadkmsrpm-pkg
# Creates Backports dmabuf dkms package
# Rpm generated can be copied to client machine and install
#------------------------------------------------------------------------------
ifneq ($(BUILD_CONFIG), nodrm)
export KBUILD_ONLYDMADIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) drivers/dma-buf drm-include i915-include scripts)
endif
DMA_TAR_CONTENT := $(KBUILD_ONLYDMADIRS) .config Makefile* local-symbols MAINTAINERS \
Kconfig.sources Kconfig Kconfig.package.hacks COPYING versions defconfigs backport-include kconf compat
DMA_DKMS_RPM_MKSPEC := $(BACKPORT_DIR)/scripts/backport-mkdmabufdkmsspec
DMA_DKMS_RPM_MKCONF := $(BACKPORT_DIR)/scripts/backport-mkdmabufdkmsconf
.PHONY: dmadkmsrpm-pkg
dmadkmsrpm-pkg:
cp $(BACKPORT_DIR)/defconfigs/dmabuf .config
$(CONFIG_SHELL) $(DMA_DKMS_RPM_MKCONF) -n $(DMA_PKG_NAME) -v $(DMA_PKG_VERSION) -r $(DMA_PKG_RELEASE) -p $(RELEASE_TYPE) -s $(BUILD_KERNEL_VARIANT) $(CUSTOM_ARG) > $(BACKPORT_DIR)/dkms.conf
$(CONFIG_SHELL) $(DMA_DKMS_RPM_MKSPEC) -n $(DMA_PKG_NAME) -v $(DMA_PKG_VERSION) -r $(DMA_PKG_RELEASE) -p $(RELEASE_TYPE) -s $(BUILD_KERNEL_VARIANT) $(CUSTOM_ARG) > $(BACKPORT_DIR)/$(DMA_PKG_NAME).spec
patch -p1 < $(BACKPORT_DIR)/scripts/disable_drm.patch ;
tar -cz $(RCS_TAR_IGNORE) -f $(DMA_PKG_NAME)-$(DMA_PKG_VERSION)-src.tar.gz \
$(DMA_TAR_CONTENT) $(DMA_PKG_NAME).spec dkms.conf;
+rpmbuild $(RPMOPTS) --target $(ARCH) -ta $(DMA_PKG_NAME)-$(DMA_PKG_VERSION)-src.tar.gz \
--define='_smp_mflags %{nil}'
patch -p1 -R < $(BACKPORT_DIR)/scripts/disable_drm.patch ;
# i915dkmsrpm-pkg
# Creates Backports i915 alone dkms package
# Depends on package generated by dmadkmsrpm-pkg
#------------------------------------------------------------------------------
ifeq ($(BUILD_CONFIG), nodrm)
export KBUILD_ONLYI915DIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) drivers/gpu/drm/i915 drivers/platform drivers/pci drivers/iommu i915-include scripts)
else
export KBUILD_ONLYI915DIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) drivers/gpu drivers/platform drivers/pci drivers/iommu drm-include i915-include scripts)
endif
export KBUILD_ONLYVSECDIRS := drivers/platform/x86/intel
export KBUILD_ONLYPMTDIRS := drivers/mfd
export KBUILD_ONLYMEIDIRS := drivers/misc drivers/watchdog
I915_TAR_CONTENT := $(KBUILD_ONLYI915DIRS) $(KBUILD_ONLYVSECDIRS) $(KBUILD_ONLYPMTDIRS) $(KBUILD_ONLYMEIDIRS) .config Makefile* local-symbols MAINTAINERS \
Kconfig Kconfig.sources Kconfig.package.hacks COPYING versions defconfigs backport-include kconf compat
I915_DKMS_RPM_MKSPEC := $(BACKPORT_DIR)/scripts/backport-mki915dkmsspec
I915_DKMS_RPM_MKCONF := $(BACKPORT_DIR)/scripts/backport-mki915dkmsconf
.PHONY: i915dkmsrpm-pkg
i915dkmsrpm-pkg:
cp $(BACKPORT_DIR)/defconfigs/i915 .config
$(CONFIG_SHELL) $(I915_DKMS_RPM_MKCONF) -n $(I915_PKG_NAME) -v $(I915_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) -s $(BUILD_KERNEL_VARIANT) $(CUSTOM_ARG) > $(BACKPORT_DIR)/dkms.conf
$(CONFIG_SHELL) $(I915_DKMS_RPM_MKSPEC) -n $(I915_PKG_NAME) -v $(I915_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) -s $(BUILD_KERNEL_VARIANT) $(CUSTOM_ARG) > $(BACKPORT_DIR)/$(I915_PKG_NAME).spec
ifeq ($(BUILD_CONFIG), nodrm)
patch -p1 < $(BACKPORT_DIR)/scripts/disable_drm_kconfig.patch ;
else
patch -p1 < $(BACKPORT_DIR)/scripts/disable_dma.patch ;
endif
tar -cz $(RCS_TAR_IGNORE) -f $(I915_PKG_NAME)-$(I915_PKG_VERSION)-src.tar.gz \
$(I915_TAR_CONTENT) $(I915_PKG_NAME).spec dkms.conf;
+rpmbuild $(RPMOPTS) --target $(ARCH) -ta $(I915_PKG_NAME)-$(I915_PKG_VERSION)-src.tar.gz \
--define='_smp_mflags %{nil}'
ifeq ($(BUILD_CONFIG), nodrm)
patch -p1 -R < $(BACKPORT_DIR)/scripts/disable_drm_kconfig.patch ;
else
patch -p1 -R < $(BACKPORT_DIR)/scripts/disable_dma.patch ;
endif
# dkmsrpm-pkg
# Creates Backports both dmabuf and i915 dkms rpm packages
#------------------------------------------------------------------------------
.PHONY: dkmsrpm-pkg
dkmsrpm-pkg: dmadkmsrpm-pkg i915dkmsrpm-pkg
#------------------------------------------------------------------------------
# Binary Package Targets
#------------------------------------------------------------------------------
# binrpm-pkg
# Creates backport binary package for dmabuf, drm, i915 combined
# Build machine should have kernel version and variant binary is targeted for.
#------------------------------------------------------------------------------
ifeq ($(BUILD_CONFIG), nodrm)
export KBUILD_DIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) drivers/gpu/drm/i915 drivers/platform drivers/pci drivers/iommu i915-include scripts)
else
export KBUILD_DIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) drivers/dma-buf drivers/gpu drivers/platform drivers/pci drivers/iommu drm-include i915-include scripts)
endif
##TBD: will this work for nodrm?
MKBINSPEC := $(BACKPORT_DIR)/scripts/backport-mkbinspec
BIN_PACKAGE_NAME := intel-i915$(PKG_SUFFIX)
TAR_CONTENT := $(KBUILD_DIRS) $(KBUILD_ONLYVSECDIRS) $(KBUILD_ONLYPMTDIRS) $(KBUILD_ONLYMEIDIRS) Makefile* local-symbols MAINTAINERS \
Kconfig* COPYING versions defconfigs backport-include kconf compat
#Reads BASE_KERNEL_NAME and replace the '-' to '.'
KER_VER_BIN = $(subst -,.,$(BASE_KERNEL_NAME))
BIN_PKG_VERSION:= $(I915_PKG_VERSION).$(KER_VER_BIN)
.PHONY: binrpm-pkg
binrpm-pkg:
$(CONFIG_SHELL) $(MKBINSPEC) -n $(BIN_PACKAGE_NAME) -v $(BIN_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) -s $(BUILD_KERNEL_VARIANT) -k $(KLIB_BUILD) -a $(UTS_RELEASE) $(CUSTOM_ARG) > $(BACKPORT_DIR)/$(BIN_PACKAGE_NAME).spec
ifeq ($(BUILD_CONFIG), nodrm)
patch -p1 < $(BACKPORT_DIR)/scripts/disable_drm_kconfig.patch ;
endif
tar -cz $(RCS_TAR_IGNORE) -f $(BIN_PACKAGE_NAME)-$(BIN_PKG_VERSION)-src.tar.gz \
$(TAR_CONTENT) $(BIN_PACKAGE_NAME).spec;
+rpmbuild $(RPMOPTS) --target $(ARCH) -ta $(BIN_PACKAGE_NAME)-$(BIN_PKG_VERSION)-src.tar.gz \
--define='_smp_mflags %{nil}' --define='_sourcedir $(PWD)'
ifeq ($(BUILD_CONFIG), nodrm)
patch -p1 -R < $(BACKPORT_DIR)/scripts/disable_drm_kconfig.patch ;
endif
# dmadkmsdeb-pkg
# Creates Backports dmabuf dkms debian package
#------------------------------------------------------------------------------
#read default version from changelog.in and replace it with proper version info during package generation
DEF_VER = $(shell cat debian/changelog_dmabuf.in | head -1 | cut -d '(' -f 2 | cut -d ')' -f 1)
DMADKMSMK_CONTROL := $(BACKPORT_DIR)/scripts/backport-mkdmadebcontrol
DMADKMSMK_RULES := $(BACKPORT_DIR)/scripts/backport-mkdmadebrules
DMADKMSMK_INSTALL := $(BACKPORT_DIR)/scripts/backport-mkdmadebinstall
DMADKMSMK_DKMS := $(BACKPORT_DIR)/scripts/backport-mkdmadebdkms
DMADKMSMK_README := $(BACKPORT_DIR)/scripts/backport-mkdmadebreadme
DMADKMSMK_COPYRIGHT := $(BACKPORT_DIR)/scripts/backport-mkdmadebcopyright
.PHONY: dmadkmsdeb-pkg
dmadkmsdeb-pkg:
cp $(BACKPORT_DIR)/defconfigs/dmabuf .config
patch -p1 < $(BACKPORT_DIR)/scripts/disable_drm.patch ;
$(CONFIG_SHELL) $(DMADKMSMK_CONTROL) -n $(DMA_PKG_NAME) -v $(DMA_PKG_VERSION) -r $(DMA_PKG_RELEASE) -p $(RELEASE_TYPE) -z dkms > $(BACKPORT_DIR)/debian/control
$(CONFIG_SHELL) $(DMADKMSMK_RULES) -n $(DMA_PKG_NAME) -v $(DMA_PKG_VERSION) -r $(DMA_PKG_RELEASE) -p $(RELEASE_TYPE) -z dkms > $(BACKPORT_DIR)/debian/rules
cp $(BACKPORT_DIR)/debian/changelog_i915.in $(BACKPORT_DIR)/debian/changelog
sed -i 's/pkg-name/$(DMA_PKG_NAME)/g' $(BACKPORT_DIR)/debian/changelog
sed -i 's/$(DEF_VER)/$(DMA_PKG_VERSION)/g' $(BACKPORT_DIR)/debian/changelog
for i in $(DMA_TAR_CONTENT); do \
x=$$(expr index $$i "/") ;\
if [ $$x != 0 ]; then \
y=`dirname $$i` ;\
echo "$$i /usr/src/@BACKPORT_PACKAGE_NAME@-@BACKPORT_PACKAGE_VERSION@/$$y";\
else \
echo "$$i /usr/src/@BACKPORT_PACKAGE_NAME@-@BACKPORT_PACKAGE_VERSION@";\
fi \
done > $(BACKPORT_DIR)/debian/$(DMA_PKG_NAME).install.in
$(CONFIG_SHELL) $(DMADKMSMK_DKMS) -n $(DMA_PKG_NAME) -v $(DMA_PKG_VERSION) -r $(DMA_PKG_RELEASE) -p $(RELEASE_TYPE) > $(BACKPORT_DIR)/debian/$(DMA_PKG_NAME).dkms.in
$(CONFIG_SHELL) $(DMADKMSMK_README) -n $(DMA_PKG_NAME) -v $(DMA_PKG_VERSION) -r $(DMA_PKG_RELEASE) -p $(RELEASE_TYPE) > $(BACKPORT_DIR)/debian/README.Debian
$(CONFIG_SHELL) $(DMADKMSMK_COPYRIGHT) -n $(DMA_PKG_NAME) -v $(DMA_PKG_VERSION) -r $(DMA_PKG_RELEASE) -p $(RELEASE_TYPE) > $(BACKPORT_DIR)/debian/copyright
+dch -l "+i${DMA_PKG_RELEASE}-" -m "build ${DMA_PKG_RELEASE}"
+dpkg-buildpackage -j`nproc --all` -us -uc -b -rfakeroot
patch -p1 -R < $(BACKPORT_DIR)/scripts/disable_drm.patch ;
# i915dkmsdeb-pkg
# Creates Backports i915 alone dkms debian package
#------------------------------------------------------------------------------
#read default version from changelog.in and replace it with proper version info during package generation
DEF_VER = $(shell cat debian/changelog_i915.in | head -1 | cut -d '(' -f 2 | cut -d ')' -f 1)
I915DKMSMK_CONTROL := $(BACKPORT_DIR)/scripts/backport-mkdebcontrol
I915DKMSMK_RULES := $(BACKPORT_DIR)/scripts/backport-mkdebrules
I915DKMSMK_INSTALL := $(BACKPORT_DIR)/scripts/backport-mkdebinstall
I915DKMSMK_DKMS := $(BACKPORT_DIR)/scripts/backport-mki915debdkms
I915DKMSMK_README := $(BACKPORT_DIR)/scripts/backport-mkdebreadme
I915DKMSMK_COPYRIGHT := $(BACKPORT_DIR)/scripts/backport-mkdebcopyright
I915_TAR_CONTENT := $(KBUILD_ONLYI915DIRS) $(KBUILD_ONLYVSECDIRS) Makefile* local-symbols MAINTAINERS \
Kconfig Kconfig.sources Kconfig.package.hacks COPYING versions defconfigs backport-include kconf compat
.PHONY: i915dkmsdeb-pkg
i915dkmsdeb-pkg:
ifeq ($(BUILD_CONFIG), nodrm)
patch -p1 < $(BACKPORT_DIR)/scripts/disable_drm_kconfig.patch ;
else
patch -p1 < $(BACKPORT_DIR)/scripts/disable_dma.patch ;
endif
$(CONFIG_SHELL) $(I915DKMSMK_CONTROL) -n $(I915_PKG_NAME) -v $(I915_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) -z dkms > $(BACKPORT_DIR)/debian/control
$(CONFIG_SHELL) $(I915DKMSMK_RULES) -n $(I915_PKG_NAME) -v $(I915_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) -z dkms > $(BACKPORT_DIR)/debian/rules
cp $(BACKPORT_DIR)/debian/changelog_i915.in $(BACKPORT_DIR)/debian/changelog
sed -i 's/pkg-name/$(I915_PKG_NAME)/g' $(BACKPORT_DIR)/debian/changelog
sed -i 's/$(DEF_VER)/$(I915_PKG_VERSION)/g' $(BACKPORT_DIR)/debian/changelog
for i in $(I915_TAR_CONTENT); do \
z=$$(expr index $$i "=") ;\
if [ $$z = 0 ]; then \
x=$$(expr index $$i "/");\
if [ $$x != 0 ]; then \
y=`dirname $$i` ;\
echo "$$i /usr/src/@BACKPORT_PACKAGE_NAME@-@BACKPORT_PACKAGE_VERSION@/$$y";\
else \
echo "$$i /usr/src/@BACKPORT_PACKAGE_NAME@-@BACKPORT_PACKAGE_VERSION@";\
fi \
fi \
done > $(BACKPORT_DIR)/debian/$(I915_PKG_NAME).install.in
$(CONFIG_SHELL) $(I915DKMSMK_DKMS) -n $(I915_PKG_NAME) -v $(I915_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) -s $(BUILD_KERNEL_VARIANT) > $(BACKPORT_DIR)/debian/$(I915_PKG_NAME).dkms.in
$(CONFIG_SHELL) $(I915DKMSMK_README) -n $(I915_PKG_NAME) -v $(I915_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) > $(BACKPORT_DIR)/debian/README.Debian
$(CONFIG_SHELL) $(I915DKMSMK_COPYRIGHT) -n $(I915_PKG_NAME) -v $(I915_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) > $(BACKPORT_DIR)/debian/copyright
+dch -l "+i${I915_PKG_RELEASE}-" -m "build ${I915_PKG_RELEASE}"
+dpkg-buildpackage -j`nproc --all` -us -uc -b -rfakeroot
ifeq ($(BUILD_CONFIG), nodrm)
patch -p1 -R < $(BACKPORT_DIR)/scripts/disable_drm_kconfig.patch ;
else
patch -p1 -R < $(BACKPORT_DIR)/scripts/disable_dma.patch ;
endif
# dkmsdeb-pkg
# Creates Backports both dmabuf and i915 dkms debian packages
#------------------------------------------------------------------------------
.PHONY: dkmsdeb-pkg
dkmsdeb-pkg: dmadkmsdeb-pkg i915dkmsdeb-pkg
# bindeb-pkg
# Creates backport debian binary package for dmabuf, drm, i915 combined
# Build machine should have kernel version and variant binary is targeted for.
#------------------------------------------------------------------------------
ifneq ($(BUILD_CONFIG), nodrm)
export KBUILD_DIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) drivers/dma-buf drivers/gpu drivers/platform drivers/pci drivers/iommu drm-include i915-include scripts)
endif
TAR_CONTENT := $(KBUILD_DIRS) $(KBUILD_ONLYVSECDIRS) $(KBUILD_ONLYPMTDIRS) $(KBUILD_ONLYMEIDIRS) Makefile* local-symbols MAINTAINERS \
Kconfig* COPYING versions defconfigs backport-include kconf compat
I915_BIN_PKG_NAME_BASENAME=intel-i915
I915_BIN_PKG_NAME := $(I915_BIN_PKG_NAME_BASENAME)$(PKG_SUFFIX)
MK_DEB_CONTROL := $(BACKPORT_DIR)/scripts/backport-mkdebcontrol
MK_DEB_RULES := $(BACKPORT_DIR)/scripts/backport-mkdebrules
MK_DEB_README := $(BACKPORT_DIR)/scripts/backport-mkdebreadme
MK_DEB_COPYRIGHT := $(BACKPORT_DIR)/scripts/backport-mkdebcopyright
#Reads BASE_KERNEL_NAME and replace the '-' to '.'
#This will be used for package generation.
KER_VER_BIN := $(subst -,.,$(BASE_KERNEL_NAME))
I915_BIN_PKG_VERSION := $(I915_PKG_VERSION).$(KER_VER_BIN)
.PHONY: bindeb-pkg
bindeb-pkg:
$(CONFIG_SHELL) $(MK_DEB_CONTROL) -n $(I915_BIN_PKG_NAME) -v $(I915_BIN_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) -z binary > $(BACKPORT_DIR)/debian/control
$(CONFIG_SHELL) $(MK_DEB_RULES) -n $(I915_BIN_PKG_NAME) -v $(I915_BIN_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) -z binary -k $(KLIB) > $(BACKPORT_DIR)/debian/rules
cp $(BACKPORT_DIR)/debian/changelog_i915.in $(BACKPORT_DIR)/debian/changelog
sed -i 's/pkg-name/$(I915_BIN_PKG_NAME)/g' $(BACKPORT_DIR)/debian/changelog
sed -i 's/$(DEF_VER)/$(I915_BIN_PKG_VERSION)/g' $(BACKPORT_DIR)/debian/changelog
for i in $(TAR_CONTENT); do \
z=$$(expr index $$i "=") ;\
if [ $$z = 0 ]; then \
x=$$(expr index $$i "/");\
if [ $$x != 0 ]; then \
y=`dirname $$i` ;\
echo "$$i /usr/src/@BACKPORT_PACKAGE_NAME@-@BACKPORT_PACKAGE_VERSION@/$$y";\
else \
echo "$$i /usr/src/@BACKPORT_PACKAGE_NAME@-@BACKPORT_PACKAGE_VERSION@";\
fi \
fi \
done > $(BACKPORT_DIR)/debian/$(I915_PKG_NAME).install.in
$(CONFIG_SHELL) $(MK_DEB_README) -n $(I915_BIN_PKG_NAME) -v $(I915_BIN_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) > $(BACKPORT_DIR)/debian/README.Debian
$(CONFIG_SHELL) $(MK_DEB_COPYRIGHT) -n $(I915_BIN_PKG_NAME) -v $(I915_BIN_PKG_VERSION) -r $(I915_PKG_RELEASE) -p $(RELEASE_TYPE) > $(BACKPORT_DIR)/debian/copyright
+dch -l "+i${I915_PKG_RELEASE}-" -m "build ${I915_PKG_RELEASE}"
+dpkg-buildpackage -j`nproc --all` -nc -uc -b
#------------------------------------------------------------------------------
# Make build clean Targets
#------------------------------------------------------------------------------
# Clean extension target to remove basic clean-up
#------------------------------------------------------------------------------
.PHONY: clean
clean:
@rm -f $(version_h)
# Make Mr proper to clean-up all generated files.
# Versions file will not be cleaned-up to maintain built kernel versions.
#------------------------------------------------------------------------------
.PHONY: mrproper
mrproper:
@rm -f $(backport_path_h)
@rm -f debian/README.Debian
@rm -f debian/changelog
@rm -f debian/control
@rm -f debian/copyright
@rm -f debian/$(I915_PKG_NAME_BASENAME)*.dkms.in
@rm -f debian/$(I915_PKG_NAME_BASENAME)*.install.in
@rm -f debian/$(DMA_PKG_NAME_BASENAME)*.dkms.in
@rm -f debian/$(DMA_PKG_NAME_BASENAME)*.install.in
@rm -rf debian/$(DMA_PKG_NAME_BASENAME)*
@rm -rf debian/$(I915_PKG_NAME_BASENAME)*
@rm -f debian/rules
@rm -f $(BACKPORT_DIR)/$(BIN_PACKAGE_NAME)*.spec
@rm -f $(BACKPORT_DIR)/$(BIN_PACKAGE_NAME)*-src.tar.gz
@rm -f $(BACKPORT_DIR)/$(DMA_PKG_NAME_BASENAME)*.spec
@rm -f $(BACKPORT_DIR)/$(DMA_PKG_NAME_BASENAME)*-src.tar.gz
@rm -f $(BACKPORT_DIR)/dkms.conf
@test -f .config && $(MAKE) clean || true
else
include $(BACKPORT_DIR)/Makefile.kernel
endif # End - ($(KERNELRELEASE),)
PHONY += FORCE
FORCE: