-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
prepare
2084 lines (1842 loc) · 75.5 KB
/
prepare
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
#!/bin/bash
# List of kernels that are maintained upstream
_current_kernels=("6.13" "6.12" "6.11" "6.10" "6.6" "6.1" "5.15")
# List of kernels that are no longer maintained either upstream or locally
_eol_kernels=("6.9" "6.8" "6.7" "6.5" "6.4" "6.3" "6.2" "6.0" "5.19" "5.18" "5.17" "5.16" "5.14" "5.13" "5.12" "5.11" "5.9" "5.8" "5.7" "5.4.230" "5.10.135")
typeset -Ag _kernel_git_remotes
_kernel_git_remotes=(
["kernel.org"]="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
["googlesource.com"]="https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable"
["github.com"]="https://github.com/gregkh/linux.git"
["torvalds"]="https://github.com/torvalds/linux.git"
)
_git_remote_names=( "${!_kernel_git_remotes[@]}" )
if [[ ! "${_git_remote_names[@]}" =~ "$_git_mirror" ]]; then
warning "git mirror '$_git_mirror' not recognized"
_git_mirror=""
fi
if [[ -z "$_git_mirror" ]]; then
_git_mirror="${_git_remote_names[2]}"
if $( ! timeout 5 git ls-remote ${_kernel_git_remotes[$_git_mirror]} >/dev/null ) || [[ "$( git ls-remote ${_kernel_git_remotes[$_git_mirror]} | head -n 1 )" = *502* ]]; then
warning "kernel.org unreachable or too long to respond"
_git_mirror="${_git_remote_names[0]}"
fi
echo "Defaulting to ${_git_mirror} git mirror"
fi
# Fillout the latest tags map/dictionary
_kernel_tags=$(git -c 'versionsort.suffix=-' \
ls-remote --exit-code --refs --sort='version:refname' --tags ${_kernel_git_remotes[$_git_mirror]} '*.*' \
| cut --delimiter='/' --fields=3)
typeset -Ag _kver_latest_tags_map
for _key in "${_current_kernels[@]}" "${_eol_kernels[@]}"; do
_kver_latest_tags_map[$_key]=$(echo "$_kernel_tags" | grep -F "v$_key"| grep -v "v$_key"[0-9] | tail -1 | cut -c1-)
done
# PREEMPT_RT's supported kernel subversion
typeset -Ag _rt_subver_map
_rt_subver_map=(
["5.4"]="271"
["5.9"]="1"
["5.10"]="221"
["5.11"]="4"
["5.14"]="2"
["5.15"]="160"
["5.16"]="2"
["5.17"]="1"
["6.0"]="5"
["6.1"]="99"
["6.3"]="3"
["6.4"]="6"
["6.5"]="2"
["6.6"]="41"
["6.7"]="0"
["6.8"]="2"
["6.9"]="0"
["6.10"]="rc6"
)
# PREEMPT_RT's patch revision for the kernel
# We separated this to allow for forcing the application of the patch when _preempt_rt_force=1 on version mismatch
typeset -Ag _rt_rev_map
_rt_rev_map=(
["5.4"]="89"
["5.9"]="20"
["5.10"]="113"
["5.11"]="11"
["5.14"]="21"
["5.15"]="77"
["5.16"]="19"
["5.17"]="17"
["6.0"]="14"
["6.1"]="36"
["6.3"]="15"
["6.4"]="8"
["6.5"]="8"
["6.6"]="37"
["6.7"]="6"
["6.8"]="11"
["6.9"]="5"
["6.10"]="11"
)
_undefine() {
for _config_name in "$@"; do
scripts/config -k --undefine "${_config_name}"
done
}
_enable() {
for _config_name in "$@"; do
scripts/config -k --enable "${_config_name}"
done
}
_disable() {
for _config_name in "$@"; do
scripts/config -k --disable "${_config_name}"
done
}
_module() {
for _config_name in "$@"; do
scripts/config -k --module "${_config_name}"
done
}
_prompt_from_array() {
# Prompts from array, selects default index on empty user input
# Set the _default_index variable to enable default index selection
if [ $# = "0" ]; then
warning "Prompting on an empty array, please report this issue."
exit 1
fi
_N=$(($#-1))
_index=0
for _value in "$@"; do
if [ "$_index" = "$_default_index" ]; then
plain " > ${_index}) ${_value}"
else
plain " ${_index}) ${_value}"
fi
_index=$(($_index + 1))
done
while true; do
read -rp "[0-${_N}]: ";
if [[ -z "$REPLY" && -n "$_default_index" ]]; then
_selected_index="$_default_index"
break
elif [[ "$REPLY" =~ ^[0-9]+$ && 0 -le "$REPLY" && "$REPLY" -le $_N ]]; then
_selected_index="$REPLY"
break
else
echo "Wrong selection: select any number in 0-$_N"
fi
done
_natural_index=$(($_selected_index + 1))
_selected_value="${!_natural_index}"
plain "Selected: ${_selected_value}"
unset _natural_index
unset _default_index
}
_set_kver_internal_vars() {
# Sets _basever and _basekernel from _kernel_git_tag
# Major Minor Sub/Patch
_kver_split=( "" "" "" )
_cur_index=0
_kernel_ver_str="$_kernel_git_tag"
[[ "${_kernel_git_tag:0:1}" == "v" ]] && _kernel_ver_str=$(echo "$_kernel_git_tag" | cut -c2-)
# we start from index 1 since index 0 is 'v'
for (( i=0; i<${#_kernel_ver_str}; i++ )); do
_cur_char="${_kernel_ver_str:$i:1}"
if [[ "$_cur_char" == "." || "$_cur_char" == "-" ]]; then
_cur_index=$((_cur_index + 1))
else
_kver_split[$_cur_index]+="$_cur_char"
fi
done
# examples: "6.0", "5.15", "5.4"
_basekernel="${_kver_split[0]}.${_kver_split[1]}"
# examples: "60", "515", "54"
_basever="${_kver_split[0]}${_kver_split[1]}"
# examples: "5", "rc2", "122"
if [ -n "${_kver_split[2]}" ]; then
_sub="${_kver_split[2]}"
else
_sub="0"
fi
# Append a zero to the minor if it has single digit
[[ ${#_kver_split[1]} == "1" ]] && _kver_split[1]="0${_kver_split[1]}"
# examples: "600", "515", "504" we use this variable to have proper comparisons
_kver="${_kver_split[0]}${_kver_split[1]}"
if [ $_kver -le 605 ]; then
# chosen kernel <= 6.5
_default_cpu_sched="cfs"
else
# chosen kernel >= 6.6
_default_cpu_sched="eevdf"
fi
echo -e "_basekernel='$_basekernel'\n_basever='$_basever'\n_sub='$_sub'\n_kver='$_kver'\n_default_cpu_sched='$_default_cpu_sched'" > "$_where"/BIG_UGLY_FROGMINER
}
_set_kernel_version() {
# if $_version is a valid x.y version, define $_kernel_git_tag with latest x.y.z from $_kver_latest_tags_map
# if $_version is a valid x.y.z version, define $_kernel_git_tag directly
# Otherwise, empty it so it gets prompted
_searched_tag="$_version"
# prepend "v" if it's not there already
[[ "${_searched_tag:0:1}" != "v" ]] && _searched_tag="v$_searched_tag"
_version_search="$(echo "$_kernel_tags" | grep -F "$_searched_tag" | head -1)"
if [[ "$_searched_tag" = *.0 ]]; then
_searched_tag="${_searched_tag%.0}"
_version_search="${_searched_tag%.0}"
fi
if [[ -n "$_version" ]]; then
if [[ -v _kver_latest_tags_map[$_version] ]]; then
msg2 "Checking out latest kernel version of $_version"
_kernel_git_tag="${_kver_latest_tags_map[$_version]}"
elif [[ "$_searched_tag" == "$_version_search" ]]; then
msg2 "Checking out user-defined kernel version : $_version"
_kernel_git_tag="$_searched_tag"
else
[[ -n "$_version" ]] && echo "kernel version $_version not recognized, prompting..."
_version=""
fi
fi
if [ -z "$_version" ]; then
msg2 "Which kernel version do you want to install?"
# Create a list of currently maintained kernels versions with their sub-version added
_kernel_fullver_list=()
for _key in "${_current_kernels[@]}"; do
_kernel_fullver_list+=("${_kver_latest_tags_map[$_key]}")
done
# Add the "Another" entry to enable building unmaintained kernel versions
_kernel_fullver_list+=("Another (no longer maintained upstream)")
# Default index corresponds to latest stable kernel
# put default index to "1" when the most recent kernel is an rc one
_default_index="0"
if [[ "${_kver_latest_tags_map[${_current_kernels[0]}]}" == *rc* ]]; then
_default_index="1"
fi
_prompt_from_array "${_kernel_fullver_list[@]}"
if [[ "${_selected_value}" == Another* ]]; then
msg2 "Which EOL kernel version do you want to install?"
_kernel_fullver_list=()
for _key in "${_eol_kernels[@]}"; do
_kernel_fullver_list+=("${_kver_latest_tags_map[$_key]}")
done
# Default index corresponds to latest unmaintained kernel
_default_index="0"
_prompt_from_array "${_kernel_fullver_list[@]}"
fi
_kernel_git_tag="$_selected_value"
fi
_set_kver_internal_vars
}
_set_cpu_scheduler() {
declare -A _sched_description_array
_sched_description_array=(
["pds"]="Project C / PDS"
["bmq"]="Project C / BMQ"
["eevdf"]="EEVDF (Earliest Eligible Virtual Deadline First scheduler) Linux kernel's default for ≥ 6.6"
["cfs"]="CFS (Completely Fair Scheduler) Linux kernel's default for ≤ 6.5"
["muqss"]="MuQSS (Multiple Queue Skiplist Scheduler)"
["upds"]="Undead PDS (TkG)"
["cacule"]="CacULE"
["tt"]="TT (TaskType)"
["echo"]="ECHO (Enhanced CPU Handling Orchestrator)"
["bore"]="BORE (Burst-Oriented Response Enhancer) CPU Scheduler"
["bore-eevdf"]="BORE (Burst-Oriented Response Enhancer - EEVDF variant) CPU Scheduler"
)
# CPU SCHED selector - _projectc_unoff=1 sets unofficial Project C revision flag for a given version
if [ "$_kver" = "504" ]; then
_avail_cpu_scheds=("pds" "bmq" "muqss" "cacule" "cfs")
elif [ "$_kver" = "507" ]; then
_avail_cpu_scheds=("pds" "bmq" "muqss" "cfs")
elif [ "$_kver" = "508" ]; then
_avail_cpu_scheds=("upds" "pds" "bmq" "cfs")
elif [[ "$_kver" =~ ^(509|511)$ ]]; then
_avail_cpu_scheds=("upds" "pds" "bmq" "muqss" "cfs")
elif [ "$_kver" = "510" ]; then
_avail_cpu_scheds=("upds" "pds" "bmq" "muqss" "cacule" "cfs")
elif [ "$_kver" = "512" ]; then
_avail_cpu_scheds=("pds" "bmq" "muqss" "cacule" "cfs")
elif [ "$_kver" = "513" ]; then
_avail_cpu_scheds=("pds" "bmq" "muqss" "cacule" "cfs")
elif [ "$_kver" = "514" ]; then
_avail_cpu_scheds=("pds" "bmq" "cacule" "cfs")
elif [ "$_kver" = "515" ]; then
_avail_cpu_scheds=("pds" "bmq" "cacule" "tt" "bore" "cfs")
elif [ "$_kver" = "516" ]; then
_avail_cpu_scheds=("pds" "bmq" "cacule" "cfs")
elif [ "$_kver" = "517" ]; then
_avail_cpu_scheds=("pds" "bmq" "cacule" "tt" "cfs" "bore")
elif [ "$_kver" = "518" ]; then
_avail_cpu_scheds=("cfs" "pds" "bmq" "cacule" "tt" "bore")
elif [ "$_kver" = "519" ]; then
_avail_cpu_scheds=("cfs" "pds" "bmq" "cacule" "tt" "bore")
elif [ "$_kver" = "600" ]; then
_avail_cpu_scheds=("cfs" "pds" "bmq" "tt" "bore")
elif [ "$_kver" = "601" ]; then
_avail_cpu_scheds=("cfs" "pds" "bmq" "tt" "bore")
elif [ "$_kver" = "602" ]; then
_avail_cpu_scheds=("cfs" "pds" "bmq" "tt" "bore")
elif [ "$_kver" = "603" ]; then
_avail_cpu_scheds=("cfs" "pds" "bmq" "tt" "bore")
elif [ "$_kver" = "604" ]; then
_avail_cpu_scheds=("cfs" "eevdf" "pds" "bmq" "tt" "bore")
elif [ "$_kver" = "605" ]; then
_avail_cpu_scheds=("cfs" "eevdf" "pds" "bmq" "tt" "bore" "bore-eevdf")
elif [ "$_kver" = "606" ]; then
_avail_cpu_scheds=("eevdf" "bore" "pds" "bmq")
elif [ "$_kver" = "607" ]; then
_avail_cpu_scheds=("eevdf" "bore" "echo" "pds" "bmq")
elif [ "$_kver" = "608" ]; then
_avail_cpu_scheds=("eevdf" "bore" "echo" "pds" "bmq")
elif [ "$_kver" = "609" ]; then
_avail_cpu_scheds=("eevdf" "bore" "pds" "bmq")
elif [ "$_kver" = "610" ]; then
_avail_cpu_scheds=("eevdf" "bore" "pds" "bmq")
elif [ "$_kver" = "611" ]; then
_avail_cpu_scheds=("eevdf" "bore" "pds" "bmq")
elif [ "$_kver" = "612" ]; then
_avail_cpu_scheds=("eevdf" "bore" "pds" "bmq")
elif [ "$_kver" = "613" ]; then
_avail_cpu_scheds=("eevdf" "bore" "pds" "bmq")
else
_avail_cpu_scheds=("$_default_cpu_sched")
fi
if [ "${_preempt_rt}" = "1" ]; then
warning "! Since you have enabled _preempt_rt, incompatible cpu schedulers will not be available !"
if [[ "${_avail_cpu_scheds[*]}" =~ "cfs" ]]; then
_avail_cpu_scheds_rt=("cfs")
fi
if [[ "${_avail_cpu_scheds[*]}" =~ "eevdf" ]] && ! [[ "${_avail_cpu_scheds[*]}" =~ "cfs" ]]; then
_avail_cpu_scheds_rt=("eevdf")
fi
_avail_cpu_scheds=(${_avail_cpu_scheds_rt[*]})
fi
# Populate descriptions of the available CPU schedulers
_avail_cpu_scheds_text=()
for _sched in "${_avail_cpu_scheds[@]}"; do
if [ "$_sched" = "pds" ] || [ "$_sched" = "bmq" ] && [ "$_projectc_unoff" = "1" ]; then
_avail_cpu_scheds_text+=("Project C / ${_sched^^} (unofficial port - ! possibly unstable !)")
else
_avail_cpu_scheds_text+=("${_sched_description_array[$_sched]}")
fi
done
if ! [[ ${_avail_cpu_scheds[*]} =~ "$_cpusched" ]]; then
warning "Your cpusched selection ( $_cpusched ) is not available for the selected kernel version."
if [ "$_nofallback" = "true" ]; then
warning "Since _nofallback is enabled, let's exit..."
exit 1
else
warning "Please select another"
_cpusched=""
fi
fi
if [ -z "$_cpusched" ]; then
msg2 "Which CPU sched variant do you want to build/install?"
msg2 "Select \"$_default_cpu_sched\" (linux kernel's default) if unsure."
_default_index="0"
_prompt_from_array "${_avail_cpu_scheds_text[@]}"
_cpusched=${_avail_cpu_scheds[$_selected_index]}
fi
echo -e "_cpusched='$_cpusched'" >> "$_where"/BIG_UGLY_FROGMINER
}
_set_compiler(){
if ! [[ "$_compiler" =~ ^(gcc|llvm)$ ]]; then
if [ -n "$_compiler" ] && [ "$_nofallback" = "true" ]; then
msg2 "Compiler \" $_compiler \" not recognized, exiting... "
exit 1
else
plain "Which compiler do you want to use?"
_compiler_array_text=("GCC (recommended)" "Clang/LLVM")
_compiler_array=("gcc" "llvm")
_default_index="0"
_prompt_from_array "${_compiler_array_text[@]}"
_compiler="${_compiler_array[$_selected_index]}"
fi
fi
if [ "$_compiler" = "llvm" ]; then
_compiler_name="-llvm"
llvm_opt="LLVM=1 LLVM_IAS=${_llvm_ias:-0}"
if [ $_kver -ge 512 ]; then
if [[ -z "$_lto_mode" || ! "$_lto_mode" =~ ^(no|thin|full)$ ]]; then
plain "Would you like to enable Clang Link Time Optimizations (LTO) ? It may improve the performance of the kernel."
warning "This is currently experimental and might result in an unbootable kernel - Not recommended"
_lto_prompt_array=(
"No: do not enable LTO"
"Full: uses 1 thread for Linking, slow and uses more memory, theoretically with the highest performance gains."
"Thin: uses multiple threads, faster and uses less memory, may have a lower runtime performance than Full."
)
_lto_mode_array=("no" "full" "thin")
_default_index="0"
_prompt_from_array "${_lto_prompt_array[@]}"
_lto_mode="${_lto_mode_array[$_selected_index]}"
fi
if [ "$_lto_mode" != "no" ]; then
llvm_opt="LLVM=1 LLVM_IAS=1"
fi
elif [[ -n "$_lto_mode" && "$_lto_mode" != "no" ]]; then
warning "Clang LTO is only available on linux 5.12 onwards."
_lto_mode="no"
fi
else # GCC
_compiler_name=""
llvm_opt=""
fi
echo -e "_compiler_name='$_compiler_name'\nllvm_opt='$llvm_opt'" >> "$_where"/BIG_UGLY_FROGMINER
}
_define_kernel_abs_paths() {
source "$_where"/BIG_UGLY_FROGMINER
if [ -z "$_kernel_work_folder_abs" ]; then
_kernel_work_folder_abs="$_where/$_kernel_work_folder/linux-src-git"
if [[ "$_kernel_work_folder" == /* ]]; then
_kernel_work_folder_abs="$_kernel_work_folder/linux-tkg/linux-src-git"
fi
echo -e "_kernel_work_folder_abs=\"$_kernel_work_folder_abs\"" >> "$_where"/BIG_UGLY_FROGMINER
fi
if [ -z "$_kernel_source_folder_abs" ]; then
_kernel_source_folder_abs="$_where/$_kernel_source_folder/linux-kernel.git"
if [[ "$_kernel_source_folder" == /* ]]; then
_kernel_source_folder_abs="$_kernel_source_folder/linux-tkg/linux-kernel.git"
fi
echo -e "_kernel_source_folder_abs=\"$_kernel_source_folder_abs\"" >> "$_where"/BIG_UGLY_FROGMINER
fi
}
_setup_kernel_work_folder() {
_define_kernel_abs_paths
if [ -z "$_kernel_git_tag" ]; then
warning "internal error: kernel version should be chosen before cloning kernel sources"
exit 1
fi
cd "$_where"
if ! [ -d "$_kernel_source_folder_abs" ]; then
msg2 "First initialization of the linux source code git folder"
mkdir -p "$_kernel_source_folder_abs"
cd "$_kernel_source_folder_abs"
git -c init.defaultBranch=master init --bare
fi
cd "$_kernel_source_folder_abs"
# Add remotes if needed
for remote in "${!_kernel_git_remotes[@]}"; do
if ! git remote -v | grep -w "$remote" ; then
git remote add "$remote" "${_kernel_git_remotes[$remote]}"
fi
done
msg2 "Fetching tag: $_kernel_git_tag from mirror $_git_mirror"
git fetch --depth 1 $_git_mirror tag "$_kernel_git_tag"
msg2 "Checking out tag: $_kernel_git_tag"
msg2 " in the work folder: $_kernel_work_folder_abs"
# The space ' ' in grep -w "$_kernel_work_folder_abs " is important
# to not match an existing folder with a longer name with the same prefix name
if [ -d "$_kernel_work_folder_abs" ] && \
( git worktree list | grep -w "$_kernel_work_folder_abs " ) && \
( cd "$_kernel_work_folder_abs" && git status > /dev/null 2>&1 ); then
# Worktree folder exists and is a valid worktree
cd "$_kernel_work_folder_abs"
git reset --hard
git clean -ffdx
git checkout "$_kernel_git_tag"
else
# In all other cases, just force create the work tree
rm -rf "$_kernel_work_folder_abs"
git worktree add -f "$_kernel_work_folder_abs" "$_kernel_git_tag"
fi
}
_tkg_initscript() {
if ! whereis git > /dev/null 2>&1; then
warning "the 'git' command is not installed. Please install it then re-run the install script of linux-tkg."
exit 1
fi
if ! git status > /dev/null 2>&1; then
warning "linux-tkg needs to be git cloned"
msg2 "please delete the current linux-tkg folder and re-created it with"
msg2 "git clone --depth=1 https://github.com/Frogging-Family/linux-tkg.git"
exit 1
fi
typeset -Ag _deprecated_config_var_set
# Check if user is defining deprecated config vars
_deprecated_config_var_set=(
["_use_tmpfs"]=`[ -n "$_use_tmpfs" ]; echo $?`
["_source_in_tmpfs"]=`[ -n "$_source_in_tmpfs" ]; echo $?`
["_tmpfs_path"]=`[ -n "$_tmpfs_path" ]; echo $?`
)
for _deprectated_config_var in "${!_deprecated_config_var_set[@]}"; do
if [ "${_deprecated_config_var_set[$_deprectated_config_var]}" == "0" ]; then
warning "The deprecated config var $_deprectated_config_var has been set"
warning "Please check the latest customization.cfg file to see what replaces it"
exit 1
fi
done
# Default to Arch
if [ -z "$_distro" ] || [ "$_ispkgbuild" = "true" ]; then
msg2 "Defaulting to Archlinux target\n"
_distro="Arch"
fi
# create build dir early
_path="${_where}"
# Clean the logs folder
[ -e "${_where}/logs" ] && rm -rf "${_where}/logs"
mkdir -p "${_where}/logs"
# Select Kernel version
_set_kernel_version
# Select CPU scheduler
_set_cpu_scheduler
cp "$_where"/linux-tkg-patches/${_basekernel}/* "$_where" # copy patches inside the PKGBUILD's dir to preserve makepkg sourcing and md5sum checking
cp "$_where"/linux-tkg-config/${_basekernel}/* "$_where" # copy config files and hooks inside the PKGBUILD's dir to preserve makepkg sourcing and md5sum checking
# Set compiler
_set_compiler
if [ -n "$_custom_pkgbase" ]; then
echo -e "_custom_pkgbase=\"$_custom_pkgbase\"" >> "$_where"/BIG_UGLY_FROGMINER
fi
_setup_kernel_work_folder
}
user_patcher() {
for _f in "$_where"/*."${_userpatch_ext}patch" "$_where"/*."${_userpatch_ext}revert"; do
if [ -e "${_f}" ]; then
warning "Found userpatch file ${f##*/} in the PKGBUILD directory." #"
warning "Userpatches must now be placed in version-specific subdirectories (linux${_basever}-tkg-userpatches for this kernel version)."
warning "The patch will not be applied."
fi
done
echo -e "linux-tkg user patches, if any:\n" >> "$_where"/logs/prepare.log.txt
# To patch the user because all your base are belong to us
local _patches=("$_where"/linux"$_basever"-tkg-userpatches/*."${_userpatch_ext}revert")
if [ ${#_patches[@]} -ge 2 ] || [ -e "${_patches}" ]; then
if [ "$_user_patches_no_confirm" != "true" ]; then
msg2 "Found ${#_patches[@]} 'to revert' userpatches for ${_userpatch_target}:"
printf '%s\n' "${_patches[@]}"
read -rp "Do you want to install it/them? - Be careful with that ;)"$'\n> N/y : ' _CONDITION;
fi
if [[ "$_CONDITION" =~ [yY] ]] || [ "$_user_patches_no_confirm" = "true" ]; then
for _f in "${_patches[@]}"; do
if [ -e "${_f}" ]; then
msg2 "######################################################"
msg2 ""
msg2 "Reverting your own ${_userpatch_target} patch ${_f}"
msg2 ""
msg2 "######################################################"
patch -Np1 -R < "${_f}"
echo "Reverted your own patch ${_f}" >> "$_where"/logs/prepare.log.txt
fi
done
fi
fi
_patches=("$_where"/linux"$_basever"-tkg-userpatches/*."${_userpatch_ext}patch")
if [ ${#_patches[@]} -ge 2 ] || [ -e "${_patches}" ]; then
if [ "$_user_patches_no_confirm" != "true" ]; then
msg2 "Found ${#_patches[@]} userpatches for ${_userpatch_target}:"
printf '%s\n' "${_patches[@]}"
read -rp "Do you want to install it/them? - Be careful with that ;)"$'\n> N/y : ' _CONDITION;
fi
if [[ "$_CONDITION" =~ [yY] ]] || [ "$_user_patches_no_confirm" = "true" ]; then
for _f in "${_patches[@]}"; do
if [ -e "${_f}" ]; then
msg2 "######################################################"
msg2 ""
msg2 "Applying your own ${_userpatch_target} patch ${_f}"
msg2 ""
msg2 "######################################################"
patch -Np1 < "${_f}"
echo "Applied your own patch ${_f}" >> "$_where"/logs/prepare.log.txt
fi
done
fi
fi
}
_tkg_patcher() {
if [ -e "$tkgpatch" ] && [[ $(wc -l <"$tkgpatch") -ge 7 ]]; then
msg2 "$_msg"
echo -e "### Applying ${tkgpatch##*/}... ###" >> "$_where"/logs/prepare.log.txt
patch -Np1 -i "$tkgpatch" >> "$_where"/logs/prepare.log.txt || error "An error was encountered applying patches. It was logged to the prepare.log.txt file."
echo -e "\n" >> "$_where"/logs/prepare.log.txt
else
msg2 "Skipping patch ${tkgpatch##*/}...\n (unavailable for this kernel version)"
fi
}
_tkg_srcprep() {
_define_kernel_abs_paths
cd "$_kernel_work_folder_abs"
if (( "$_kver" <= 602 )); then
msg2 "Setting version..."
scripts/setlocalversion --save-scmversion
fi
if [ "${_distro}" = "Arch" ]; then
if [ -n "$_custom_pkgbase" ]; then
if [[ "$_custom_pkgbase" != *tkg* ]]; then
_localversion_tag="-tkg-"
else
_localversion_tag="-"
fi
echo "-${pkgrel}${_localversion_tag}${_custom_pkgbase}" > localversion.10-pkgrel
echo -e "Version tail set to \"-${pkgrel}${_localversion_tag}${_custom_pkgbase}\"\n" > "$_where"/logs/prepare.log.txt
else
echo "-$pkgrel-tkg-${_cpusched}${_compiler_name}" > localversion.10-pkgrel
echo -e "Version tail set to \"-$pkgrel-tkg-${_cpusched}${_compiler_name}\"\n" > "$_where"/logs/prepare.log.txt
fi
echo "" > localversion.20-pkgname
fi
# Hardened Patches
if [ "${_configfile}" = "config_hardened.x86_64" ] && [ "${_cpusched}" = "cfs" ]; then
tkgpatch="$srcdir/0012-linux-hardened.patch"
_msg="Using linux hardened patchset" && _tkg_patcher
else
tkgpatch="$srcdir/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch"
_msg="Using Arch patches" && _tkg_patcher
fi
if [ -z $_debug ]; then
# graysky's cpu opts - https://github.com/graysky2/kernel_compiler_patch
_patch_location="$srcdir"
if [ "$_kver" = "504" ]; then
_patch_name="more-ISA-levels-and-uarches-for-kernel-4.19-5.4"
elif [ "$_kver" = "507" ]; then
_outdated="outdated_versions/"
_patch_name="enable_additional_cpu_optimizations_for_gcc_v10.1+_kernel_v5.7"
elif (( 508 <= "$_kver" && "$_kver" <= 514 )); then
_patch_name="more-ISA-levels-and-uarches-for-kernel-5.8-5.14"
elif [[ "$_kver" =~ ^(515|516)$ ]]; then
_patch_name="more-ISA-levels-and-uarches-for-kernel-5.15-5.16"
elif ( [ "$_kver" = "601" ] && [ "$_sub" -lt "79" ] ) || ( [ "$_kver" = "606" ] && [ "$_sub" -lt "18" ] ) || ( [ "$_kver" = "607" ] && [ "$_sub" -lt "6" ] ) || [[ "$_kver" =~ ^(517|518|519|600|602|603|604|605)$ ]]; then
_patch_name="more-ISA-levels-and-uarches-for-kernel-5.17-6.1.78"
else
_patch_name="more-ISA-levels-and-uarches-for-kernel-6.1.79+"
fi
curl "https://raw.githubusercontent.com/graysky2/kernel_compiler_patch/master/${_outdated}${_patch_name}.patch" > "$srcdir"/"${_patch_name}".patch || true
tkgpatch="${_patch_location}/${_patch_name}.patch"
if [ -e "$tkgpatch" ]; then
_msg="Applying graysky's cpu opts patch" && _tkg_patcher
if grep -wq "X86_64_VERSION" "$tkgpatch"; then
_graysky_legacy="false"
fi
else
msg2 "Couldn't find graysky's cpu opts patch for this version"
fi
# PREEMPT_RT patch
if [ "${_preempt_rt}" = "1" ] && [[ $_kver -lt 612 ]]; then
if [ "${_rt_subver_map[$_basekernel]+_}" = "_" ]; then
preempt_rt_ksubver="${_rt_subver_map[$_basekernel]}"
# Check if subversion is supported, skip check if forced
if [ "${_preempt_rt_force}" = "1" ] || [ "${preempt_rt_ksubver}" = "${_sub}" ]; then
if [[ "${_sub}" == *rc* ]]; then
_separator="-"
else
_separator="."
fi
if [[ "${preempt_rt_ksubver}" == 0 ]]; then
_separator=
preempt_rt_ksubver=
fi
preempt_rt_file_gz="patch-${_basekernel}${_separator}${preempt_rt_ksubver}-rt${_rt_rev_map["$_basekernel"]}.patch.gz"
preempt_rt_file=`basename ${preempt_rt_file_gz} .gz`
curl "https://cdn.kernel.org/pub/linux/kernel/projects/rt/${_basekernel}/${preempt_rt_file_gz}" > "$srcdir"/"${preempt_rt_file_gz}"
last_pwd=`pwd`
cd "$srcdir"
gunzip -k "$srcdir/${preempt_rt_file_gz}"
cd "$last_pwd"
tkgpatch="$srcdir/${preempt_rt_file}"
_msg="Applying PREEMPT_RT patch" && _tkg_patcher
else
warning "Skipping PREEMPT_RT patch for ${_basekernel}.${_sub} (last known good ${_basekernel}.${preempt_rt_ksubver})"
fi
else
warning "Skipping PREEMPT_RT patch on unsupported kernel version"
fi
fi
# TkG
if [ "$_clear_patches" = "true" ]; then
tkgpatch="$srcdir/0002-clear-patches.patch"
_msg="Applying clear linux patches" && _tkg_patcher
fi
if [ "$_glitched_base" = "true" ]; then
tkgpatch="$srcdir/0003-glitched-base.patch"
_msg="Applying glitched base patch" && _tkg_patcher
fi
if [ "${_preempt_rt}" != "1" ]; then
tkgpatch="$srcdir/0003-glitched-base-nonrt.patch"
_msg="Applying glitched base non-rt additions patch" && _tkg_patcher
fi
tkgpatch="$srcdir/0013-fedora-rpm.patch"
_msg="RPM: fixing spec generator" && _tkg_patcher
if [ "$_distro" = "Suse" ]; then
tkgpatch="$srcdir/0013-suse-additions.patch"
_msg="Import Suse-specific patches" && _tkg_patcher
fi
if [ "$_distro" = "Gentoo" ]; then
# https://dev.gentoo.org/~mpagano/genpatches/trunk/
tkgpatch="$srcdir/0013-gentoo-kconfig.patch"
_msg="Import Gentoo-kconfig patches" && _tkg_patcher
fi
if [ -z $_misc_adds ]; then
plain "Enable misc additions ? They may contain temporary fixes pending upstream, or some other changes that can break on non-Arch distros."
read -rp "`echo $' > [Y]/n : '`" _interactive_misc_adds;
if [ "$_interactive_misc_adds" != "n" ] && [ "$_interactive_misc_adds" != "N" ]; then
_misc_adds="true"
fi
fi
if [ "$_misc_adds" = "true" ]; then
tkgpatch="$srcdir/0012-misc-additions.patch"
_msg="Applying misc additions patch" && _tkg_patcher
fi
_msg="Applying patches for WRITE_WATCH support in Wine"
tkgpatch="$srcdir/0001-mm-Support-soft-dirty-flag-reset-for-VA-range.patch" && _tkg_patcher
tkgpatch="$srcdir/0002-mm-Support-soft-dirty-flag-read-with-reset.patch" && _tkg_patcher
# prjc/bmq patch rev
if [ "$_kver" = "508" ] || [ "$_kver" = "507" ] || [ "$_kver" = "509" ] || [ "$_kver" = "511" ] || [ "$_kver" = "513" ] || [ "$_kver" = "514" ]; then
rev=3
elif [ "$_kver" = "510" ] || [ "$_kver" = "608" ]; then
rev=5
elif [ "$_kver" = "512" ] || [ "$_kver" = "515" ] || [ "$_kver" = "516" ] || [ "$_kver" = "601" ] || [ "$_kver" = "603" ] || [ "$_kver" = "608" ] || [ "$_kver" = "611" ]; then
rev=1
elif [ "$_kver" = "518" ] || [ "$_kver" = "602" ] || [ "$_kver" = "607" ] || [ "$_kver" = "610" ]; then
rev=2
else
rev=0
fi
if [ "${_cpusched}" = "muqss" ]; then
# MuQSS
_msg="Applying MuQSS base patch"
tkgpatch="$srcdir/0004-${_basekernel}-ck1.patch" && _tkg_patcher
if [ "${_aggressive_ondemand}" = "true" ]; then
_msg="Applying MuQSS agressive ondemand governor patch"
tkgpatch="$srcdir/0004-glitched-ondemand-muqss.patch" && _tkg_patcher
fi
_msg="Applying Glitched MuQSS patch"
tkgpatch="$srcdir/0004-glitched-muqss.patch" && _tkg_patcher
elif [ "${_cpusched}" = "upds" ] || [ "${_cpusched}" = "pds" ]; then
# upds naming quirk
if [ "${_cpusched}" = "upds" ];then
# is it dead or alive
doa="-undead"
fi
# PDS-mq
_msg="Applying PDS base patch"
if [ "${_cpusched}" = "upds" ] || ( [ "$_kver" = "504" ] || [ "$_kver" = "507" ] && [ "${_cpusched}" = "pds" ] ); then
tkgpatch="$srcdir/0005-v${_basekernel}_undead-pds099o.patch" && _tkg_patcher
if [ "${_aggressive_ondemand}" = "true" ]; then
_msg="Applying PDS agressive ondemand governor patch"
tkgpatch="$srcdir/0005${doa}-glitched-ondemand-pds.patch" && _tkg_patcher
fi
else
tkgpatch="$srcdir/0009-prjc_v${_basekernel}-r${rev}.patch" && _tkg_patcher
if [ "${_aggressive_ondemand}" = "true" ]; then
_msg="Applying prjc PDS/BMQ agressive ondemand governor patch"
tkgpatch="$srcdir/0009-glitched-ondemand-bmq.patch" && _tkg_patcher
fi
fi
_msg="Applying Glitched PDS patch"
tkgpatch="$srcdir/0005${doa}-glitched-pds.patch" && _tkg_patcher
elif [ "${_cpusched}" = "bmq" ]; then
# Project C / BMQ
_msg="Applying Project C / BMQ base patch"
if [ "$_kver" != "504" ]; then
tkgpatch="$srcdir/0009-prjc_v${_basekernel}-r${rev}.patch" && _tkg_patcher
else
tkgpatch="$srcdir/0009-bmq_v5.4-r2.patch" && _tkg_patcher
fi
if [ "${_aggressive_ondemand}" = "true" ] && [ "$_kver" != "504" ]; then
_msg="Applying BMQ agressive ondemand governor patch"
tkgpatch="$srcdir/0009-glitched-ondemand-bmq.patch" && _tkg_patcher
fi
_msg="Applying Glitched BMQ patch"
tkgpatch="$srcdir/0009-glitched-bmq.patch" && _tkg_patcher
elif [ "${_cpusched}" = "cacule" ]; then
_msg="Applying cacule patch"
if [[ $_kver -lt 515 ]]; then
wget -P "$srcdir" "https://raw.githubusercontent.com/hamadmarri/cacule-cpu-scheduler/master/patches/CacULE/v${_basekernel}/cacule-${_basekernel}.patch"
elif [[ $_kver = 515 ]]; then
wget -P "$srcdir" "https://raw.githubusercontent.com/CachyOS/cacule-cpu-scheduler/master/patches/CacULE/v${_basekernel}/cacule-${_basekernel}.patch"
else
wget -P "$srcdir" "https://raw.githubusercontent.com/CachyOS/cacule-cpu-scheduler/master/patches/CacULE/v${_basekernel}/0001-cacULE-${_basekernel}.patch"
fi
tkgpatch="$srcdir/cacule-${_basekernel}.patch" && _tkg_patcher
tkgpatch="$srcdir/0001-cacULE-${_basekernel}.patch" && _tkg_patcher
elif [ "${_cpusched}" = "tt" ]; then
_msg="Applying TT patch"
curl "https://raw.githubusercontent.com/CachyOS/kernel-patches/master/${_basekernel}/sched/0001-tt.patch" > "$srcdir"/tt.patch
tkgpatch="$srcdir/tt.patch" && _tkg_patcher
if [ "$_tt_high_hz" = "true" ] && [ $_kver = 515 ]; then
_msg="Applying TT High HZ patch"
curl "https://raw.githubusercontent.com/hamadmarri/TT-CPU-Scheduler/master/patches/${_basekernel}/high-hz.patch" > "$srcdir"/tt_high_hz.patch
tkgpatch="$srcdir/tt_high_hz.patch" && _tkg_patcher
fi
elif [ "${_cpusched}" = "echo" ]; then
_msg="Applying ECHO patch"
curl "https://raw.githubusercontent.com/hamadmarri/ECHO-CPU-Scheduler/main/${_basekernel}.y/linux-${_basekernel}-echo.patch" > "$srcdir"/0001-echo.patch
tkgpatch="$srcdir/0001-echo.patch" && _tkg_patcher
elif [ "${_cpusched}" = "bore" ]; then
_msg="Applying BORE patch"
curl "https://raw.githubusercontent.com/CachyOS/kernel-patches/master/${_basekernel}/sched/0001-bore.patch" > "$srcdir"/0001-bore.patch
tkgpatch="$srcdir/0001-bore.patch" && _tkg_patcher
elif [ "${_cpusched}" = "cfs" ]; then
_msg="Applying Glitched CFS additions patch"
tkgpatch="$srcdir/0003-glitched-cfs-additions.patch" && _tkg_patcher
elif [[ "${_cpusched}" =~ "eevdf" ]]; then
if [[ $_kver == "604" || $_kver == "605" ]]; then
_msg="Applying Earliest Eligible Virtual Deadline First (EEVDF) scheduler patch"
tkgpatch="$srcdir/0003-eevdf.patch" && _tkg_patcher
if [[ "${_cpusched}" != "bore-eevdf" ]]; then
_msg="Applying eevdf-Disable-DELAY_DEQUEUE patch"
tkgpatch="$srcdir/0004-eevdf-Disable-DELAY_DEQUEUE.patch" && _tkg_patcher
fi
elif [[ $_kver -ge 606 ]]; then
_msg="Applying Glitched EEVDF additions patch"
tkgpatch="$srcdir/0003-glitched-eevdf-additions.patch" && _tkg_patcher
if [ "$_eevdf_sched_ext_support" = "true" ] && [[ $_kver -ge 608 ]]; then
_msg="Applying Sched_ext support patch"
curl "https://raw.githubusercontent.com/CachyOS/kernel-patches/master/${_basekernel}/sched/0001-sched-ext.patch" > "$srcdir"/0001-sched-ext.patch
tkgpatch="$srcdir/0001-sched-ext.patch" && _tkg_patcher
fi
fi
if [ "${_cpusched}" = "bore-eevdf" ]; then
_msg="Applying BORE-EEVDF patch"
curl "https://raw.githubusercontent.com/CachyOS/kernel-patches/master/${_basekernel}/sched/0001-bore-eevdf.patch" > "$srcdir"/0001-bore-eevdf.patch
tkgpatch="$srcdir/0001-bore-eevdf.patch" && _tkg_patcher
fi
fi
if [ "${_cpusched}" = "cfs" ] || [ "${_cpusched}" = "cacule" ] || [ "${_cpusched}" = "tt" ] || [ "${_cpusched}" = "bore" ] || [[ "${_cpusched}" =~ "eevdf" ]]; then
_msg="Applying Glitched CFS/EEVDF patch"
tkgpatch="$srcdir/0003-glitched-cfs.patch" && _tkg_patcher
fi
fi
if [ -z "${_configfile}" ]; then
msg2 "Using archlinux's default config file for kernel ${_basekernel}"
cat "${srcdir}"/config.x86_64 > ./.config
elif [ "${_configfile}" = "config_hardened.x86_64" ]; then
msg2 "Using archlinux's hardened config file for kernel ${_basekernel}"
cat "${srcdir}"/config_hardened.x86_64 > ./.config
elif [ "${_configfile}" = "running-kernel" ]; then
if [ -f /boot/config-`uname -r` ];then
msg2 "Using /boot/config-`uname -r` as config file"
cp /boot/config-`uname -r` .config
elif [ -f /proc/config.gz ];then
msg2 "Using /proc/config.gz as config file"
zcat --verbose /proc/config.gz > .config
else
warning "Cannot get config file of running kernel"
exit 1
fi
else
msg2 "Using user-provided config file in ${_where}/${_configfile}"
cat "${_where}/${_configfile}" > ./.config
fi
if [ "${_distro}" = "Arch" ]; then
# Reset local version string if ever it's in the .config file
scripts/config --set-str localversion ""
else
_disable "LOCALVERSION_AUTO"
scripts/config --set-str "DEFAULT_HOSTNAME" "(none)"
fi
if [ -z $_debug ]; then
# Set some -tkg defaults
_disable "DYNAMIC_FAULT" "DEFAULT_FQ_CODEL" "WERROR"
_enable "DEFAULT_CAKE" "AMD_PRIVATE_COLOR"
if [ "$_kver" = "504" ]; then
_module "TP_SMAPI"
_enable "RAID6_USE_PREFER_GEN"
fi
if [ "$_kver" = "504" ] || [ "$_kver" = "509" ]; then
scripts/config --set-val "RCU_BOOST_DELAY" "0"
fi
_disable "NTP_PPS" "ZSWAP_COMPRESSOR_DEFAULT_LZO" "PROFILE_ALL_BRANCHES"
_enable "CRYPTO_LZ4" "CRYPTO_LZ4HC" "LZ4_COMPRESS" "LZ4HC_COMPRESS" "X86_AMD_PSTATE" "AMD_PINCTRL"
_disable "DEBUG_FORCE_FUNCTION_ALIGN_64B" "X86_P6_NOP" "RCU_STRICT_GRACE_PERIOD"
if [ $_kver -le 605 ]; then
_enable "ZSWAP_COMPRESSOR_DEFAULT_LZ4"
scripts/config --set-str "ZSWAP_COMPRESSOR_DEFAULT" "lz4"
fi
_enable "CPU_FREQ_DEFAULT_GOV_SCHEDUTIL"
_disable "CPU_FREQ_DEFAULT_GOV_ONDEMAND" "CPU_FREQ_DEFAULT_GOV_CONSERVATIVE" "CPU_FREQ_DEFAULT_GOV_PERFORMANCE" "CPU_FREQ_DEFAULT_GOV_PERFORMANCE_NODEF"
_module "BLK_DEV_LOOP"
# Arch tends to set voluntary preemption when moving kernels to LTS, which we don't want as default
_disable "PREEMPT_VOLUNTARY"
_enable "PREEMPT"
if [ "${_preempt_rt}" = "1" ]; then
if [ $_kver -ge 612 ]; then
_enable "CONFIG_EXPERT" && _expert="true"
fi
_enable "PREEMPT_RT"
fi
# This leads to all kinds of issues everytime Arch enables it in defconfig. Let's disable it and be happy.
_disable "SYSFB_SIMPLEFB"
# buggy project C/PSI interaction workaround
if [ "${_cpusched}" = "pds" ] || [ "${_cpusched}" = "bmq" ]; then
_disable "PSI"
_enable "PSI_DEFAULT_DISABLED"
# Disable MLX5_CORE on Prjc
plain "Disable MLX5_CORE for Prjc"
_disable "MLX5_CORE"
fi