9
9
# Set these variables to ANYTHING that is not null or choose proper variable to enable them
10
10
11
11
# ## Selecting CachyOS config
12
- : " ${_cachy_config:= y } "
12
+ : " ${_cachy_config:= yes } "
13
13
14
14
# ## Selecting the CPU scheduler
15
15
# ATTENTION - only one of the following values can be selected:
23
23
: " ${_cpusched:= bmq} "
24
24
25
25
# ## Tweak kernel options prior to a build via nconfig
26
- : " ${_makenconfig:= } "
26
+ : " ${_makenconfig:= no } "
27
27
28
28
# ## Tweak kernel options prior to a build via menuconfig
29
- : " ${_makemenuconfig:= } "
29
+ : " ${_makemenuconfig:= no } "
30
30
31
31
# ## Tweak kernel options prior to a build via xconfig
32
- : " ${_makexconfig:= } "
32
+ : " ${_makexconfig:= no } "
33
33
34
34
# ## Tweak kernel options prior to a build via gconfig
35
- : " ${_makegconfig:= } "
35
+ : " ${_makegconfig:= no } "
36
36
37
37
# NUMA is optimized for multi-socket motherboards.
38
38
# A single multi-core CPU actually runs slower with NUMA enabled.
39
39
# See, https://bugs.archlinux.org/task/31187
40
40
# It seems that in 2023 this is not really a huge regression anymore
41
- : " ${_NUMAdisable:= } "
41
+ : " ${_NUMAdisable:= no } "
42
42
43
43
# Compile ONLY used modules to VASTLYreduce the number of modules built
44
44
# and the build time.
48
48
# This PKGBUILD read the database kept if it exists
49
49
#
50
50
# More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db
51
- : " ${_localmodcfg:= } "
51
+ : " ${_localmodcfg:= no } "
52
52
53
53
# Path to the list of used modules
54
54
: " ${_localmodcfg_path:= " $HOME /.config/modprobed.db" } "
58
58
# the ARCH defaults. Useful when the package gets updated and you already went
59
59
# through the trouble of customizing your config options. NOT recommended when
60
60
# a new kernel is released, but again, convenient for package bumps.
61
- : " ${_use_current:= } "
61
+ : " ${_use_current:= no } "
62
62
63
63
# ## Enable KBUILD_CFLAGS -O3
64
- : " ${_cc_harder:= y } "
64
+ : " ${_cc_harder:= yes } "
65
65
66
66
# ## Set performance governor as default
67
- : " ${_per_gov:= } "
67
+ : " ${_per_gov:= no } "
68
68
69
69
# ## Enable TCP_CONG_BBR3
70
- : " ${_tcp_bbr3:= } "
70
+ : " ${_tcp_bbr3:= no } "
71
71
72
72
# ## Running with a 1000HZ, 750Hz, 625Hz, 600 Hz, 500Hz, 300Hz, 250Hz and 100Hz tick rate
73
73
: " ${_HZ_ticks:= 1000} "
98
98
: " ${_processor_opt:= } "
99
99
100
100
# This does automatically detect your supported CPU and optimizes for it
101
- : " ${_use_auto_optimization:= y } "
101
+ : " ${_use_auto_optimization:= yes } "
102
102
103
103
# Clang LTO mode, only available with the "llvm" compiler - options are "none", "full" or "thin".
104
104
# ATTENTION - one of three predefined values should be selected!
109
109
110
110
# Use suffix -lto only when requested by the user
111
111
# Enabled by default.
112
- # y - enable -lto suffix
113
- # n - disable -lto suffix
112
+ # yes - enable -lto suffix
113
+ # no - disable -lto suffix
114
114
# https://github.com/CachyOS/linux-cachyos/issues/36
115
- : " ${_use_lto_suffix:= y } "
115
+ : " ${_use_lto_suffix:= yes } "
116
116
117
117
# Use suffix -gcc when requested by the user
118
118
# This was added to facilitate https://github.com/CachyOS/linux-cachyos/issues/286
119
- : " ${_use_gcc_suffix:= } "
119
+ : " ${_use_gcc_suffix:= no } "
120
120
121
121
# KCFI is a proposed forward-edge control-flow integrity scheme for
122
122
# Clang, which is more suitable for kernel use than the existing CFI
123
123
# scheme used by CONFIG_CFI_CLANG. kCFI doesn't require LTO, doesn't
124
124
# alter function references to point to a jump table, and won't break
125
125
# function address equality.
126
- : " ${_use_kcfi:= } "
126
+ : " ${_use_kcfi:= no } "
127
127
128
128
# Build the zfs module in to the kernel
129
129
# WARNING: The ZFS module doesn't build with selected RT sched due to licensing issues.
130
130
# If you use ZFS, refrain from building the RT kernel
131
- : " ${_build_zfs:= } "
131
+ : " ${_build_zfs:= no } "
132
132
133
133
# Builds the nvidia module and package it into a own base
134
134
# This does replace the requirement of nvidia-dkms
135
- : " ${_build_nvidia:= } "
135
+ : " ${_build_nvidia:= no } "
136
136
137
137
# Builds the open nvidia module and package it into a own base
138
138
# This does replace the requirement of nvidia-open-dkms
139
139
# Use this only if you have Turing+ GPU
140
- : " ${_build_nvidia_open:= } "
140
+ : " ${_build_nvidia_open:= no } "
141
141
142
142
# Build a debug package with non-stripped vmlinux
143
- : " ${_build_debug:= } "
143
+ : " ${_build_debug:= no } "
144
144
145
145
# ATTENTION: Do not modify after this line
146
146
_is_lto_kernel () {
147
147
[[ " $_use_llvm_lto " = " thin" || " $_use_llvm_lto " = " full" ]]
148
148
return $?
149
149
}
150
150
151
- if _is_lto_kernel && [ " $_use_lto_suffix " = " y " ]; then
151
+ if _is_lto_kernel && [ " $_use_lto_suffix " = " yes " ]; then
152
152
_pkgsuffix=" cachyos-${_cpusched} -lto"
153
- elif ! _is_lto_kernel && [ " $_use_gcc_suffix " = " y " ]; then
153
+ elif ! _is_lto_kernel && [ " $_use_gcc_suffix " = " yes " ]; then
154
154
_pkgsuffix=" cachyos-${_cpusched} -gcc"
155
155
else
156
156
_pkgsuffix=" cachyos-${_cpusched} "
@@ -216,18 +216,18 @@ if [[ "$_cpusched" = "rt" || "$_cpusched" = "rt-bore" ]]; then
216
216
fi
217
217
218
218
# ZFS support
219
- if [ -n " $_build_zfs " ]; then
219
+ if [ " $_build_zfs " = " yes " ]; then
220
220
makedepends+=(git)
221
221
source+=(" git+https://github.com/cachyos/zfs.git#commit=e65f69e41f4a276d7d0d1800a2878308a0ba84a6" )
222
222
fi
223
223
224
224
# NVIDIA pre-build module support
225
- if [ -n " $_build_nvidia " ]; then
225
+ if [ " $_build_nvidia " = " yes " ]; then
226
226
source+=(" https://us.download.nvidia.com/XFree86/Linux-x86_64/${_nv_ver} /${_nv_pkg} .run"
227
227
" ${_patchsource} /misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch" )
228
228
fi
229
229
230
- if [ -n " $_build_nvidia_open " ]; then
230
+ if [ " $_build_nvidia_open " = " yes " ]; then
231
231
source+=(" nvidia-open-${_nv_ver} .tar.gz::https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/${_nv_ver} .tar.gz"
232
232
" ${_patchsource} /misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch"
233
233
" ${_patchsource} /misc/nvidia/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch"
@@ -294,19 +294,17 @@ prepare() {
294
294
fi
295
295
296
296
# ## Use autooptimization
297
- if [ -n " $_use_auto_optimization " ]; then
297
+ if [ " $_use_auto_optimization " = " yes " ]; then
298
298
" ${srcdir} " /auto-cpu-optimization.sh
299
299
fi
300
300
301
301
# ## Selecting CachyOS config
302
- if [ -n " $_cachy_config " ]; then
302
+ if [ " $_cachy_config " = " yes " ]; then
303
303
echo " Enabling CachyOS config..."
304
304
scripts/config -e CACHY
305
305
fi
306
306
307
307
# ## Selecting the CPU scheduler
308
- [ -z " $_cpusched " ] && _die " The value is empty. Choose the correct one again."
309
-
310
308
case " $_cpusched " in
311
309
cachyos|bore|hardened) scripts/config -e SCHED_BORE;;
312
310
bmq) scripts/config -e SCHED_ALT -e SCHED_BMQ;;
@@ -319,14 +317,12 @@ prepare() {
319
317
echo " Selecting ${_cpusched^^} CPU scheduler..."
320
318
321
319
# ## Enable KCFI
322
- if [ -n " $_use_kcfi " ]; then
320
+ if [ " $_use_kcfi " = " yes " ]; then
323
321
echo " Enabling kCFI"
324
322
scripts/config -e ARCH_SUPPORTS_CFI_CLANG -e CFI_CLANG -e CFI_AUTO_DEFAULT
325
323
fi
326
324
327
325
# ## Select LLVM level
328
- [ -z " $_use_llvm_lto " ] && _die " The value is empty. Choose the correct one again."
329
-
330
326
case " $_use_llvm_lto " in
331
327
thin) scripts/config -e LTO -e LTO_CLANG -e ARCH_SUPPORTS_LTO_CLANG -e ARCH_SUPPORTS_LTO_CLANG_THIN -d LTO_NONE -e HAS_LTO_CLANG -d LTO_CLANG_FULL -e LTO_CLANG_THIN -e HAVE_GCC_PLUGINS;;
332
328
full) scripts/config -e LTO -e LTO_CLANG -e ARCH_SUPPORTS_LTO_CLANG -e ARCH_SUPPORTS_LTO_CLANG_THIN -d LTO_NONE -e HAS_LTO_CLANG -e LTO_CLANG_FULL -d LTO_CLANG_THIN -e HAVE_GCC_PLUGINS;;
@@ -337,8 +333,6 @@ prepare() {
337
333
echo " Selecting '$_use_llvm_lto ' LLVM level..."
338
334
339
335
# ## Select tick rate
340
- [ -z " $_HZ_ticks " ] && _die " The value is empty. Choose the correct one again."
341
-
342
336
case " $_HZ_ticks " in
343
337
100|250|500|600|625|750|1000)
344
338
scripts/config -d HZ_300 -e " HZ_${_HZ_ticks} " --set-val HZ " ${_HZ_ticks} " ;;
@@ -351,7 +345,7 @@ prepare() {
351
345
echo " Setting tick rate to ${_HZ_ticks} Hz..."
352
346
353
347
# ## Disable NUMA
354
- if [ -n " $_NUMAdisable " ]; then
348
+ if [ " $_NUMAdisable " = " yes " ]; then
355
349
echo " Disabling NUMA from kernel config..."
356
350
scripts/config -d NUMA \
357
351
-d AMD_NUMA \
@@ -369,15 +363,13 @@ prepare() {
369
363
fi
370
364
371
365
# ## Select performance governor
372
- if [ -n " $_per_gov " ]; then
366
+ if [ " $_per_gov " = " yes " ]; then
373
367
echo " Setting performance governor..."
374
368
scripts/config -d CPU_FREQ_DEFAULT_GOV_SCHEDUTIL \
375
369
-e CPU_FREQ_DEFAULT_GOV_PERFORMANCE
376
370
fi
377
371
378
372
# ## Select tick type
379
- [ -z " $_tickrate " ] && _die " The value is empty. Choose the correct one again."
380
-
381
373
case " $_tickrate " in
382
374
perodic) scripts/config -d NO_HZ_IDLE -d NO_HZ_FULL -d NO_HZ -d NO_HZ_COMMON -e HZ_PERIODIC;;
383
375
idle) scripts/config -d HZ_PERIODIC -d NO_HZ_FULL -e NO_HZ_IDLE -e NO_HZ -e NO_HZ_COMMON;;
@@ -391,8 +383,6 @@ prepare() {
391
383
392
384
# We should not set up the PREEMPT for RT kernels
393
385
if [[ " $_cpusched " != " rt" || " $_cpusched " != " rt-bore" ]]; then
394
- [ -z " $_preempt " ] && _die " The value is empty. Choose the correct one again."
395
-
396
386
case " $_preempt " in
397
387
full) scripts/config -e PREEMPT_BUILD -d PREEMPT_NONE -d PREEMPT_VOLUNTARY -e PREEMPT -e PREEMPT_COUNT -e PREEMPTION -e PREEMPT_DYNAMIC;;
398
388
voluntary) scripts/config -e PREEMPT_BUILD -d PREEMPT_NONE -e PREEMPT_VOLUNTARY -d PREEMPT -e PREEMPT_COUNT -e PREEMPTION -d PREEMPT_DYNAMIC;;
@@ -404,7 +394,7 @@ prepare() {
404
394
fi
405
395
406
396
# ## Enable O3
407
- if [ -n " $_cc_harder " ] && [ -z " $_cc_size " ]; then
397
+ if [ " $_cc_harder " = " yes " ]; then
408
398
echo " Enabling KBUILD_CFLAGS -O3..."
409
399
scripts/config -d CC_OPTIMIZE_FOR_PERFORMANCE \
410
400
-e CC_OPTIMIZE_FOR_PERFORMANCE_O3
@@ -427,7 +417,7 @@ prepare() {
427
417
fi
428
418
429
419
# ## Enable bbr3
430
- if [ -n " $_tcp_bbr3 " ]; then
420
+ if [ " $_tcp_bbr3 " = " yes " ]; then
431
421
echo " Disabling TCP_CONG_CUBIC..."
432
422
scripts/config -m TCP_CONG_CUBIC \
433
423
-d DEFAULT_CUBIC \
@@ -441,8 +431,6 @@ prepare() {
441
431
fi
442
432
443
433
# ## Select THP
444
- [ -z " $_hugepage " ] && _die " The value is empty. Choose the correct one again."
445
-
446
434
case " $_hugepage " in
447
435
always) scripts/config -d TRANSPARENT_HUGEPAGE_MADVISE -e TRANSPARENT_HUGEPAGE_ALWAYS;;
448
436
madvise) scripts/config -d TRANSPARENT_HUGEPAGE_ALWAYS -e TRANSPARENT_HUGEPAGE_MADVISE;;
@@ -456,7 +444,7 @@ prepare() {
456
444
457
445
# ## Optionally use running kernel's config
458
446
# code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
459
- if [ -n " $_use_current " ]; then
447
+ if [ " $_use_current " = " yes " ]; then
460
448
if [[ -s /proc/config.gz ]]; then
461
449
echo " Extracting config from /proc/config.gz..."
462
450
# modprobe configs
@@ -469,10 +457,9 @@ prepare() {
469
457
fi
470
458
fi
471
459
472
-
473
460
# ## Optionally load needed modules for the make localmodconfig
474
461
# See https://aur.archlinux.org/packages/modprobed-db
475
- if [ -n " $_localmodcfg " ]; then
462
+ if [ " $_localmodcfg " = " yes " ]; then
476
463
if [ -e " $_localmodcfg_path " ]; then
477
464
echo " Running Steven Rostedt's make localmodconfig now"
478
465
make " ${BUILD_FLAGS[@]} " LSMOD=" ${_localmodcfg_path} " localmodconfig
@@ -492,31 +479,31 @@ prepare() {
492
479
echo " Prepared $pkgbase version $( < version) "
493
480
494
481
# ## Running make nconfig
495
- [[ -z " $_makenconfig " ]] || make " ${BUILD_FLAGS[@]} " nconfig
482
+ [ " $_makenconfig " = " yes " ] && make " ${BUILD_FLAGS[@]} " nconfig
496
483
497
484
# ## Running make menuconfig
498
- [[ -z " $_makemenuconfig " ]] || make " ${BUILD_FLAGS[@]} " menuconfig
485
+ [ " $_makemenuconfig " = " yes " ] && make " ${BUILD_FLAGS[@]} " menuconfig
499
486
500
487
# ## Running make xconfig
501
- [[ -z " $_makexconfig " ]] || make " ${BUILD_FLAGS[@]} " xconfig
488
+ [ " $_makexconfig " = " yes " ] && make " ${BUILD_FLAGS[@]} " xconfig
502
489
503
490
# ## Running make gconfig
504
- [[ -z " $_makegconfig " ]] || make " ${BUILD_FLAGS[@]} " gconfig
491
+ [ " $_makegconfig " = " yes " ] && make " ${BUILD_FLAGS[@]} " gconfig
505
492
506
493
# ## Save configuration for later reuse
507
494
echo " Save configuration for later reuse..."
508
495
local basedir=" $( dirname " $( readlink " ${srcdir} /config" ) " ) "
509
496
cat .config > " ${basedir} /config-${pkgver} -${pkgrel}${pkgbase# linux} "
510
497
511
- if [ -n " $_build_nvidia " ]; then
498
+ if [ " $_build_nvidia " = " yes " ]; then
512
499
cd " ${srcdir} "
513
500
sh " ${_nv_pkg} .run" --extract-only
514
501
515
502
# Use fbdev and modeset as default
516
503
patch -Np1 -i " ${srcdir} /0001-Make-modeset-and-fbdev-default-enabled.patch" -d " ${srcdir} /${_nv_pkg} /kernel"
517
504
fi
518
505
519
- if [ -n " $_build_nvidia_open " ]; then
506
+ if [ " $_build_nvidia_open " = " yes " ]; then
520
507
patch -Np1 -i " ${srcdir} /0001-Make-modeset-and-fbdev-default-enabled.patch" -d " ${srcdir} /${_nv_open_pkg} /kernel-open"
521
508
# Fix for Zen5 error print in dmesg
522
509
patch -Np1 --no-backup-if-mismatch -i " ${srcdir} /0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch" -d " ${srcdir} /${_nv_open_pkg} "
@@ -540,20 +527,20 @@ build() {
540
527
SYSSRC=" ${srcdir} /${_srcname} "
541
528
SYSOUT=" ${srcdir} /${_srcname} "
542
529
)
543
- if [ -n " $_build_nvidia " ]; then
530
+ if [ " $_build_nvidia " = " yes " ]; then
544
531
MODULE_FLAGS+=(NV_EXCLUDE_BUILD_MODULES=' __EXCLUDE_MODULES' )
545
532
cd " ${srcdir} /${_nv_pkg} /kernel"
546
533
make " ${BUILD_FLAGS[@]} " " ${MODULE_FLAGS[@]} " -j" $( nproc) " modules
547
534
548
535
fi
549
536
550
- if [ -n " $_build_nvidia_open " ]; then
537
+ if [ " $_build_nvidia_open " = " yes " ]; then
551
538
cd " ${srcdir} /${_nv_open_pkg} "
552
539
MODULE_FLAGS+=(IGNORE_CC_MISMATCH=yes)
553
540
CFLAGS= CXXFLAGS= LDFLAGS= make " ${BUILD_FLAGS[@]} " " ${MODULE_FLAGS[@]} " -j" $( nproc) " modules
554
541
fi
555
542
556
- if [ -n " $_build_zfs " ]; then
543
+ if [ " $_build_zfs " = " yes " ]; then
557
544
cd ${srcdir} /" zfs"
558
545
559
546
local CONFIGURE_FLAGS=()
@@ -745,11 +732,11 @@ _package-nvidia-open(){
745
732
}
746
733
747
734
pkgname=(" $pkgbase " )
748
- [ -n " $_build_debug " ] && pkgname+=(" $pkgbase -dbg" )
735
+ [ " $_build_debug " = " yes " ] && pkgname+=(" $pkgbase -dbg" )
749
736
pkgname+=(" $pkgbase -headers" )
750
- [ -n " $_build_zfs " ] && pkgname+=(" $pkgbase -zfs" )
751
- [ -n " $_build_nvidia " ] && pkgname+=(" $pkgbase -nvidia" )
752
- [ -n " $_build_nvidia_open " ] && pkgname+=(" $pkgbase -nvidia-open" )
737
+ [ " $_build_zfs " = " yes " ] && pkgname+=(" $pkgbase -zfs" )
738
+ [ " $_build_nvidia " = " yes " ] && pkgname+=(" $pkgbase -nvidia" )
739
+ [ " $_build_nvidia_open " = " yes " ] && pkgname+=(" $pkgbase -nvidia-open" )
753
740
for _p in " ${pkgname[@]} " ; do
754
741
eval " package_$_p () {
755
742
$( declare -f " _package${_p# $pkgbase } " )
0 commit comments