├── .github
└── FUNDING.yml
├── README.md
├── linux-bore
├── .SRCINFO
├── PKGBUILD
├── auto-cpu-optimization.sh
├── config
└── configure
├── linux-cacule-lts
├── .SRCINFO
├── PKGBUILD
├── auto-cpu-optimization.sh
├── config
└── configure
├── linux-cacule-rdb
├── .SRCINFO
├── PKGBUILD
├── auto-cpu-optimization.sh
├── config
└── configure
├── linux-cacule
├── .SRCINFO
├── PKGBUILD
├── auto-cpu-optimization.sh
├── config
└── configure
└── linux-tt
├── .SRCINFO
├── PKGBUILD
├── auto-cpu-optimization.sh
├── config
└── configure
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | custom: ['https://paypal.me/pttrr?locale.x=de_DE']
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Switchting to this one repo! https://github.com/CachyOS/linux-cachyos
2 |
3 | #
Linux Kernel With CacULE Scheduler, Several Other Patches & Improvements
4 |
5 | ## General Informations
6 |
7 | The CacULE CPU Scheduler is a improved alternative to CFS Patch-set which is based on interactivity score mechanism. The interactivity score is inspired by the ULE Scheduler (FreeBSD Scheduler). The goal of this scheduler is to enhance system performance, responsiveness and latency.
8 |
9 | ## Features
10 |
11 | - At the time of compiling you can set several features which you want to use
12 | - GCC/CLANG Optimization with Auto CPU Optimization
13 | - Choose between LLVM/LTO or GCC
14 | - Choose between 500Hz, , 750 Hz, 1000Hz (default), 2000Hz
15 | - Improved BFQ Scheduler
16 | - Latest LRU Patch-set
17 | - BBRv2 tcp_congestion_control
18 | - LLVM FULL LTO provided with *-llvm Kernel (in the repo)
19 | - LRNG Framework (default)
20 | - FUTEX, WINESYNC & FUTEX2 patch-set
21 | - Android ANBOX patch-set
22 | - Latest Paragon NTFS3 driver support
23 | - Latest & improved ZSTD patch-set
24 | - Latest BTRFS improvements & fixes
25 | - KSMBD Module for Samba3 Server
26 | - Protection of clean file pages (page cache) may be used to prevent thrashing, reducing I/O under memory pressure, avoid high latency and prevent livelock in near OOM (Out Of Memory) conditions
27 |
28 | ## CacULE Tips & Tricks (Sysctl Values)
29 |
30 | You can tune the scheduler by setting these sysctl values
31 |
32 | ```
33 | net.core.netdev_max_backlog = 16384
34 | net.core.somaxconn = 8192
35 | net.core.rmem_default = 1048576
36 | net.core.rmem_max = 16777216
37 | net.core.wmem_default = 1048576
38 | net.core.wmem_max = 16777216
39 | net.core.optmem_max = 65536
40 | net.ipv4.tcp_rmem = 4096 1048576 2097152
41 | net.ipv4.tcp_wmem = 4096 65536 16777216
42 | net.ipv4.udp_rmem_min = 8192
43 | net.ipv4.udp_wmem_min = 8192
44 | net.ipv4.tcp_fastopen = 3
45 | net.ipv4.tcp_keepalive_time = 60
46 | net.ipv4.tcp_keepalive_intvl = 10
47 | net.ipv4.tcp_keepalive_probes = 6
48 | net.ipv4.conf.default.log_martians = 1
49 | net.ipv4.conf.all.log_martians = 1
50 | net.ipv4.tcp_mtu_probing = 1
51 | net.ipv4.tcp_syncookies = 1
52 | net.core.default_qdisc = cake
53 | net.ipv4.tcp_congestion_control = bbr2
54 | ```
55 |
56 | ## We are providing a [repo](https://mirror.cachyos.org/) which includes all kernels in generic-v3 and generic and more optimized packages
57 |
58 | ### How to add our Repo automatically with CPU detection (if x86-64-v3 is supported)
59 |
60 | **Just run following command:**
61 |
62 | --------------------------------------------------------------------------------
63 |
64 | ```
65 | wget https://mirror.cachyos.org/cachyos-repo.tar.xz
66 | tar xvf cachyos-repo.tar.xz
67 | cd repo
68 | sudo ./cachyos-repo.sh
69 | ```
70 |
71 | --------------------------------------------------------------------------------
72 |
73 | ```
74 | This script will also backup your old pacman.conf.
75 |
76 | This script will auto-detect you architecture, if your CPU have x86-64-v3 support, it will automatically use the repos which are optimized with this flag and some other flags.
77 |
78 | Also all provided Kernels, Browsers, ... are optimized and compiled.
79 |
80 | ## How to Backup the config and use the native Arch Packages
81 |
82 | - Remove or Backup the config located at /etc/pacman.conf
83 | - then run `sudo mv /etc/pacman.conf.bak /etc/pacman.conf`
84 | - Then run following command to switch the packages to the default arch packages `sudo pacman -Suuy`
85 |
86 |
87 | More information's you will find here [CachyOS](https://gitlab.com/cachyos) or [Discord](https://discord.gg/k39qfrxPNa)
88 | ```
89 |
90 | ## How to use CLANG/LLVM/LTO compiled Kernels on Nvidia driver with DKMS:
91 |
92 | There is mostly an easy workaround, but be aware, if you install a Kernel and have those parameters still in, the GCC Compiled Kernel will fail. Also some modules which uses DKMS needs to recompiled with CLANG/LLVM. I just compile the backup kernel LINUX-LTS also with CLANG, so i got no problems anymore.
93 |
94 | - Just do following:
95 |
96 | ```
97 | sudo nano /etc/dkms/framework.conf
98 | and add following entrys on the bottom of the file:
99 | export LLVM=1
100 | export CC=clang
101 | ```
102 |
103 | - If you have this done, just reinstall or install the kernel which is compiled with LLVM/LTO and DKMS wont fail anymore.
104 |
105 | If you got questions, just hit me up!
106 |
107 | ## Donations are welcome for the compile server for the repo or a cup of coffee for maintain this repo
108 |
109 |
110 |
111 | ### More Informations for the CacULE Scheduler
112 |
113 | Here you find more information from the [repo](https://github.com/cachyos/cacule-cpu-scheduler)
114 |
115 | ### Valueable Contributors
116 |
117 | [Hamad Marri](https://github.com/hamadmarri) for the CacULE Scheduler
118 |
119 | [BL4CKH47H4CK3R](https://github.com/BL4CKH47H4CK3R) for Optimization, Bug Hunting & Support
120 |
121 | [SirLucjan (Piotr Gorski)](https://github.com/sirlucjan) for many cool patches
122 |
123 | [Archlinux](https://archlinux.org) for the great linux operating system
124 |
125 | [GarudaLinux](https://garudalinux.org) for suggestions and supports
126 |
127 | [And all other Kernel Developers and Supporters](https://github.com/torvalds/linux)
128 |
--------------------------------------------------------------------------------
/linux-bore/.SRCINFO:
--------------------------------------------------------------------------------
1 | pkgbase = linux-bore
2 | pkgdesc = Linux BORE scheduler Kernel by CachyOS with other patches and improvements
3 | pkgver = 6.1.9
4 | pkgrel = 2
5 | url = https://github.com/CachyOS/linux-cachyos
6 | arch = x86_64
7 | arch = x86_64_v3
8 | license = GPL2
9 | makedepends = bc
10 | makedepends = libelf
11 | makedepends = pahole
12 | makedepends = cpio
13 | makedepends = perl
14 | makedepends = tar
15 | makedepends = xz
16 | makedepends = zstd
17 | makedepends = gcc
18 | makedepends = gcc-libs
19 | makedepends = glibc
20 | makedepends = binutils
21 | makedepends = make
22 | makedepends = patch
23 | options = !strip
24 | source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.9.tar.xz
25 | source = config
26 | source = auto-cpu-optimization.sh
27 | source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.1/all/0001-cachyos-base-all.patch
28 | source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.1/misc/0001-Add-latency-priority-for-CFS-class.patch
29 | source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.1/sched/0001-bore-cachy.patch
30 | sha256sums = d60cf185693c386e7acd9f3eb3a94ae30ffbfee0a9447a20e83711e0bdf5922b
31 | sha256sums = fab53ac59d4da6fb0433f6fd15877871f4124a89021237f90835d1ff3755ba9c
32 | sha256sums = 41c34759ed248175e905c57a25e2b0ed09b11d054fe1a8783d37459f34984106
33 | sha256sums = 3c31aea899ab3ba5d4119fc08935b31f66b2d4da65b6adfbfd3b410114c25753
34 | sha256sums = 479019c7ea52de10b6cadac468eb61215bafef596da3d751571bb6dc4fcd8787
35 | sha256sums = 80f8c92d504c1152adc85d1f832308e8bab7211613bd6c9a3a0c6752f0810b14
36 |
37 | pkgname = linux-bore
38 | pkgdesc = The Linux BORE scheduler Kernel by CachyOS with other patches and improvements kernel and modules
39 | depends = coreutils
40 | depends = kmod
41 | depends = initramfs
42 | optdepends = wireless-regdb: to set the correct wireless channels of your country
43 | optdepends = linux-firmware: firmware images needed for some devices
44 | optdepends = modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig
45 | optdepends = uksmd: Userspace KSM helper daemon
46 | provides = VIRTUALBOX-GUEST-MODULES
47 | provides = WIREGUARD-MODULE
48 | provides = KSMBD-MODULE
49 | provides = UKSMD-BUILTIN
50 |
51 | pkgname = linux-bore-headers
52 | pkgdesc = Headers and scripts for building modules for the Linux BORE scheduler Kernel by CachyOS with other patches and improvements kernel
53 | depends = pahole
54 | depends = linux-bore
55 |
--------------------------------------------------------------------------------
/linux-bore/auto-cpu-optimization.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Check if GCC is installed
4 | check_gcc() {
5 | if ! [ -x "$(command -v gcc)" ]; then
6 | # Display error message if GCC is not installed
7 | echo "Error: GCC is not installed. Please install GCC and try again." >&2
8 | exit 1
9 | fi
10 | }
11 |
12 | # Call the function before running the rest of the script
13 | check_gcc
14 |
15 | # Get CPU type from GCC and convert to uppercase
16 | MARCH=$(gcc -Q -march=native --help=target|grep -m1 march=|awk '{print toupper($2)}')
17 |
18 | # Check for specific CPU types and set MARCH variable accordingly
19 | case $MARCH in
20 | ZNVER1) MARCH="ZEN";;
21 | ZNVER2) MARCH="ZEN2";;
22 | ZNVER3) MARCH="ZEN3";;
23 | ZNVER4) MARCH="ZEN4";;
24 | BDVER1) MARCH="BULLDOZER";;
25 | BDVER2) MARCH="PILEDRIVER";;
26 | BDVER3) MARCH="STEAMROLLER";;
27 | BDVER4) MARCH="EXCAVATOR";;
28 | BTVER1) MARCH="BOBCAT";;
29 | BTVER2) MARCH="JAGUAR";;
30 | AMDFAM10) MARCH="MK10";;
31 | K8-SSE3) MARCH="K8SSE3";;
32 | BONNELL) MARCH="ATOM";;
33 | GOLDMONT-PLUS) MARCH="GOLDMONTPLUS";;
34 | SKYLAKE-AVX512) MARCH="SKYLAKE2";;
35 | MIVYBRIDGE)
36 | scripts/config --disable CONFIG_AGP_AMD64
37 | scripts/config --disable CONFIG_MICROCODE_AMD
38 | MARCH="MIVYBRIDGE";;
39 | ICELAKE-CLIENT) MARCH="ICELAKE";;
40 | esac
41 |
42 | # Add "M" prefix to MARCH variable
43 | MARCH2=M${MARCH}
44 |
45 | # Display detected CPU and apply optimization
46 | echo "----------------------------------"
47 | echo "| APPLYING AUTO-CPU-OPTIMIZATION |"
48 | echo "----------------------------------"
49 | echo "[*] DETECTED CPU (MARCH) : ${MARCH2}"
50 | scripts/config -k --disable CONFIG_GENERIC_CPU
51 | scripts/config -k --enable CONFIG_${MARCH2}
52 |
--------------------------------------------------------------------------------
/linux-bore/configure:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | cpu_arch() {
4 | plain ""
5 | plain "#########################################"
6 | plain "Set cpu microarchitecture optimization in GCC"
7 | read -rp "`echo $' > 1) M486SX : Select this for an 486-class CPU without an FPU such as AMD/Cyrix/IBM/Intel SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5S.\n \
8 | > 2) M486 : Select this for an 486-class CPU such as AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 and UMC U5D.\n \
9 | > 3) M586 : Select this for an 586 or 686 series processor such as the AMD K5,the Cyrix 5x86, 6x86 and 6x86MX. This choice does not assume the RDTSC (Read Time Stamp Counter) instruction.\n \
10 | > 4) M586TSC : Select this for a Pentium Classic processor with the RDTSC (Read Time Stamp Counter) instruction for benchmarking.\n \
11 | > 5) M586MMX : Select this for a Pentium with the MMX graphics/multimedia extended instructions.\n \
12 | > 6) M686 : Select this for Intel Pentium Pro chips.\n \
13 | > 7) MPENTIUMII : Select this for Intel chips based on the Pentium-II and pre-Coppermine Celeron core.\n \
14 | > 8) MPENTIUMIII : Select this for Intel chips based on the Pentium-III and Celeron-Coppermine core.\n \
15 | > 9) MPENTIUMM : Select this for Intel Pentium M (not Pentium-4 M) notebook chips.\n \
16 | > 10) MPENTIUM4 : Select this for Intel Pentium 4 chips.\n \
17 | > 11) MK6 : Select this for an AMD K6-family processor.\n \
18 | > 12) MK7 : Select this for an AMD Athlon K7-family processor.\n \
19 | > 13) MK8 : Select this for an AMD Opteron or Athlon64 Hammer-family processor.\n \
20 | > 14) MK8SSE3 : Select this for improved AMD Opteron or Athlon64 Hammer-family processors.\n \
21 | > 15) MK10 : Select this for an AMD 61xx Eight-Core Magny-Cours, Athlon X2 7x50,Phenom X3/X4/II, Athlon II X2/X3/X4, or Turion II-family processor.\n \
22 | > 16) MBARCELONA : Select this for AMD Family 10h Barcelona processors.\n \
23 | > 17) MBOBCAT : Select this for AMD Family 14h Bobcat processors.\n \
24 | > 18) MJAGUAR : Select this for AMD Family 16h Jaguar processors.\n \
25 | > 19) MBULLDOZER : Select this for AMD Family 15h Bulldozer processors.\n \
26 | > 20) MPILEDRIVER : Select this for AMD Family 15h Piledriver processors.\n \
27 | > 21) MSTEAMROLLER : Select this for AMD Family 15h Steamroller processors.\n \
28 | > 22) MEXCAVATOR : Select this for AMD Family 15h Excavator processors.\n \
29 | > 23) MZEN : Select this for AMD Family 17h Zen processors.\n \
30 | > 24) MZEN2 : Select this for AMD Family 17h Zen 2 processors.\n \
31 | > 25) MZEN3 : Select this for AMD Family 19h Zen 3 processors. - GCC 10.3 required\n \
32 | > 26) MZEN4 : Select this for AMD Family 19h Zen 4 processors. - GCC 13.1 required\n \
33 | > 27) MCRUSOE : Select this for a Transmeta Crusoe processor.\n \
34 | > 28) MEFFICEON : Select this for a Transmeta Efficeon processor.\n \
35 | > 29) MWINCHIPC6 : Select this for an IDT Winchip C6 chip.\n \
36 | > 30) MWINCHIP3D : Select this for an IDT Winchip-2, 2A or 3.\n \
37 | > 31) MELAN : Select this for an AMD Elan processor.\n \
38 | > 32) MGEODEGX1 : Select this for a Geode GX1 (Cyrix MediaGX) chip.\n \
39 | > 33) MGEODE_LX Select this for AMD Geode GX and LX processors.\n \
40 | > 34) MCYRIXIII : Select this for a Cyrix III or C3 chip.\n \
41 | > 35) MVIAC3_2 : Select this for a VIA C3 "Nehemiah".\n \
42 | > 36) MVIAC7 : Select this for a VIA C7.\n \
43 | > 37) MPSC : Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey Xeon CPUs with Intel 64bit which is compatible with x86-64.\n \
44 | > 38) MATOM : Select this for the Intel Atom platform.\n \
45 | > 39) MCORE2 : Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx) CPUs.\n \
46 | > 40) MNEHALEM : Select this for 1st Gen Core processors in the Nehalem family.\n \
47 | > 41) MWESTMERE : Select this for the Intel Westmere formerly Nehalem-C family.\n \
48 | > 42) MSILVERMONT Select this for the Intel Silvermont platform.\n \
49 | > 43) MGOLDMONT : Select this for the Intel Goldmont platform including Apollo Lake and Denverton.\n \
50 | > 44) MGOLDMONTPLUS : Select this for the Intel Goldmont Plus platform including Gemini Lake.\n \
51 | > 45) MSANDYBRIDGE : Select this for 2nd Gen Core processors in the Sandy Bridge family.\n \
52 | > 46) MIVYBRIDGE : Select this for 3rd Gen Core processors in the Ivy Bridge family.\n \
53 | > 47) MHASWELL : Select this for 4th Gen Core processors in the Haswell family.\n \
54 | > 48) MBROADWELL : Select this for 5th Gen Core processors in the Broadwell family.\n \
55 | > 49) MSKYLAKE : Select this for 6th Gen Core processors in the Skylake family.\n \
56 | > 50) MSKYLAKEX : Select this for 6th Gen Core processors in the Skylake X family.\n \
57 | > 51) MCANNONLAKE : Select this for 8th Gen Core processors.\n \
58 | > 52) MICELAKE : Select this for 10th Gen Core processors in the Ice Lake family.\n \
59 | > 53) MCASCADELAKE : Select this for Xeon processors in the Cascade Lake family.\n \
60 | > 54) MCOOPERLAKE : Select this for Xeon processors in the Cooper Lake family. - GCC 10.1 required\n \
61 | > 55) MTIGERLAKE : Select this for third-generation 10 nm process processors in the Tiger Lake family. - GCC 10.1 required\n \
62 | > 56) MSAPPHIRERAPIDS : Select this for third-generation 10 nm process processors in the Sapphire Rapids family. - GCC 11 required\n \
63 | > 57) MALDERLAKE : Select this for twelfth-generation processors in the Alder Lake family.- GCC 11 required\n \
64 | > 58) MRAPTORLAKE : Select this for thirteenth-generation processors in the Raptor Lake family.- GCC 13 required\n \
65 | > 59) MMETORLAKE : Select this for fourteenth-generation processors in the Meteor Lake family.- GCC 13 required\n \
66 | > 60) GENERIC_CPU : Generic x86-64 CPU. Run equally well on all x86-64 CPUs.\n \
67 | > 61) GENERIC_CPU2 : Run equally well on all x86-64 CPUs with min support of x86-64-v2. - GCC 11 required\n \
68 | > 62) GENERIC_CPU3 : Generic x86-64-v3 CPU with v3 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v3. - GCC 11 required\n \
69 | > 63) GENERIC_CPU4 : Generic x86-64 CPU with v4 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v4. - GCC 11 required\n \
70 | > 64) MNATIVE_INTEL : Intel-Native optimizations autodetected by GCC.\n \
71 | > 65) MNATIVE_AMD : AMD-Native optimizations autodetected by GCC.\n \
72 | > Default (60 : Gneric CPU)\nchoice[0-65]: '`" _microarchitecture
73 |
74 | if [[ "$_microarchitecture" = "1" ]]; then
75 | scripts/config --disable CONFIG_GENERIC_CPU
76 | scripts/config --enable CONFIG_M486
77 | elif [[ "$_microarchitecture" = "2" ]]; then
78 | scripts/config --disable CONFIG_GENERIC_CPU
79 | scripts/config --enable CONFIG_M486
80 | elif [[ "$_microarchitecture" = "3" ]]; then
81 | scripts/config --disable CONFIG_GENERIC_CPU
82 | scripts/config --enable CONFIG_M586
83 | elif [[ "$_microarchitecture" = "4" ]]; then
84 | scripts/config --disable CONFIG_GENERIC_CPU
85 | scripts/config --enable CONFIG_M586TSC
86 | elif [[ "$_microarchitecture" = "5" ]]; then
87 | scripts/config --disable CONFIG_GENERIC_CPU
88 | scripts/config --enable CONFIG_M586MMX
89 | elif [[ "$_microarchitecture" = "6" ]]; then
90 | scripts/config --disable CONFIG_GENERIC_CPU
91 | scripts/config --enable CONFIG_M686
92 | elif [[ "$_microarchitecture" = "7" ]]; then
93 | scripts/config --disable CONFIG_GENERIC_CPU
94 | scripts/config --enable CONFIG_MPENTIUMII
95 | elif [[ "$_microarchitecture" = "8" ]]; then
96 | scripts/config --disable CONFIG_GENERIC_CPU
97 | scripts/config --enable CONFIG_MPENTIUMIII
98 | elif [[ "$_microarchitecture" = "9" ]]; then
99 | scripts/config --disable CONFIG_GENERIC_CPU
100 | scripts/config --enable CONFIG_MPENTIUMM
101 | elif [[ "$_microarchitecture" = "10" ]]; then
102 | scripts/config --disable CONFIG_GENERIC_CPU
103 | scripts/config --enable CONFIG_MPENTIUM4
104 | elif [[ "$_microarchitecture" = "11" ]]; then
105 | scripts/config --disable CONFIG_GENERIC_CPU
106 | scripts/config --enable CONFIG_MK6
107 | elif [[ "$_microarchitecture" = "12" ]]; then
108 | scripts/config --disable CONFIG_GENERIC_CPU
109 | scripts/config --enable CONFIG_MK7
110 | elif [[ "$_microarchitecture" = "13" ]]; then
111 | scripts/config --disable CONFIG_GENERIC_CPU
112 | scripts/config --enable CONFIG_MK8
113 | elif [[ "$_microarchitecture" = "14" ]]; then
114 | scripts/config --disable CONFIG_GENERIC_CPU
115 | scripts/config --enable CONFIG_MK8SSE3
116 | elif [[ "$_microarchitecture" = "15" ]]; then
117 | scripts/config --disable CONFIG_GENERIC_CPU
118 | scripts/config --enable CONFIG_MK10
119 | elif [[ "$_microarchitecture" = "16" ]]; then
120 | scripts/config --disable CONFIG_GENERIC_CPU
121 | scripts/config --enable CONFIG_MBARCELONA
122 | elif [[ "$_microarchitecture" = "17" ]]; then
123 | scripts/config --disable CONFIG_GENERIC_CPU
124 | scripts/config --enable CONFIG_MBOBCAT
125 | elif [[ "$_microarchitecture" = "18" ]]; then
126 | scripts/config --disable CONFIG_GENERIC_CPU
127 | scripts/config --enable CONFIG_MJAGUAR
128 | elif [[ "$_microarchitecture" = "19" ]]; then
129 | scripts/config --disable CONFIG_GENERIC_CPU
130 | scripts/config --enable CONFIG_MBULLDOZER
131 | elif [[ "$_microarchitecture" = "20" ]]; then
132 | scripts/config --disable CONFIG_GENERIC_CPU
133 | scripts/config --enable CONFIG_MPILEDRIVER
134 | elif [[ "$_microarchitecture" = "21" ]]; then
135 | scripts/config --disable CONFIG_GENERIC_CPU
136 | scripts/config --enable CONFIG_MSTEAMROLLER
137 | elif [[ "$_microarchitecture" = "22" ]]; then
138 | scripts/config --disable CONFIG_GENERIC_CPU
139 | scripts/config --enable CONFIG_MEXCAVATOR
140 | elif [[ "$_microarchitecture" = "23" ]]; then
141 | scripts/config --disable CONFIG_GENERIC_CPU
142 | scripts/config --enable CONFIG_MZEN
143 | elif [[ "$_microarchitecture" = "24" ]]; then
144 | scripts/config --disable CONFIG_GENERIC_CPU
145 | scripts/config --enable CONFIG_MZEN2
146 | elif [[ "$_microarchitecture" = "25" ]]; then
147 | scripts/config --disable CONFIG_GENERIC_CPU
148 | scripts/config --enable CONFIG_MZEN3
149 | elif [[ "$_microarchitecture" = "26" ]]; then
150 | scripts/config --disable CONFIG_GENERIC_CPU
151 | scripts/config --enable CONFIG_MZEN4
152 | elif [[ "$_microarchitecture" = "27" ]]; then
153 | scripts/config --disable CONFIG_GENERIC_CPU
154 | scripts/config --enable CONFIG_MCRUSOE
155 | elif [[ "$_microarchitecture" = "28" ]]; then
156 | scripts/config --disable CONFIG_GENERIC_CPU
157 | scripts/config --enable CONFIG_MEFFICEON
158 | elif [[ "$_microarchitecture" = "29" ]]; then
159 | scripts/config --disable CONFIG_GENERIC_CPU
160 | scripts/config --enable CONFIG_MWINCHIPC6
161 | elif [[ "$_microarchitecture" = "30" ]]; then
162 | scripts/config --disable CONFIG_GENERIC_CPU
163 | scripts/config --enable CONFIG_MWINCHIP3D
164 | elif [[ "$_microarchitecture" = "31" ]]; then
165 | scripts/config --disable CONFIG_GENERIC_CPU
166 | scripts/config --enable CONFIG_MELAN
167 | elif [[ "$_microarchitecture" = "32" ]]; then
168 | scripts/config --disable CONFIG_GENERIC_CPU
169 | scripts/config --enable CONFIG_MGEODEGX1
170 | elif [[ "$_microarchitecture" = "33" ]]; then
171 | scripts/config --disable CONFIG_GENERIC_CPU
172 | scripts/config --enable CONFIG_MGEODE_LX
173 | elif [[ "$_microarchitecture" = "34" ]]; then
174 | scripts/config --disable CONFIG_GENERIC_CPU
175 | scripts/config --enable CONFIG_MCYRIXIII
176 | elif [[ "$_microarchitecture" = "35" ]]; then
177 | scripts/config --disable CONFIG_GENERIC_CPU
178 | scripts/config --enable CONFIG_MVIAC3_2
179 | elif [[ "$_microarchitecture" = "36" ]]; then
180 | scripts/config --disable CONFIG_GENERIC_CPU
181 | scripts/config --enable CONFIG_MVIAC7
182 | elif [[ "$_microarchitecture" = "37" ]]; then
183 | scripts/config --disable CONFIG_GENERIC_CPU
184 | scripts/config --enable CONFIG_MPSC
185 | elif [[ "$_microarchitecture" = "38" ]]; then
186 | scripts/config --disable CONFIG_GENERIC_CPU
187 | scripts/config --enable CONFIG_MATOM
188 | elif [[ "$_microarchitecture" = "39" ]]; then
189 | scripts/config --disable CONFIG_GENERIC_CPU
190 | scripts/config --enable CONFIG_MCORE2
191 | elif [[ "$_microarchitecture" = "40" ]]; then
192 | scripts/config --disable CONFIG_GENERIC_CPU
193 | scripts/config --enable CONFIG_MNEHALEM
194 | elif [[ "$_microarchitecture" = "41" ]]; then
195 | scripts/config --disable CONFIG_GENERIC_CPU
196 | scripts/config --enable CONFIG_MWESTMERE
197 | elif [[ "$_microarchitecture" = "42" ]]; then
198 | scripts/config --disable CONFIG_GENERIC_CPU
199 | scripts/config --enable CONFIG_MSILVERMONT
200 | elif [[ "$_microarchitecture" = "43" ]]; then
201 | scripts/config --disable CONFIG_GENERIC_CPU
202 | scripts/config --enable CONFIG_MGOLDMONT
203 | elif [[ "$_microarchitecture" = "44" ]]; then
204 | scripts/config --disable CONFIG_GENERIC_CPU
205 | scripts/config --enable CONFIG_MGOLDMONTPLUS
206 | elif [[ "$_microarchitecture" = "45" ]]; then
207 | scripts/config --disable CONFIG_GENERIC_CPU
208 | scripts/config --enable CONFIG_MSANDYBRIDGE
209 | elif [[ "$_microarchitecture" = "46" ]]; then
210 | scripts/config --disable CONFIG_GENERIC_CPU
211 | scripts/config --disable CONFIG_AGP_AMD64
212 | scripts/config --disable CONFIG_MICROCODE_AMD
213 | scripts/config --enable CONFIG_MIVYBRIDGE
214 | elif [[ "$_microarchitecture" = "47" ]]; then
215 | scripts/config --disable CONFIG_GENERIC_CPU
216 | scripts/config --enable CONFIG_MHASWELL
217 | elif [[ "$_microarchitecture" = "48" ]]; then
218 | scripts/config --disable CONFIG_GENERIC_CPU
219 | scripts/config --enable CONFIG_MBROADWELL
220 | elif [[ "$_microarchitecture" = "49" ]]; then
221 | scripts/config --disable CONFIG_GENERIC_CPU
222 | scripts/config --enable CONFIG_MSKYLAKE
223 | elif [[ "$_microarchitecture" = "50" ]]; then
224 | scripts/config --disable CONFIG_GENERIC_CPU
225 | scripts/config --enable CONFIG_MSKYLAKEX
226 | elif [[ "$_microarchitecture" = "51" ]]; then
227 | scripts/config --disable CONFIG_GENERIC_CPU
228 | scripts/config --enable CONFIG_MCANNONLAKE
229 | elif [[ "$_microarchitecture" = "52" ]]; then
230 | scripts/config --disable CONFIG_GENERIC_CPU
231 | scripts/config --enable CONFIG_MICELAKE
232 | elif [[ "$_microarchitecture" = "53" ]]; then
233 | scripts/config --disable CONFIG_GENERIC_CPU
234 | scripts/config --enable CONFIG_MCASCADELAKE
235 | elif [[ "$_microarchitecture" = "54" ]]; then
236 | scripts/config --disable CONFIG_GENERIC_CPU
237 | scripts/config --enable CONFIG_MCOOPERLAKE
238 | elif [[ "$_microarchitecture" = "55" ]]; then
239 | scripts/config --disable CONFIG_GENERIC_CPU
240 | scripts/config --enable CONFIG_MTIGERLAKE
241 | elif [[ "$_microarchitecture" = "56" ]]; then
242 | scripts/config --disable CONFIG_GENERIC_CPU
243 | scripts/config --enable CONFIG_MSAPPHIRERAPIDS
244 | elif [[ "$_microarchitecture" = "57" ]]; then
245 | scripts/config --disable CONFIG_GENERIC_CPU
246 | scripts/config --enable CONFIG_MALDERLAKE
247 | elif [[ "$_microarchitecture" = "58" ]]; then
248 | scripts/config --disable CONFIG_GENERIC_CPU
249 | scripts/config --enable CONFIG_MRAPTORLAKE
250 | elif [[ "$_microarchitecture" = "59" ]]; then
251 | scripts/config --disable CONFIG_GENERIC_CPU
252 | scripts/config --enable CONFIG_MMETORLAKE
253 | elif [[ "$_microarchitecture" = "60" ]]; then
254 | scripts/config --enable CONFIG_GENERIC_CPU
255 | elif [[ "$_microarchitecture" = "61" ]]; then
256 | scripts/config --disable CONFIG_GENERIC_CPU
257 | scripts/config --enable CONFIG_GENERIC_CPU2
258 | elif [[ "$_microarchitecture" = "62" ]]; then
259 | scripts/config --disable CONFIG_GENERIC_CPU
260 | scripts/config --enable CONFIG_GENERIC_CPU3
261 | elif [[ "$_microarchitecture" = "63" ]]; then
262 | scripts/config --disable CONFIG_GENERIC_CPU
263 | scripts/config --enable CONFIG_GENERIC_CPU4
264 | elif [[ "$_microarchitecture" = "64" ]]; then
265 | scripts/config --disable CONFIG_GENERIC_CPU
266 | scripts/config --enable CONFIG_MNATIVE_INTEL
267 | elif [[ "$_microarchitecture" = "65" ]]; then
268 | scripts/config --disable CONFIG_GENERIC_CPU
269 | scripts/config --enable CONFIG_MNATIVE_AMD
270 | else
271 | scripts/config --enable CONFIG_GENERIC_CPU
272 | fi
273 |
274 | plain ""
275 |
276 | sleep 2
277 | }
278 |
--------------------------------------------------------------------------------
/linux-cacule-lts/.SRCINFO:
--------------------------------------------------------------------------------
1 | pkgbase = linux-cacule-lts
2 | pkgdesc = Linux CacULE scheduler Kernel by CachyOS and with some other patches and other improvements
3 | pkgver = 5.15.16
4 | pkgrel = 1
5 | url = https://github.com/CachyOS/linux-cachyos
6 | arch = x86_64
7 | arch = x86_64_v3
8 | license = GPL2
9 | makedepends = kmod
10 | makedepends = bc
11 | makedepends = libelf
12 | makedepends = python-sphinx
13 | makedepends = python-sphinx_rtd_theme
14 | makedepends = graphviz
15 | makedepends = imagemagick
16 | makedepends = pahole
17 | makedepends = cpio
18 | makedepends = perl
19 | makedepends = tar
20 | makedepends = xz
21 | options = !strip
22 | source = https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.16.tar.xz
23 | source = config
24 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/cacule/cacule-5.15-full.patch
25 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-arch-patches.patch
26 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-cfi.patch
27 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-lru-patches.patch
28 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/AMD/0001-amdpstate.patch
29 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/AMD/amd-sched.patch
30 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/AMD/0001-amd64-patches.patch
31 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-bbr2.patch
32 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-block-patches.patch
33 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-cpu-patches.patch
34 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-misc.patch
35 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-btrfs-patches.patch
36 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-clearlinux-patches.patch
37 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-intel-patches.patch
38 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-ntfs3.patch
39 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-fixes-miscellaneous.patch
40 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-futex-wait.v-fsync-winesync.patch
41 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-hwmon-patches.patch
42 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-ksmbd-patches.patch
43 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-pf-patches.patch
44 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-page-table-check.patch
45 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-lqx-patches.patch
46 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-lrng-patches.patch
47 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-v4l2loopback.patch
48 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-security-patches.patch
49 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-spectre-patches.patch
50 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-xanmod-patches.patch
51 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-net-patches.patch
52 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-sbitmap-patches.patch
53 | source = https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15/0001-zstd.patch
54 | source = auto-cpu-optimization.sh
55 | md5sums = be0a904c58655c74c0986ad62500bcca
56 | md5sums = 788dcd568f1c00441ad9746706e4f1bc
57 | md5sums = afdbe964cd00357ef7248553ab9db091
58 | md5sums = ef9fa3407854cea8e78112c25bb72e41
59 | md5sums = e3fa8507aed6ef3ce37e62f18fe9b7e1
60 | md5sums = 1f3becd94390729d940a60b1e9b872b1
61 | md5sums = e4345010ef3270f6ccc5b26396c63a51
62 | md5sums = dccfe71705b24d3fb1f51aaf2016216d
63 | md5sums = 53f037488a66667220c263f92ded333d
64 | md5sums = 2a8097ba46be56fbbe3967e9c34c9a0b
65 | md5sums = 56ceaed8bfb44eca93298ccc5fe11ca7
66 | md5sums = 67764a5824b567b49bcce19c01d4e1b3
67 | md5sums = 018c728c9e744a99bb9b589028b8a1f6
68 | md5sums = 05308acbf7baf527692474cdef1dca82
69 | md5sums = 41887f2f959068e41756f4c39671ca79
70 | md5sums = b04c8a3f01b3dfba1410e2c26ec7d975
71 | md5sums = 8cf507777e20cd4d75a0627eef10c10d
72 | md5sums = 8bda7327ae759b1b52e3b617952bd964
73 | md5sums = 8c354c3d1962ec6785db7f0c3fbbab03
74 | md5sums = b6b2c2c6b4761aa5a8dea6ac0add8736
75 | md5sums = 5b5ea6f0b8ae6b726aab697a946f750d
76 | md5sums = 08c84362cb916b30d9c77e35b1b3bc54
77 | md5sums = 7d28f804d6b74f9a22ad30d67af5a669
78 | md5sums = 2130bb325438a2fc880593c5e345521f
79 | md5sums = b09b84168822521426f197610727618b
80 | md5sums = d9a892f66631615a72bdc93ee7397afa
81 | md5sums = bc64b1d1a9c95b07c28457f7214ebf81
82 | md5sums = 8d390345afa36c56fa15bf4f4edad9a2
83 | md5sums = 102fd2533e85eaecb4255df77d3e2901
84 | md5sums = 03bb361f5f900cc9fd1159eda5e4f0ff
85 | md5sums = 7530840f2eb439f64307dd3157beb28e
86 | md5sums = 940d98858e6e59ecc07da50e05f6bc3d
87 | md5sums = 21c98f19e883879dd3336c1fa143fd31
88 |
89 | pkgname = linux-cacule-lts
90 | pkgdesc = The Linux CacULE scheduler Kernel by CachyOS and with some other patches and other improvements kernel and modules
91 | depends = coreutils
92 | depends = kmod
93 | depends = initramfs
94 | optdepends = crda: to set the correct wireless channels of your country
95 | optdepends = linux-firmware: firmware images needed for some devices
96 | optdepends = modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig
97 | provides = VIRTUALBOX-GUEST-MODULES
98 | provides = WIREGUARD-MODULE
99 |
100 | pkgname = linux-cacule-lts-headers
101 | pkgdesc = Headers and scripts for building modules for the Linux CacULE scheduler Kernel by CachyOS and with some other patches and other improvements
102 | depends = linux-cacule-lts=5.15.16
103 | depends = pahole
104 |
--------------------------------------------------------------------------------
/linux-cacule-lts/PKGBUILD:
--------------------------------------------------------------------------------
1 | # Maintainer: Peter Jung ptr1337
2 | # Contributor: Piotr Gorski
3 | # Contributor: Jan Alexander Steffens (heftig)
4 | # Contributor: Tobias Powalowski
5 | # Contributor: Thomas Baechler
6 |
7 | ### Selecting the CPU scheduler
8 | # ATTENTION - one of seven predefined values should be selected!
9 | # 'bmq' - select 'BitMap Queue CPU scheduler'
10 | # 'pds' - select 'Priority and Deadline based Skip list multiple queue CPU scheduler'
11 | # 'cacule' - select 'CacULE scheduler'
12 | # 'cacule-rdb' - select 'CacULE-RDB scheduler'
13 | # 'bore' - select 'Burst-Oriented Response Enhancer'
14 | # 'tt' - select 'Task Type Scheduler by Hamad Marri'
15 | # 'cfs' - select 'Completely Fair Scheduler'
16 | _cpusched='cacule'
17 |
18 | ### BUILD OPTIONS
19 | # Set these variables to ANYTHING that is not null to enable them
20 |
21 | ### Tweak kernel options prior to a build via nconfig
22 | _makenconfig=
23 |
24 | # NUMA is optimized for multi-socket motherboards.
25 | # A single multi-core CPU actually runs slower with NUMA enabled.
26 | # See, https://bugs.archlinux.org/task/31187
27 | _NUMAdisable=y
28 |
29 | # Compile ONLY used modules to VASTLYreduce the number of modules built
30 | # and the build time.
31 | #
32 | # To keep track of which modules are needed for your specific system/hardware,
33 | # give module_db script a try: https://aur.archlinux.org/packages/modprobed-db
34 | # This PKGBUILD read the database kept if it exists
35 | #
36 | # More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db
37 | _localmodcfg=
38 |
39 | # Use the current kernel's .config file
40 | # Enabling this option will use the .config of the RUNNING kernel rather than
41 | # the ARCH defaults. Useful when the package gets updated and you already went
42 | # through the trouble of customizing your config options. NOT recommended when
43 | # a new kernel is released, but again, convenient for package bumps.
44 | _use_current=
45 |
46 | #enable winesync
47 | _winesync=y
48 |
49 | ### Running with a 1000HZ, 750Hz or 500HZ tick rate
50 | _1k_HZ_ticks=
51 | _750_HZ_ticks=y
52 | _600_HZ_ticks=
53 | _500_HZ_ticks=
54 |
55 | ### Disable MQ-Deadline I/O scheduler
56 | _mq_deadline_disable=y
57 |
58 | ### Disable Kyber I/O scheduler
59 | _kyber_disable=y
60 |
61 | ### Enable protect file mappings under memory pressure
62 | _mm_protect=y
63 |
64 | ### Enable multigenerational LRU
65 | _lru_enable=y
66 |
67 | ## Enable Page-Table-Check
68 | _page_table_check=y
69 |
70 | ### Enable DAMON
71 | _damon=
72 |
73 | ### Enable Linux Random Number Generator
74 | _lrng_enable=y
75 |
76 | ## Apply Kernel automatic Optimization
77 | _use_auto_optimization=y
78 |
79 | ## Apply Kernel Optimization selecting
80 | _use_optimization_select=
81 |
82 |
83 | ### Selecting the ZSTD compression level
84 | # ATTENTION - one of two predefined values should be selected!
85 | # 'ultra' - highest compression ratio
86 | # 'normal' - standard compression ratio
87 | _zstd_level='normal'
88 |
89 | ### Selecting the ZSTD module compression level
90 | # If you want to use ZSTD compression,
91 | # first install mkinitcpio-zstd:
92 | # https://gitlab.com/sirlucjan/lucjan-kernels/tree/master/depends
93 | # or
94 | # https://github.com/sirlucjan/lucjan-kernels/tree/master/depends
95 | # ATTENTION - one of two predefined values should be selected!
96 | # 'ultra' - highest compression ratio
97 | # 'normal' - standard compression ratio
98 | # WARNING: the ultra settings can sometimes
99 | # be counterproductive in both size and speed.
100 | _zstd_module_level='normal'
101 |
102 | ### Enable SECURITY_FORK_BRUTE
103 | # WARNING Not recommended.
104 | # An experimental solution, still in testing phase.
105 | # Possible compilation and installation errors.
106 | # Leave it unselected.
107 | _fork_brute=
108 |
109 | ## Enable it for compiling with LLVM and THINLTO
110 | _use_llvm_lto=
111 |
112 | # Enable it for using the LLVM CFI PATCH for a better security
113 | _use_cfi=
114 |
115 | ## Enable PGO (patch is failing when cfi is also used)
116 | #_use_pgo=
117 |
118 |
119 | if [ -n "$_use_llvm_lto" ]; then
120 | pkgbase=linux-cacule-lts-lto
121 | else
122 | pkgbase=linux-cacule-lts
123 | fi
124 | _major=5.15
125 | _minor=16
126 | pkgver=${_major}.${_minor}
127 | _srcname=linux-${pkgver}
128 | arch=(x86_64 x86_64_v3)
129 | pkgdesc='Linux CacULE scheduler Kernel by CachyOS and with some other patches and other improvements'
130 | _srcname=linux-${pkgver}
131 | pkgrel=1
132 | arch=('x86_64' 'x86_64_v3')
133 | url="https://github.com/CachyOS/linux-cachyos"
134 | license=('GPL2')
135 | options=('!strip')
136 | makedepends=('kmod' 'bc' 'libelf' 'python-sphinx' 'python-sphinx_rtd_theme'
137 | 'graphviz' 'imagemagick' 'pahole' 'cpio' 'perl' 'tar' 'xz')
138 | if [ -n "$_use_llvm_lto" ]; then
139 | depends=(clang llvm lld python)
140 | fi
141 | if [ -n "$_use_llvm_lto" ]; then
142 | makedepends+=(clang llvm lld python)
143 | fi
144 | _patchsource="https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15"
145 | source=(
146 | "https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.xz"
147 | "config"
148 | "${_patchsource}/cacule/cacule-5.15-full.patch"
149 | "${_patchsource}/0001-arch-patches.patch"
150 | "${_patchsource}/0001-cfi.patch"
151 | "${_patchsource}/0001-lru-patches.patch"
152 | "${_patchsource}/AMD/0001-amdpstate.patch"
153 | "${_patchsource}/AMD/amd-sched.patch"
154 | "${_patchsource}/AMD/0001-amd64-patches.patch"
155 | "${_patchsource}/0001-bbr2.patch"
156 | "${_patchsource}/0001-block-patches.patch"
157 | "${_patchsource}/0001-cpu-patches.patch"
158 | "${_patchsource}/0001-misc.patch"
159 | "${_patchsource}/0001-btrfs-patches.patch"
160 | "${_patchsource}/0001-clearlinux-patches.patch"
161 | "${_patchsource}/0001-intel-patches.patch"
162 | "${_patchsource}/0001-ntfs3.patch"
163 | "${_patchsource}/0001-fixes-miscellaneous.patch"
164 | "${_patchsource}/0001-futex-wait.v-fsync-winesync.patch"
165 | "${_patchsource}/0001-hwmon-patches.patch"
166 | "${_patchsource}/0001-ksmbd-patches.patch"
167 | "${_patchsource}/0001-pf-patches.patch"
168 | "${_patchsource}/0001-page-table-check.patch"
169 | "${_patchsource}/0001-lqx-patches.patch"
170 | "${_patchsource}/0001-lrng-patches.patch"
171 | "${_patchsource}/0001-v4l2loopback.patch"
172 | "${_patchsource}/0001-security-patches.patch"
173 | "${_patchsource}/0001-spectre-patches.patch"
174 | "${_patchsource}/0001-xanmod-patches.patch"
175 | "${_patchsource}/0001-net-patches.patch"
176 | "${_patchsource}/0001-sbitmap-patches.patch"
177 | "${_patchsource}/0001-zstd.patch"
178 | "auto-cpu-optimization.sh"
179 | )
180 |
181 | #if [ -n "$_use_pgo" ]; then
182 | # source+=("${_patchsource}/0001-PGO.patch")
183 | #fi
184 |
185 | if [ -n "$_use_llvm_lto" ]; then
186 | LLVMOPTS="LLVM=1 LLVM_IAS=1"
187 | CLANGOPTS="CC=clang LD=ld.lld"
188 | else
189 | LLVMOPTS=""
190 | CLANGOPTS=""
191 | fi
192 |
193 | export KBUILD_BUILD_HOST=archlinux
194 | export KBUILD_BUILD_USER=$pkgbase
195 | export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
196 |
197 | prepare() {
198 |
199 | cd $_srcname
200 |
201 | ### Setting version
202 | echo "Setting version..."
203 | scripts/setlocalversion --save-scmversion
204 | echo "-$pkgrel" > localversion.10-pkgrel
205 | echo "${pkgbase#linux}" > localversion.20-pkgname
206 |
207 | ### Patching sources
208 | local src
209 | for src in "${source[@]}"; do
210 | src="${src%%::*}"
211 | src="${src##*/}"
212 | [[ $src = *.patch ]] || continue
213 | echo "Applying patch $src..."
214 | patch -Np1 < "../$src"
215 | done
216 |
217 | ### Setting config
218 | echo "Setting config..."
219 | cp ../config .config
220 |
221 |
222 | ### Optionally use running kernel's config
223 | # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
224 | if [ -n "$_use_current" ]; then
225 | if [[ -s /proc/config.gz ]]; then
226 | echo "Extracting config from /proc/config.gz..."
227 | # modprobe configs
228 | zcat /proc/config.gz > ./.config
229 | else
230 | warning "Your kernel was not compiled with IKCONFIG_PROC!"
231 | warning "You cannot read the current config!"
232 | warning "Aborting!"
233 | exit
234 | fi
235 | fi
236 |
237 | ### Microarchitecture Optimization (GCC/CLANG)
238 | if [ -n "$_use_auto_optimization" ]; then
239 | "${srcdir}"/auto-cpu-optimization.sh
240 | fi
241 |
242 |
243 | if [ -n "$_use_optimization_select" ]; then
244 | source "${startdir}"/configure
245 | cpu_arch
246 | fi
247 |
248 |
249 | ### Selecting the CPU scheduler
250 | if [ "$_cpusched" = "bmq" ]; then
251 | echo "Selecting BMQ CPU scheduler..."
252 | scripts/config --enable CONFIG_SCHED_BMQ
253 | scripts/config --disable CONFIG_SCHED_PDS
254 | elif [ "$_cpusched" = "pds" ]; then
255 | echo "Selecting PDS CPU scheduler..."
256 | scripts/config --disable CONFIG_SCHED_BMQ
257 | scripts/config --enable CONFIG_SCHED_PDS
258 | elif [ "$_cpusched" = "cacule" ]; then
259 | echo "Selecting CacULE scheduler..."
260 | scripts/config --disable CONFIG_SCHED_ALT
261 | scripts/config --enable CONFIG_CACULE_SCHED
262 | elif [ "$_cpusched" = "cacule-rdb" ]; then
263 | echo "Selecting CacULE-RDB scheduler..."
264 | scripts/config --disable CONFIG_SCHED_ALT
265 | scripts/config --enable CONFIG_CACULE_SCHED
266 | scripts/config --enable CONFIG_CACULE_RDB
267 | scripts/config --set-val CONFIG_RDB_INTERVAL 19
268 | elif [ "$_cpusched" = "tt" ]; then
269 | echo "Enable TT CPU scheduler..."
270 | scripts/config --enable CONFIG_TT_SCHED
271 | scripts/config --enable CONFIG_TT_ACCOUNTING_STATS
272 | elif [ "$_cpusched" = "bore" ]; then
273 | echo "Selecting BORE Scheduler..."
274 | scripts/config --disable CONFIG_SCHED_ALT
275 | elif [ "$_cpusched" = "cfs" ]; then
276 | echo "Selecting Completely Fair Scheduler..."
277 | scripts/config --disable CONFIG_SCHED_ALT
278 | else
279 | if [ -n "$_cpusched" ]; then
280 | error "The value $_cpusched is invalid. Choose the correct one again."
281 | else
282 | error "The value is empty. Choose the correct one again."
283 | fi
284 | error "Selecting the CPU scheduler failed!"
285 | exit
286 | fi
287 |
288 |
289 | if [ -n "$_use_cfi" ] && [ -n "$_use_llvm_lto" ]; then
290 | echo "Enabling CFI"
291 | scripts/config --enable CONFIG_ARCH_SUPPORTS_CFI_CLANG
292 | scripts/config --enable CONFIG_CFI_CLANG
293 | fi
294 |
295 | if [ -n "$_use_llvm_lto" ]; then
296 | echo "Enable LLVM LTO"
297 | scripts/config --disable CONFIG_LTO_NONE
298 | fi
299 |
300 | # if [ -n "$_use_pgo" ]; then
301 | # scripts/config --enable CONFIG_ARCH_SUPPORTS_PGO_CLANG
302 | # scripts/config --enable DEBUG_FS
303 | # scripts/config --enable CONFIG_PGO_CLANG
304 | # fi
305 |
306 | ### Optionally set tickrate to 1000
307 | if [ -n "$_1k_HZ_ticks" ]; then
308 | echo "Setting tick rate to 1k..."
309 | scripts/config --disable CONFIG_HZ_300
310 | scripts/config --enable CONFIG_HZ_1000
311 | scripts/config --set-val CONFIG_HZ 1000
312 | fi
313 |
314 | ### Optionally set tickrate to 750HZ
315 | if [ -n "$_750_HZ_ticks" ]; then
316 | echo "Setting tick rate to 750HZ..."
317 | scripts/config --disable CONFIG_HZ_300
318 | scripts/config --enable CONFIG_HZ_750
319 | scripts/config --set-val CONFIG_HZ 750
320 | fi
321 |
322 | ### Optionally set tickrate to 600HZ
323 | if [ -n "$_600_HZ_ticks" ]; then
324 | echo "Setting tick rate to 600HZ..."
325 | scripts/config --disable CONFIG_HZ_300
326 | scripts/config --enable CONFIG_HZ_600
327 | scripts/config --set-val CONFIG_HZ 600
328 | fi
329 |
330 | ### Optionally set tickrate to 500HZ
331 | if [ -n "$_500_HZ_ticks" ]; then
332 | echo "Setting tick rate to 500HZ..."
333 | scripts/config --disable CONFIG_HZ_300
334 | scripts/config --enable CONFIG_HZ_500
335 | scripts/config --set-val CONFIG_HZ 500
336 | fi
337 |
338 | ### Optionally disable NUMA for 64-bit kernels only
339 | # (x86 kernels do not support NUMA)
340 | if [ -n "$_NUMAdisable" ]; then
341 | echo "Disabling NUMA from kernel config..."
342 | scripts/config --disable CONFIG_NUMA
343 | fi
344 |
345 | if [ -n "$_winesync" ]; then
346 | echo "Enable winesync support"
347 | scripts/config --module CONFIG_WINESYNC
348 | fi
349 |
350 | ### Disable MQ-Deadline I/O scheduler
351 | if [ -n "$_mq_deadline_disable" ]; then
352 | echo "Disabling MQ-Deadline I/O scheduler..."
353 | scripts/config --disable CONFIG_MQ_IOSCHED_DEADLINE
354 | fi
355 |
356 | ### Disable Kyber I/O scheduler
357 | if [ -n "$_kyber_disable" ]; then
358 | echo "Disabling Kyber I/O scheduler..."
359 | scripts/config --disable CONFIG_MQ_IOSCHED_KYBER
360 | fi
361 |
362 |
363 | ### Enable protect mappings under memory pressure
364 | if [ -n "$_mm_protect" ]; then
365 | echo "Enabling protect file mappings under memory pressure..."
366 | scripts/config --set-val CONFIG_ANON_MIN_KBYTES 0
367 | scripts/config --set-val CONFIG_CLEAN_LOW_KBYTES 524288
368 | scripts/config --set-val CONFIG_CLEAN_MIN_KBYTES 0
369 | fi
370 |
371 | ### Enable multigenerational LRU
372 | if [ -n "$_page_table_check" ]; then
373 | echo "Enabling Page-Table-Check..."
374 | scripts/config --enable CONFIG_PAGE_TABLE_CHECK
375 | scripts/config --enable CONFIG_PAGE_TABLE_CHECK_ENFORCED
376 | scripts/config --enable CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK
377 | fi
378 |
379 | ### Enable multigenerational LRU
380 | if [ -n "$_lru_enable" ]; then
381 | echo "Enabling multigenerational LRU..."
382 | scripts/config --enable CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG
383 | scripts/config --enable CONFIG_LRU_GEN
384 | scripts/config --set-val CONFIG_NR_LRU_GENS 7
385 | scripts/config --set-val CONFIG_TIERS_PER_GEN 4
386 | scripts/config --enable CONFIG_LRU_GEN_ENABLED
387 | scripts/config --disable CONFIG_LRU_GEN_STATS
388 | fi
389 |
390 | ### Enable DAMON
391 | if [ -n "$_damon" ]; then
392 | echo "Enabling DAMON..."
393 | scripts/config --enable CONFIG_DAMON
394 | scripts/config --disable CONFIG_DAMON_VADDR
395 | scripts/config --disable CONFIG_DAMON_DBGFS
396 | scripts/config --enable CONFIG_DAMON_PADDR
397 | scripts/config --enable CONFIG_DAMON_RECLAIM
398 | fi
399 |
400 | ### Enable Linux Random Number Generator
401 | if [ -n "$_lrng_enable" ]; then
402 | echo "Enabling Linux Random Number Generator ..."
403 | echo "Enabling Linux Random Number Generator with pfkernel config..."
404 | scripts/config --enable CONFIG_LRNG
405 | scripts/config --enable CONFIG_LRNG_OVERSAMPLE_ENTROPY_SOURCES
406 | scripts/config --set-val CONFIG_CONFIG_LRNG_OVERSAMPLE_ES_BITS 64
407 | scripts/config --set-val CONFIG_LRNG_SEED_BUFFER_INIT_ADD_BITS 128
408 | scripts/config --enable CONFIG_LRNG_IRQ
409 | scripts/config --enable CONFIG_LRNG_CONTINUOUS_COMPRESSION_ENABLED
410 | scripts/config --disable CONFIG_LRNG_CONTINUOUS_COMPRESSION_DISABLED
411 | scripts/config --enable CONFIG_LRNG_ENABLE_CONTINUOUS_COMPRESSION
412 | scripts/config --enable CONFIG_LRNG_SWITCHABLE_CONTINUOUS_COMPRESSION
413 | scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_512
414 | scripts/config --enable CONFIG_LRNG_COLLECTION_SIZE_1024
415 | scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_2048
416 | scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_4096
417 | scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_8192
418 | scripts/config --set-val CONFIG_LRNG_COLLECTION_SIZE 1024
419 | scripts/config --enable CONFIG_LRNG_HEALTH_TESTS
420 | scripts/config --set-val CONFIG_LRNG_RCT_CUTOFF 31
421 | scripts/config --set-val CONFIG_LRNG_APT_CUTOFF 325
422 | scripts/config --set-val CONFIG_LRNG_IRQ_ENTROPY_RATE 256
423 | scripts/config --enable CONFIG_LRNG_JENT
424 | scripts/config --set-val CONFIG_LRNG_JENT_ENTROPY_RATE 16
425 | scripts/config --enable CONFIG_LRNG_CPU
426 | scripts/config --set-val CONFIG_LRNG_CPU_ENTROPY_RATE 8
427 | scripts/config --enable CONFIG_LRNG_DRNG_SWITCH
428 | scripts/config --enable CONFIG_LRNG_KCAPI_HASH
429 | scripts/config --module CONFIG_LRNG_DRBG
430 | scripts/config --module CONFIG_LRNG_KCAPI
431 | scripts/config --enable CONFIG_LRNG_TESTING_MENU
432 | scripts/config --disable CONFIG_LRNG_RAW_HIRES_ENTROPY
433 | scripts/config --disable CONFIG_LRNG_RAW_JIFFIES_ENTROPY
434 | scripts/config --disable CONFIG_LRNG_RAW_IRQ_ENTROPY
435 | scripts/config --disable CONFIG_LRNG_RAW_IRQFLAGS_ENTROPY
436 | scripts/config --disable CONFIG_LRNG_RAW_RETIP_ENTROPY
437 | scripts/config --disable CONFIG_LRNG_RAW_REGS_ENTROPY
438 | scripts/config --disable CONFIG_LRNG_RAW_ARRAY
439 | scripts/config --disable CONFIG_LRNG_IRQ_PERF
440 | scripts/config --disable CONFIG_LRNG_ACVT_HASH
441 | scripts/config --enable CONFIG_LRNG_RUNTIME_ES_CONFIG
442 | scripts/config --disable CONFIG_LRNG_RUNTIME_MAX_WO_RESEED_CONFIG
443 | scripts/config --disable CONFIG_LRNG_TEST_CPU_ES_COMPRESSION
444 | scripts/config --enable CONFIG_LRNG_SELFTEST
445 | scripts/config --disable CONFIG_LRNG_SELFTEST_PANIC
446 | fi
447 |
448 | ### Selecting the ZSTD compression level
449 | if [ "$_zstd_level" = "ultra" ]; then
450 | echo "Enabling highest ZSTD compression ratio..."
451 | scripts/config --set-val CONFIG_KERNEL_ZSTD_LEVEL 19
452 | scripts/config --enable CONFIG_KERNEL_ZSTD_LEVEL_ULTRA
453 | elif [ "$_zstd_level" = "normal" ]; then
454 | echo "Enabling standard ZSTD compression ratio..."
455 | scripts/config --set-val CONFIG_KERNEL_ZSTD_LEVEL 19
456 | scripts/config --disable CONFIG_KERNEL_ZSTD_LEVEL_ULTRA
457 | else
458 | if [ -n "$_zstd_level" ]; then
459 | error "The value $_zstd_level is invalid. Choose the correct one again."
460 | else
461 | error "The value is empty. Choose the correct one again."
462 | fi
463 | error "Selecting the ZSTD compression level failed!"
464 | exit
465 | fi
466 |
467 | ### Selecting the ZSTD module compression level
468 | if [ "$_zstd_module_level" = "ultra" ]; then
469 | echo "Enabling highest ZSTD module compression ratio..."
470 | scripts/config --set-val CONFIG_MODULE_COMPRESS_ZSTD_LEVEL 19
471 | scripts/config --enable CONFIG_MODULE_COMPRESS_ZSTD_ULTRA
472 | scripts/config --set-val CONFIG_MODULE_COMPRESS_ZSTD_LEVEL_ULTRA 22
473 | elif [ "$_zstd_module_level" = "normal" ]; then
474 | echo "Enabling standard ZSTD module compression ratio..."
475 | scripts/config --set-val CONFIG_MODULE_COMPRESS_ZSTD_LEVEL 19
476 | scripts/config --disable CONFIG_MODULE_COMPRESS_ZSTD_ULTRA
477 | else
478 | if [ -n "$_zstd_module_level" ]; then
479 | error "The value $_zstd_module_level is invalid. Choose the correct one again."
480 | else
481 | error "The value is empty. Choose the correct one again."
482 | fi
483 | error "Selecting the ZSTD module compression level failed!"
484 | exit
485 | fi
486 |
487 | echo "Disabling TCP_CONG_CUBIC..."
488 | scripts/config --module CONFIG_TCP_CONG_CUBIC
489 | scripts/config --disable CONFIG_DEFAULT_CUBIC
490 | echo "Enabling TCP_CONG_BBR2..."
491 | scripts/config --enable CONFIG_TCP_CONG_BBR2
492 | scripts/config --enable CONFIG_DEFAULT_BBR2
493 | scripts/config --set-str CONFIG_DEFAULT_TCP_CONG bbr2
494 | echo "Setting performance governor..."
495 | scripts/config --disable CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL
496 | scripts/config --enable CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
497 | scripts/config --enable CONFIG_CPU_FREQ_GOV_ONDEMAND
498 | scripts/config --enable CONFIG_CPU_FREQ_GOV_PERFORMANCE
499 | scripts/config --enable CONFIG_CPU_FREQ_GOV_CONSERVATIVE
500 | scripts/config --enable CONFIG_CPU_FREQ_GOV_USERSPACE
501 | scripts/config --enable CONFIG_CPU_FREQ_GOV_SCHEDUTIL
502 | echo "Enable AMD PSTATE driver"
503 | scripts/config --enable CONFIG_X86_AMD_PSTATE
504 | scripts/config --enable CONFIG_AMD_PTDMA
505 | echo "Enable Anbox"
506 | scripts/config --enable CONFIG_ASHMEM
507 | scripts/config --enable CONFIG_ANDROID
508 | scripts/config --enable CONFIG_ANDROID_BINDER_IPC
509 | scripts/config --enable CONFIG_ANDROID_BINDERFS
510 | scripts/config --enable CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
511 | scripts/config --enable CONFIG_NTFS3_FS
512 | echo "Enabling KBUILD_CFLAGS -O3..."
513 | scripts/config --disable CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
514 | scripts/config --enable CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
515 | scripts/config --module CONFIG_IP_NF_TARGET_FULLCONENAT
516 | scripts/config --module CONFIG_NETFILTER_XT_TARGET_FULLCONENAT
517 |
518 |
519 | ### Optionally load needed modules for the make localmodconfig
520 | # See https://aur.archlinux.org/packages/modprobed-db
521 | if [ -n "$_localmodcfg" ]; then
522 | if [ -f $HOME/.config/modprobed.db ]; then
523 | echo "Running Steven Rostedt's make localmodconfig now"
524 | make $LLVMOPTS LSMOD=$HOME/.config/modprobed.db localmodconfig
525 | else
526 | echo "No modprobed.db data found"
527 | exit
528 | fi
529 | fi
530 |
531 | echo "Applying default config..."
532 |
533 | make $LLVMOPTS olddefconfig
534 | make $LLVMOPTS -s kernelrelease > version
535 | echo "Prepared $pkgbase version $( 1) M486SX : Select this for an 486-class CPU without an FPU such as AMD/Cyrix/IBM/Intel SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5S.\n \
8 | > 2) M486 : Select this for an 486-class CPU such as AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 and UMC U5D.\n \
9 | > 3) M586 : Select this for an 586 or 686 series processor such as the AMD K5,the Cyrix 5x86, 6x86 and 6x86MX. This choice does not assume the RDTSC (Read Time Stamp Counter) instruction.\n \
10 | > 4) M586TSC : Select this for a Pentium Classic processor with the RDTSC (Read Time Stamp Counter) instruction for benchmarking.\n \
11 | > 5) M586MMX : Select this for a Pentium with the MMX graphics/multimedia extended instructions.\n \
12 | > 6) M686 : Select this for Intel Pentium Pro chips.\n \
13 | > 7) MPENTIUMII : Select this for Intel chips based on the Pentium-II and pre-Coppermine Celeron core.\n \
14 | > 8) MPENTIUMIII : Select this for Intel chips based on the Pentium-III and Celeron-Coppermine core.\n \
15 | > 9) MPENTIUMM : Select this for Intel Pentium M (not Pentium-4 M) notebook chips.\n \
16 | > 10) MPENTIUM4 : Select this for Intel Pentium 4 chips.\n \
17 | > 11) MK6 : Select this for an AMD K6-family processor.\n \
18 | > 12) MK7 : Select this for an AMD Athlon K7-family processor.\n \
19 | > 13) MK8 : Select this for an AMD Opteron or Athlon64 Hammer-family processor.\n \
20 | > 14) MK8SSE3 : Select this for improved AMD Opteron or Athlon64 Hammer-family processors.\n \
21 | > 15) MK10 : Select this for an AMD 61xx Eight-Core Magny-Cours, Athlon X2 7x50,Phenom X3/X4/II, Athlon II X2/X3/X4, or Turion II-family processor.\n \
22 | > 16) MBARCELONA : Select this for AMD Family 10h Barcelona processors.\n \
23 | > 17) MBOBCAT : Select this for AMD Family 14h Bobcat processors.\n \
24 | > 18) MJAGUAR : Select this for AMD Family 16h Jaguar processors.\n \
25 | > 19) MBULLDOZER : Select this for AMD Family 15h Bulldozer processors.\n \
26 | > 20) MPILEDRIVER : Select this for AMD Family 15h Piledriver processors.\n \
27 | > 21) MSTEAMROLLER : Select this for AMD Family 15h Steamroller processors.\n \
28 | > 22) MEXCAVATOR : Select this for AMD Family 15h Excavator processors.\n \
29 | > 23) MZEN : Select this for AMD Family 17h Zen processors.\n \
30 | > 24) MZEN2 : Select this for AMD Family 17h Zen 2 processors.\n \
31 | > 25) MZEN3 : Select this for AMD Family 19h Zen 3 processors. - GCC 10.3 required\n \
32 | > 26) MCRUSOE : Select this for a Transmeta Crusoe processor.\n \
33 | > 27) MEFFICEON : Select this for a Transmeta Efficeon processor.\n \
34 | > 28) MWINCHIPC6 : Select this for an IDT Winchip C6 chip.\n \
35 | > 29) MWINCHIP3D : Select this for an IDT Winchip-2, 2A or 3.\n \
36 | > 30) MELAN : Select this for an AMD Elan processor.\n \
37 | > 31) MGEODEGX1 : Select this for a Geode GX1 (Cyrix MediaGX) chip.\n \
38 | > 32) MGEODE_LX Select this for AMD Geode GX and LX processors.\n \
39 | > 33) MCYRIXIII : Select this for a Cyrix III or C3 chip.\n \
40 | > 34) MVIAC3_2 : Select this for a VIA C3 "Nehemiah".\n \
41 | > 35) MVIAC7 : Select this for a VIA C7.\n \
42 | > 36) MPSC : Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey Xeon CPUs with Intel 64bit which is compatible with x86-64.\n \
43 | > 37) MATOM : Select this for the Intel Atom platform.\n \
44 | > 38) MCORE2 : Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx) CPUs.\n \
45 | > 39) MNEHALEM : Select this for 1st Gen Core processors in the Nehalem family.\n \
46 | > 40) MWESTMERE : Select this for the Intel Westmere formerly Nehalem-C family.\n \
47 | > 41) MSILVERMONT Select this for the Intel Silvermont platform.\n \
48 | > 42) MGOLDMONT : Select this for the Intel Goldmont platform including Apollo Lake and Denverton.\n \
49 | > 43) MGOLDMONTPLUS : Select this for the Intel Goldmont Plus platform including Gemini Lake.\n \
50 | > 44) MSANDYBRIDGE : Select this for 2nd Gen Core processors in the Sandy Bridge family.\n \
51 | > 45) MIVYBRIDGE : Select this for 3rd Gen Core processors in the Ivy Bridge family.\n \
52 | > 46) MHASWELL : Select this for 4th Gen Core processors in the Haswell family.\n \
53 | > 47) MBROADWELL : Select this for 5th Gen Core processors in the Broadwell family.\n \
54 | > 48) MSKYLAKE : Select this for 6th Gen Core processors in the Skylake family.\n \
55 | > 49) MSKYLAKEX : Select this for 6th Gen Core processors in the Skylake X family.\n \
56 | > 50) MCANNONLAKE : Select this for 8th Gen Core processors.\n \
57 | > 51) MICELAKE : Select this for 10th Gen Core processors in the Ice Lake family.\n \
58 | > 52) MCASCADELAKE : Select this for Xeon processors in the Cascade Lake family.\n \
59 | > 53) MCOOPERLAKE : Select this for Xeon processors in the Cooper Lake family. - GCC 10.1 required\n \
60 | > 54) MTIGERLAKE : Select this for third-generation 10 nm process processors in the Tiger Lake family. - GCC 10.1 required\n \
61 | > 55) MSAPPHIRERAPIDS : Select this for third-generation 10 nm process processors in the Sapphire Rapids family. - GCC 11 required\n \
62 | > 56) MALDERLAKE : Select this for twelfth-generation processors in the Alder Lake family.- GCC 11 required\n \
63 | > 57) GENERIC_CPU : Generic x86-64 CPU. Run equally well on all x86-64 CPUs.\n \
64 | > 58) GENERIC_CPU2 : Run equally well on all x86-64 CPUs with min support of x86-64-v2. - GCC 11 required\n \
65 | > 59) GENERIC_CPU3 : Generic x86-64-v3 CPU with v3 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v3. - GCC 11 required\n \
66 | > 60) GENERIC_CPU4 : Generic x86-64 CPU with v4 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v4. - GCC 11 required\n \
67 | > 61) MNATIVE_INTEL : Intel-Native optimizations autodetected by GCC.\n \
68 | > 62) MNATIVE_AMD : AMD-Native optimizations autodetected by GCC.\n \
69 | > Default (57 : Gneric CPU)\nchoice[0-62]: '`" _microarchitecture
70 |
71 | if [[ "$_microarchitecture" = "1" ]]; then
72 | scripts/config --disable CONFIG_GENERIC_CPU
73 | scripts/config --enable CONFIG_M486
74 | elif [[ "$_microarchitecture" = "2" ]]; then
75 | scripts/config --disable CONFIG_GENERIC_CPU
76 | scripts/config --enable CONFIG_M486
77 | elif [[ "$_microarchitecture" = "3" ]]; then
78 | scripts/config --disable CONFIG_GENERIC_CPU
79 | scripts/config --enable CONFIG_M586
80 | elif [[ "$_microarchitecture" = "4" ]]; then
81 | scripts/config --disable CONFIG_GENERIC_CPU
82 | scripts/config --enable CONFIG_M586TSC
83 | elif [[ "$_microarchitecture" = "5" ]]; then
84 | scripts/config --disable CONFIG_GENERIC_CPU
85 | scripts/config --enable CONFIG_M586MMX
86 | elif [[ "$_microarchitecture" = "6" ]]; then
87 | scripts/config --disable CONFIG_GENERIC_CPU
88 | scripts/config --enable CONFIG_M686
89 | elif [[ "$_microarchitecture" = "7" ]]; then
90 | scripts/config --disable CONFIG_GENERIC_CPU
91 | scripts/config --enable CONFIG_MPENTIUMII
92 | elif [[ "$_microarchitecture" = "8" ]]; then
93 | scripts/config --disable CONFIG_GENERIC_CPU
94 | scripts/config --enable CONFIG_MPENTIUMIII
95 | elif [[ "$_microarchitecture" = "9" ]]; then
96 | scripts/config --disable CONFIG_GENERIC_CPU
97 | scripts/config --enable CONFIG_MPENTIUMM
98 | elif [[ "$_microarchitecture" = "10" ]]; then
99 | scripts/config --disable CONFIG_GENERIC_CPU
100 | scripts/config --enable CONFIG_MPENTIUM4
101 | elif [[ "$_microarchitecture" = "11" ]]; then
102 | scripts/config --disable CONFIG_GENERIC_CPU
103 | scripts/config --enable CONFIG_MK6
104 | elif [[ "$_microarchitecture" = "12" ]]; then
105 | scripts/config --disable CONFIG_GENERIC_CPU
106 | scripts/config --enable CONFIG_MK7
107 | elif [[ "$_microarchitecture" = "13" ]]; then
108 | scripts/config --disable CONFIG_GENERIC_CPU
109 | scripts/config --enable CONFIG_MK8
110 | elif [[ "$_microarchitecture" = "14" ]]; then
111 | scripts/config --disable CONFIG_GENERIC_CPU
112 | scripts/config --enable CONFIG_MK8SSE3
113 | elif [[ "$_microarchitecture" = "15" ]]; then
114 | scripts/config --disable CONFIG_GENERIC_CPU
115 | scripts/config --enable CONFIG_MK10
116 | elif [[ "$_microarchitecture" = "16" ]]; then
117 | scripts/config --disable CONFIG_GENERIC_CPU
118 | scripts/config --enable CONFIG_MBARCELONA
119 | elif [[ "$_microarchitecture" = "17" ]]; then
120 | scripts/config --disable CONFIG_GENERIC_CPU
121 | scripts/config --enable CONFIG_MBOBCAT
122 | elif [[ "$_microarchitecture" = "18" ]]; then
123 | scripts/config --disable CONFIG_GENERIC_CPU
124 | scripts/config --enable CONFIG_MJAGUAR
125 | elif [[ "$_microarchitecture" = "19" ]]; then
126 | scripts/config --disable CONFIG_GENERIC_CPU
127 | scripts/config --enable CONFIG_MBULLDOZER
128 | elif [[ "$_microarchitecture" = "20" ]]; then
129 | scripts/config --disable CONFIG_GENERIC_CPU
130 | scripts/config --enable CONFIG_MPILEDRIVER
131 | elif [[ "$_microarchitecture" = "21" ]]; then
132 | scripts/config --disable CONFIG_GENERIC_CPU
133 | scripts/config --enable CONFIG_MSTEAMROLLER
134 | elif [[ "$_microarchitecture" = "22" ]]; then
135 | scripts/config --disable CONFIG_GENERIC_CPU
136 | scripts/config --enable CONFIG_MEXCAVATOR
137 | elif [[ "$_microarchitecture" = "23" ]]; then
138 | scripts/config --disable CONFIG_GENERIC_CPU
139 | scripts/config --enable CONFIG_MZEN
140 | elif [[ "$_microarchitecture" = "24" ]]; then
141 | scripts/config --disable CONFIG_GENERIC_CPU
142 | scripts/config --enable CONFIG_MZEN2
143 | elif [[ "$_microarchitecture" = "25" ]]; then
144 | scripts/config --disable CONFIG_GENERIC_CPU
145 | scripts/config --enable CONFIG_MZEN3
146 | elif [[ "$_microarchitecture" = "26" ]]; then
147 | scripts/config --disable CONFIG_GENERIC_CPU
148 | scripts/config --enable CONFIG_MCRUSOE
149 | elif [[ "$_microarchitecture" = "27" ]]; then
150 | scripts/config --disable CONFIG_GENERIC_CPU
151 | scripts/config --enable CONFIG_MEFFICEON
152 | elif [[ "$_microarchitecture" = "28" ]]; then
153 | scripts/config --disable CONFIG_GENERIC_CPU
154 | scripts/config --enable CONFIG_MWINCHIPC6
155 | elif [[ "$_microarchitecture" = "29" ]]; then
156 | scripts/config --disable CONFIG_GENERIC_CPU
157 | scripts/config --enable CONFIG_MWINCHIP3D
158 | elif [[ "$_microarchitecture" = "30" ]]; then
159 | scripts/config --disable CONFIG_GENERIC_CPU
160 | scripts/config --enable CONFIG_MELAN
161 | elif [[ "$_microarchitecture" = "31" ]]; then
162 | scripts/config --disable CONFIG_GENERIC_CPU
163 | scripts/config --enable CONFIG_MGEODEGX1
164 | elif [[ "$_microarchitecture" = "32" ]]; then
165 | scripts/config --disable CONFIG_GENERIC_CPU
166 | scripts/config --enable CONFIG_MGEODE_LX
167 | elif [[ "$_microarchitecture" = "33" ]]; then
168 | scripts/config --disable CONFIG_GENERIC_CPU
169 | scripts/config --enable CONFIG_MCYRIXIII
170 | elif [[ "$_microarchitecture" = "34" ]]; then
171 | scripts/config --disable CONFIG_GENERIC_CPU
172 | scripts/config --enable CONFIG_MVIAC3_2
173 | elif [[ "$_microarchitecture" = "35" ]]; then
174 | scripts/config --disable CONFIG_GENERIC_CPU
175 | scripts/config --enable CONFIG_MVIAC7
176 | elif [[ "$_microarchitecture" = "36" ]]; then
177 | scripts/config --disable CONFIG_GENERIC_CPU
178 | scripts/config --enable CONFIG_MPSC
179 | elif [[ "$_microarchitecture" = "37" ]]; then
180 | scripts/config --disable CONFIG_GENERIC_CPU
181 | scripts/config --enable CONFIG_MATOM
182 | elif [[ "$_microarchitecture" = "38" ]]; then
183 | scripts/config --disable CONFIG_GENERIC_CPU
184 | scripts/config --enable CONFIG_MCORE2
185 | elif [[ "$_microarchitecture" = "39" ]]; then
186 | scripts/config --disable CONFIG_GENERIC_CPU
187 | scripts/config --enable CONFIG_MNEHALEM
188 | elif [[ "$_microarchitecture" = "40" ]]; then
189 | scripts/config --disable CONFIG_GENERIC_CPU
190 | scripts/config --enable CONFIG_MWESTMERE
191 | elif [[ "$_microarchitecture" = "41" ]]; then
192 | scripts/config --disable CONFIG_GENERIC_CPU
193 | scripts/config --enable CONFIG_MSILVERMONT
194 | elif [[ "$_microarchitecture" = "42" ]]; then
195 | scripts/config --disable CONFIG_GENERIC_CPU
196 | scripts/config --enable CONFIG_MGOLDMONT
197 | elif [[ "$_microarchitecture" = "43" ]]; then
198 | scripts/config --disable CONFIG_GENERIC_CPU
199 | scripts/config --enable CONFIG_MGOLDMONTPLUS
200 | elif [[ "$_microarchitecture" = "44" ]]; then
201 | scripts/config --disable CONFIG_GENERIC_CPU
202 | scripts/config --enable CONFIG_MSANDYBRIDGE
203 | elif [[ "$_microarchitecture" = "45" ]]; then
204 | scripts/config --disable CONFIG_GENERIC_CPU
205 | scripts/config --enable CONFIG_MIVYBRIDGE
206 | elif [[ "$_microarchitecture" = "46" ]]; then
207 | scripts/config --disable CONFIG_GENERIC_CPU
208 | scripts/config --enable CONFIG_MHASWELL
209 | elif [[ "$_microarchitecture" = "47" ]]; then
210 | scripts/config --disable CONFIG_GENERIC_CPU
211 | scripts/config --enable CONFIG_MBROADWELL
212 | elif [[ "$_microarchitecture" = "48" ]]; then
213 | scripts/config --disable CONFIG_GENERIC_CPU
214 | scripts/config --enable CONFIG_MSKYLAKE
215 | elif [[ "$_microarchitecture" = "49" ]]; then
216 | scripts/config --disable CONFIG_GENERIC_CPU
217 | scripts/config --enable CONFIG_MSKYLAKEX
218 | elif [[ "$_microarchitecture" = "50" ]]; then
219 | scripts/config --disable CONFIG_GENERIC_CPU
220 | scripts/config --enable CONFIG_MCANNONLAKE
221 | elif [[ "$_microarchitecture" = "51" ]]; then
222 | scripts/config --disable CONFIG_GENERIC_CPU
223 | scripts/config --enable CONFIG_MICELAKE
224 | elif [[ "$_microarchitecture" = "52" ]]; then
225 | scripts/config --disable CONFIG_GENERIC_CPU
226 | scripts/config --enable CONFIG_MCASCADELAKE
227 | elif [[ "$_microarchitecture" = "53" ]]; then
228 | scripts/config --disable CONFIG_GENERIC_CPU
229 | scripts/config --enable CONFIG_MCOOPERLAKE
230 | elif [[ "$_microarchitecture" = "54" ]]; then
231 | scripts/config --disable CONFIG_GENERIC_CPU
232 | scripts/config --enable CONFIG_MTIGERLAKE
233 | elif [[ "$_microarchitecture" = "55" ]]; then
234 | scripts/config --disable CONFIG_GENERIC_CPU
235 | scripts/config --enable CONFIG_MSAPPHIRERAPIDS
236 | elif [[ "$_microarchitecture" = "56" ]]; then
237 | scripts/config --disable CONFIG_GENERIC_CPU
238 | scripts/config --enable CONFIG_MALDERLAKE
239 | elif [[ "$_microarchitecture" = "57" ]]; then
240 | scripts/config --enable CONFIG_GENERIC_CPU
241 | elif [[ "$_microarchitecture" = "58" ]]; then
242 | scripts/config --disable CONFIG_GENERIC_CPU
243 | scripts/config --enable CONFIG_GENERIC_CPU2
244 | elif [[ "$_microarchitecture" = "59" ]]; then
245 | scripts/config --disable CONFIG_GENERIC_CPU
246 | scripts/config --enable CONFIG_GENERIC_CPU3
247 | elif [[ "$_microarchitecture" = "60" ]]; then
248 | scripts/config --disable CONFIG_GENERIC_CPU
249 | scripts/config --enable CONFIG_GENERIC_CPU4
250 | elif [[ "$_microarchitecture" = "61" ]]; then
251 | scripts/config --disable CONFIG_GENERIC_CPU
252 | scripts/config --enable CONFIG_MNATIVE_INTEL
253 | elif [[ "$_microarchitecture" = "62" ]]; then
254 | scripts/config --disable CONFIG_GENERIC_CPU
255 | scripts/config --enable CONFIG_MNATIVE_AMD
256 | else
257 | scripts/config --enable CONFIG_GENERIC_CPU
258 | fi
259 |
260 | plain ""
261 |
262 | sleep 2
263 | }
264 |
--------------------------------------------------------------------------------
/linux-cacule-rdb/.SRCINFO:
--------------------------------------------------------------------------------
1 | pkgbase = linux-cacule-rdb
2 | pkgdesc = Linux cacULE-RDB scheduler Kernel by CachyOS with other patches and improvements
3 | pkgver = 6.1.9
4 | pkgrel = 2
5 | url = https://github.com/CachyOS/linux-cachyos
6 | arch = x86_64
7 | arch = x86_64_v3
8 | license = GPL2
9 | makedepends = bc
10 | makedepends = libelf
11 | makedepends = pahole
12 | makedepends = cpio
13 | makedepends = perl
14 | makedepends = tar
15 | makedepends = xz
16 | makedepends = zstd
17 | makedepends = gcc
18 | makedepends = gcc-libs
19 | makedepends = glibc
20 | makedepends = binutils
21 | makedepends = make
22 | makedepends = patch
23 | options = !strip
24 | source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.9.tar.xz
25 | source = config
26 | source = auto-cpu-optimization.sh
27 | source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.1/all/0001-cachyos-base-all.patch
28 | source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.1/sched/0001-cacULE-cachy.patch
29 | sha256sums = d60cf185693c386e7acd9f3eb3a94ae30ffbfee0a9447a20e83711e0bdf5922b
30 | sha256sums = fab53ac59d4da6fb0433f6fd15877871f4124a89021237f90835d1ff3755ba9c
31 | sha256sums = 41c34759ed248175e905c57a25e2b0ed09b11d054fe1a8783d37459f34984106
32 | sha256sums = 3c31aea899ab3ba5d4119fc08935b31f66b2d4da65b6adfbfd3b410114c25753
33 | sha256sums = 48afb08df95035b315bb882c03d7b66d320bccf54977822050a5c3cd7acd2709
34 |
35 | pkgname = linux-cacule-rdb
36 | pkgdesc = The Linux cacULE-RDB scheduler Kernel by CachyOS with other patches and improvements kernel and modules
37 | depends = coreutils
38 | depends = kmod
39 | depends = initramfs
40 | optdepends = wireless-regdb: to set the correct wireless channels of your country
41 | optdepends = linux-firmware: firmware images needed for some devices
42 | optdepends = modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig
43 | optdepends = uksmd: Userspace KSM helper daemon
44 | provides = VIRTUALBOX-GUEST-MODULES
45 | provides = WIREGUARD-MODULE
46 | provides = KSMBD-MODULE
47 | provides = UKSMD-BUILTIN
48 |
49 | pkgname = linux-cacule-rdb-headers
50 | pkgdesc = Headers and scripts for building modules for the Linux cacULE-RDB scheduler Kernel by CachyOS with other patches and improvements kernel
51 | depends = pahole
52 | depends = linux-cacule-rdb
53 |
--------------------------------------------------------------------------------
/linux-cacule-rdb/auto-cpu-optimization.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Check if GCC is installed
4 | check_gcc() {
5 | if ! [ -x "$(command -v gcc)" ]; then
6 | # Display error message if GCC is not installed
7 | echo "Error: GCC is not installed. Please install GCC and try again." >&2
8 | exit 1
9 | fi
10 | }
11 |
12 | # Call the function before running the rest of the script
13 | check_gcc
14 |
15 | # Get CPU type from GCC and convert to uppercase
16 | MARCH=$(gcc -Q -march=native --help=target|grep -m1 march=|awk '{print toupper($2)}')
17 |
18 | # Check for specific CPU types and set MARCH variable accordingly
19 | case $MARCH in
20 | ZNVER1) MARCH="ZEN";;
21 | ZNVER2) MARCH="ZEN2";;
22 | ZNVER3) MARCH="ZEN3";;
23 | ZNVER4) MARCH="ZEN4";;
24 | BDVER1) MARCH="BULLDOZER";;
25 | BDVER2) MARCH="PILEDRIVER";;
26 | BDVER3) MARCH="STEAMROLLER";;
27 | BDVER4) MARCH="EXCAVATOR";;
28 | BTVER1) MARCH="BOBCAT";;
29 | BTVER2) MARCH="JAGUAR";;
30 | AMDFAM10) MARCH="MK10";;
31 | K8-SSE3) MARCH="K8SSE3";;
32 | BONNELL) MARCH="ATOM";;
33 | GOLDMONT-PLUS) MARCH="GOLDMONTPLUS";;
34 | SKYLAKE-AVX512) MARCH="SKYLAKE2";;
35 | MIVYBRIDGE)
36 | scripts/config --disable CONFIG_AGP_AMD64
37 | scripts/config --disable CONFIG_MICROCODE_AMD
38 | MARCH="MIVYBRIDGE";;
39 | ICELAKE-CLIENT) MARCH="ICELAKE";;
40 | esac
41 |
42 | # Add "M" prefix to MARCH variable
43 | MARCH2=M${MARCH}
44 |
45 | # Display detected CPU and apply optimization
46 | echo "----------------------------------"
47 | echo "| APPLYING AUTO-CPU-OPTIMIZATION |"
48 | echo "----------------------------------"
49 | echo "[*] DETECTED CPU (MARCH) : ${MARCH2}"
50 | scripts/config -k --disable CONFIG_GENERIC_CPU
51 | scripts/config -k --enable CONFIG_${MARCH2}
52 |
--------------------------------------------------------------------------------
/linux-cacule-rdb/configure:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | cpu_arch() {
4 | plain ""
5 | plain "#########################################"
6 | plain "Set cpu microarchitecture optimization in GCC"
7 | read -rp "`echo $' > 1) M486SX : Select this for an 486-class CPU without an FPU such as AMD/Cyrix/IBM/Intel SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5S.\n \
8 | > 2) M486 : Select this for an 486-class CPU such as AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 and UMC U5D.\n \
9 | > 3) M586 : Select this for an 586 or 686 series processor such as the AMD K5,the Cyrix 5x86, 6x86 and 6x86MX. This choice does not assume the RDTSC (Read Time Stamp Counter) instruction.\n \
10 | > 4) M586TSC : Select this for a Pentium Classic processor with the RDTSC (Read Time Stamp Counter) instruction for benchmarking.\n \
11 | > 5) M586MMX : Select this for a Pentium with the MMX graphics/multimedia extended instructions.\n \
12 | > 6) M686 : Select this for Intel Pentium Pro chips.\n \
13 | > 7) MPENTIUMII : Select this for Intel chips based on the Pentium-II and pre-Coppermine Celeron core.\n \
14 | > 8) MPENTIUMIII : Select this for Intel chips based on the Pentium-III and Celeron-Coppermine core.\n \
15 | > 9) MPENTIUMM : Select this for Intel Pentium M (not Pentium-4 M) notebook chips.\n \
16 | > 10) MPENTIUM4 : Select this for Intel Pentium 4 chips.\n \
17 | > 11) MK6 : Select this for an AMD K6-family processor.\n \
18 | > 12) MK7 : Select this for an AMD Athlon K7-family processor.\n \
19 | > 13) MK8 : Select this for an AMD Opteron or Athlon64 Hammer-family processor.\n \
20 | > 14) MK8SSE3 : Select this for improved AMD Opteron or Athlon64 Hammer-family processors.\n \
21 | > 15) MK10 : Select this for an AMD 61xx Eight-Core Magny-Cours, Athlon X2 7x50,Phenom X3/X4/II, Athlon II X2/X3/X4, or Turion II-family processor.\n \
22 | > 16) MBARCELONA : Select this for AMD Family 10h Barcelona processors.\n \
23 | > 17) MBOBCAT : Select this for AMD Family 14h Bobcat processors.\n \
24 | > 18) MJAGUAR : Select this for AMD Family 16h Jaguar processors.\n \
25 | > 19) MBULLDOZER : Select this for AMD Family 15h Bulldozer processors.\n \
26 | > 20) MPILEDRIVER : Select this for AMD Family 15h Piledriver processors.\n \
27 | > 21) MSTEAMROLLER : Select this for AMD Family 15h Steamroller processors.\n \
28 | > 22) MEXCAVATOR : Select this for AMD Family 15h Excavator processors.\n \
29 | > 23) MZEN : Select this for AMD Family 17h Zen processors.\n \
30 | > 24) MZEN2 : Select this for AMD Family 17h Zen 2 processors.\n \
31 | > 25) MZEN3 : Select this for AMD Family 19h Zen 3 processors. - GCC 10.3 required\n \
32 | > 26) MZEN4 : Select this for AMD Family 19h Zen 4 processors. - GCC 13.1 required\n \
33 | > 27) MCRUSOE : Select this for a Transmeta Crusoe processor.\n \
34 | > 28) MEFFICEON : Select this for a Transmeta Efficeon processor.\n \
35 | > 29) MWINCHIPC6 : Select this for an IDT Winchip C6 chip.\n \
36 | > 30) MWINCHIP3D : Select this for an IDT Winchip-2, 2A or 3.\n \
37 | > 31) MELAN : Select this for an AMD Elan processor.\n \
38 | > 32) MGEODEGX1 : Select this for a Geode GX1 (Cyrix MediaGX) chip.\n \
39 | > 33) MGEODE_LX Select this for AMD Geode GX and LX processors.\n \
40 | > 34) MCYRIXIII : Select this for a Cyrix III or C3 chip.\n \
41 | > 35) MVIAC3_2 : Select this for a VIA C3 "Nehemiah".\n \
42 | > 36) MVIAC7 : Select this for a VIA C7.\n \
43 | > 37) MPSC : Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey Xeon CPUs with Intel 64bit which is compatible with x86-64.\n \
44 | > 38) MATOM : Select this for the Intel Atom platform.\n \
45 | > 39) MCORE2 : Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx) CPUs.\n \
46 | > 40) MNEHALEM : Select this for 1st Gen Core processors in the Nehalem family.\n \
47 | > 41) MWESTMERE : Select this for the Intel Westmere formerly Nehalem-C family.\n \
48 | > 42) MSILVERMONT Select this for the Intel Silvermont platform.\n \
49 | > 43) MGOLDMONT : Select this for the Intel Goldmont platform including Apollo Lake and Denverton.\n \
50 | > 44) MGOLDMONTPLUS : Select this for the Intel Goldmont Plus platform including Gemini Lake.\n \
51 | > 45) MSANDYBRIDGE : Select this for 2nd Gen Core processors in the Sandy Bridge family.\n \
52 | > 46) MIVYBRIDGE : Select this for 3rd Gen Core processors in the Ivy Bridge family.\n \
53 | > 47) MHASWELL : Select this for 4th Gen Core processors in the Haswell family.\n \
54 | > 48) MBROADWELL : Select this for 5th Gen Core processors in the Broadwell family.\n \
55 | > 49) MSKYLAKE : Select this for 6th Gen Core processors in the Skylake family.\n \
56 | > 50) MSKYLAKEX : Select this for 6th Gen Core processors in the Skylake X family.\n \
57 | > 51) MCANNONLAKE : Select this for 8th Gen Core processors.\n \
58 | > 52) MICELAKE : Select this for 10th Gen Core processors in the Ice Lake family.\n \
59 | > 53) MCASCADELAKE : Select this for Xeon processors in the Cascade Lake family.\n \
60 | > 54) MCOOPERLAKE : Select this for Xeon processors in the Cooper Lake family. - GCC 10.1 required\n \
61 | > 55) MTIGERLAKE : Select this for third-generation 10 nm process processors in the Tiger Lake family. - GCC 10.1 required\n \
62 | > 56) MSAPPHIRERAPIDS : Select this for third-generation 10 nm process processors in the Sapphire Rapids family. - GCC 11 required\n \
63 | > 57) MALDERLAKE : Select this for twelfth-generation processors in the Alder Lake family.- GCC 11 required\n \
64 | > 58) MRAPTORLAKE : Select this for thirteenth-generation processors in the Raptor Lake family.- GCC 13 required\n \
65 | > 59) MMETORLAKE : Select this for fourteenth-generation processors in the Meteor Lake family.- GCC 13 required\n \
66 | > 60) GENERIC_CPU : Generic x86-64 CPU. Run equally well on all x86-64 CPUs.\n \
67 | > 61) GENERIC_CPU2 : Run equally well on all x86-64 CPUs with min support of x86-64-v2. - GCC 11 required\n \
68 | > 62) GENERIC_CPU3 : Generic x86-64-v3 CPU with v3 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v3. - GCC 11 required\n \
69 | > 63) GENERIC_CPU4 : Generic x86-64 CPU with v4 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v4. - GCC 11 required\n \
70 | > 64) MNATIVE_INTEL : Intel-Native optimizations autodetected by GCC.\n \
71 | > 65) MNATIVE_AMD : AMD-Native optimizations autodetected by GCC.\n \
72 | > Default (60 : Gneric CPU)\nchoice[0-65]: '`" _microarchitecture
73 |
74 | if [[ "$_microarchitecture" = "1" ]]; then
75 | scripts/config --disable CONFIG_GENERIC_CPU
76 | scripts/config --enable CONFIG_M486
77 | elif [[ "$_microarchitecture" = "2" ]]; then
78 | scripts/config --disable CONFIG_GENERIC_CPU
79 | scripts/config --enable CONFIG_M486
80 | elif [[ "$_microarchitecture" = "3" ]]; then
81 | scripts/config --disable CONFIG_GENERIC_CPU
82 | scripts/config --enable CONFIG_M586
83 | elif [[ "$_microarchitecture" = "4" ]]; then
84 | scripts/config --disable CONFIG_GENERIC_CPU
85 | scripts/config --enable CONFIG_M586TSC
86 | elif [[ "$_microarchitecture" = "5" ]]; then
87 | scripts/config --disable CONFIG_GENERIC_CPU
88 | scripts/config --enable CONFIG_M586MMX
89 | elif [[ "$_microarchitecture" = "6" ]]; then
90 | scripts/config --disable CONFIG_GENERIC_CPU
91 | scripts/config --enable CONFIG_M686
92 | elif [[ "$_microarchitecture" = "7" ]]; then
93 | scripts/config --disable CONFIG_GENERIC_CPU
94 | scripts/config --enable CONFIG_MPENTIUMII
95 | elif [[ "$_microarchitecture" = "8" ]]; then
96 | scripts/config --disable CONFIG_GENERIC_CPU
97 | scripts/config --enable CONFIG_MPENTIUMIII
98 | elif [[ "$_microarchitecture" = "9" ]]; then
99 | scripts/config --disable CONFIG_GENERIC_CPU
100 | scripts/config --enable CONFIG_MPENTIUMM
101 | elif [[ "$_microarchitecture" = "10" ]]; then
102 | scripts/config --disable CONFIG_GENERIC_CPU
103 | scripts/config --enable CONFIG_MPENTIUM4
104 | elif [[ "$_microarchitecture" = "11" ]]; then
105 | scripts/config --disable CONFIG_GENERIC_CPU
106 | scripts/config --enable CONFIG_MK6
107 | elif [[ "$_microarchitecture" = "12" ]]; then
108 | scripts/config --disable CONFIG_GENERIC_CPU
109 | scripts/config --enable CONFIG_MK7
110 | elif [[ "$_microarchitecture" = "13" ]]; then
111 | scripts/config --disable CONFIG_GENERIC_CPU
112 | scripts/config --enable CONFIG_MK8
113 | elif [[ "$_microarchitecture" = "14" ]]; then
114 | scripts/config --disable CONFIG_GENERIC_CPU
115 | scripts/config --enable CONFIG_MK8SSE3
116 | elif [[ "$_microarchitecture" = "15" ]]; then
117 | scripts/config --disable CONFIG_GENERIC_CPU
118 | scripts/config --enable CONFIG_MK10
119 | elif [[ "$_microarchitecture" = "16" ]]; then
120 | scripts/config --disable CONFIG_GENERIC_CPU
121 | scripts/config --enable CONFIG_MBARCELONA
122 | elif [[ "$_microarchitecture" = "17" ]]; then
123 | scripts/config --disable CONFIG_GENERIC_CPU
124 | scripts/config --enable CONFIG_MBOBCAT
125 | elif [[ "$_microarchitecture" = "18" ]]; then
126 | scripts/config --disable CONFIG_GENERIC_CPU
127 | scripts/config --enable CONFIG_MJAGUAR
128 | elif [[ "$_microarchitecture" = "19" ]]; then
129 | scripts/config --disable CONFIG_GENERIC_CPU
130 | scripts/config --enable CONFIG_MBULLDOZER
131 | elif [[ "$_microarchitecture" = "20" ]]; then
132 | scripts/config --disable CONFIG_GENERIC_CPU
133 | scripts/config --enable CONFIG_MPILEDRIVER
134 | elif [[ "$_microarchitecture" = "21" ]]; then
135 | scripts/config --disable CONFIG_GENERIC_CPU
136 | scripts/config --enable CONFIG_MSTEAMROLLER
137 | elif [[ "$_microarchitecture" = "22" ]]; then
138 | scripts/config --disable CONFIG_GENERIC_CPU
139 | scripts/config --enable CONFIG_MEXCAVATOR
140 | elif [[ "$_microarchitecture" = "23" ]]; then
141 | scripts/config --disable CONFIG_GENERIC_CPU
142 | scripts/config --enable CONFIG_MZEN
143 | elif [[ "$_microarchitecture" = "24" ]]; then
144 | scripts/config --disable CONFIG_GENERIC_CPU
145 | scripts/config --enable CONFIG_MZEN2
146 | elif [[ "$_microarchitecture" = "25" ]]; then
147 | scripts/config --disable CONFIG_GENERIC_CPU
148 | scripts/config --enable CONFIG_MZEN3
149 | elif [[ "$_microarchitecture" = "26" ]]; then
150 | scripts/config --disable CONFIG_GENERIC_CPU
151 | scripts/config --enable CONFIG_MZEN4
152 | elif [[ "$_microarchitecture" = "27" ]]; then
153 | scripts/config --disable CONFIG_GENERIC_CPU
154 | scripts/config --enable CONFIG_MCRUSOE
155 | elif [[ "$_microarchitecture" = "28" ]]; then
156 | scripts/config --disable CONFIG_GENERIC_CPU
157 | scripts/config --enable CONFIG_MEFFICEON
158 | elif [[ "$_microarchitecture" = "29" ]]; then
159 | scripts/config --disable CONFIG_GENERIC_CPU
160 | scripts/config --enable CONFIG_MWINCHIPC6
161 | elif [[ "$_microarchitecture" = "30" ]]; then
162 | scripts/config --disable CONFIG_GENERIC_CPU
163 | scripts/config --enable CONFIG_MWINCHIP3D
164 | elif [[ "$_microarchitecture" = "31" ]]; then
165 | scripts/config --disable CONFIG_GENERIC_CPU
166 | scripts/config --enable CONFIG_MELAN
167 | elif [[ "$_microarchitecture" = "32" ]]; then
168 | scripts/config --disable CONFIG_GENERIC_CPU
169 | scripts/config --enable CONFIG_MGEODEGX1
170 | elif [[ "$_microarchitecture" = "33" ]]; then
171 | scripts/config --disable CONFIG_GENERIC_CPU
172 | scripts/config --enable CONFIG_MGEODE_LX
173 | elif [[ "$_microarchitecture" = "34" ]]; then
174 | scripts/config --disable CONFIG_GENERIC_CPU
175 | scripts/config --enable CONFIG_MCYRIXIII
176 | elif [[ "$_microarchitecture" = "35" ]]; then
177 | scripts/config --disable CONFIG_GENERIC_CPU
178 | scripts/config --enable CONFIG_MVIAC3_2
179 | elif [[ "$_microarchitecture" = "36" ]]; then
180 | scripts/config --disable CONFIG_GENERIC_CPU
181 | scripts/config --enable CONFIG_MVIAC7
182 | elif [[ "$_microarchitecture" = "37" ]]; then
183 | scripts/config --disable CONFIG_GENERIC_CPU
184 | scripts/config --enable CONFIG_MPSC
185 | elif [[ "$_microarchitecture" = "38" ]]; then
186 | scripts/config --disable CONFIG_GENERIC_CPU
187 | scripts/config --enable CONFIG_MATOM
188 | elif [[ "$_microarchitecture" = "39" ]]; then
189 | scripts/config --disable CONFIG_GENERIC_CPU
190 | scripts/config --enable CONFIG_MCORE2
191 | elif [[ "$_microarchitecture" = "40" ]]; then
192 | scripts/config --disable CONFIG_GENERIC_CPU
193 | scripts/config --enable CONFIG_MNEHALEM
194 | elif [[ "$_microarchitecture" = "41" ]]; then
195 | scripts/config --disable CONFIG_GENERIC_CPU
196 | scripts/config --enable CONFIG_MWESTMERE
197 | elif [[ "$_microarchitecture" = "42" ]]; then
198 | scripts/config --disable CONFIG_GENERIC_CPU
199 | scripts/config --enable CONFIG_MSILVERMONT
200 | elif [[ "$_microarchitecture" = "43" ]]; then
201 | scripts/config --disable CONFIG_GENERIC_CPU
202 | scripts/config --enable CONFIG_MGOLDMONT
203 | elif [[ "$_microarchitecture" = "44" ]]; then
204 | scripts/config --disable CONFIG_GENERIC_CPU
205 | scripts/config --enable CONFIG_MGOLDMONTPLUS
206 | elif [[ "$_microarchitecture" = "45" ]]; then
207 | scripts/config --disable CONFIG_GENERIC_CPU
208 | scripts/config --enable CONFIG_MSANDYBRIDGE
209 | elif [[ "$_microarchitecture" = "46" ]]; then
210 | scripts/config --disable CONFIG_GENERIC_CPU
211 | scripts/config --disable CONFIG_AGP_AMD64
212 | scripts/config --disable CONFIG_MICROCODE_AMD
213 | scripts/config --enable CONFIG_MIVYBRIDGE
214 | elif [[ "$_microarchitecture" = "47" ]]; then
215 | scripts/config --disable CONFIG_GENERIC_CPU
216 | scripts/config --enable CONFIG_MHASWELL
217 | elif [[ "$_microarchitecture" = "48" ]]; then
218 | scripts/config --disable CONFIG_GENERIC_CPU
219 | scripts/config --enable CONFIG_MBROADWELL
220 | elif [[ "$_microarchitecture" = "49" ]]; then
221 | scripts/config --disable CONFIG_GENERIC_CPU
222 | scripts/config --enable CONFIG_MSKYLAKE
223 | elif [[ "$_microarchitecture" = "50" ]]; then
224 | scripts/config --disable CONFIG_GENERIC_CPU
225 | scripts/config --enable CONFIG_MSKYLAKEX
226 | elif [[ "$_microarchitecture" = "51" ]]; then
227 | scripts/config --disable CONFIG_GENERIC_CPU
228 | scripts/config --enable CONFIG_MCANNONLAKE
229 | elif [[ "$_microarchitecture" = "52" ]]; then
230 | scripts/config --disable CONFIG_GENERIC_CPU
231 | scripts/config --enable CONFIG_MICELAKE
232 | elif [[ "$_microarchitecture" = "53" ]]; then
233 | scripts/config --disable CONFIG_GENERIC_CPU
234 | scripts/config --enable CONFIG_MCASCADELAKE
235 | elif [[ "$_microarchitecture" = "54" ]]; then
236 | scripts/config --disable CONFIG_GENERIC_CPU
237 | scripts/config --enable CONFIG_MCOOPERLAKE
238 | elif [[ "$_microarchitecture" = "55" ]]; then
239 | scripts/config --disable CONFIG_GENERIC_CPU
240 | scripts/config --enable CONFIG_MTIGERLAKE
241 | elif [[ "$_microarchitecture" = "56" ]]; then
242 | scripts/config --disable CONFIG_GENERIC_CPU
243 | scripts/config --enable CONFIG_MSAPPHIRERAPIDS
244 | elif [[ "$_microarchitecture" = "57" ]]; then
245 | scripts/config --disable CONFIG_GENERIC_CPU
246 | scripts/config --enable CONFIG_MALDERLAKE
247 | elif [[ "$_microarchitecture" = "58" ]]; then
248 | scripts/config --disable CONFIG_GENERIC_CPU
249 | scripts/config --enable CONFIG_MRAPTORLAKE
250 | elif [[ "$_microarchitecture" = "59" ]]; then
251 | scripts/config --disable CONFIG_GENERIC_CPU
252 | scripts/config --enable CONFIG_MMETORLAKE
253 | elif [[ "$_microarchitecture" = "60" ]]; then
254 | scripts/config --enable CONFIG_GENERIC_CPU
255 | elif [[ "$_microarchitecture" = "61" ]]; then
256 | scripts/config --disable CONFIG_GENERIC_CPU
257 | scripts/config --enable CONFIG_GENERIC_CPU2
258 | elif [[ "$_microarchitecture" = "62" ]]; then
259 | scripts/config --disable CONFIG_GENERIC_CPU
260 | scripts/config --enable CONFIG_GENERIC_CPU3
261 | elif [[ "$_microarchitecture" = "63" ]]; then
262 | scripts/config --disable CONFIG_GENERIC_CPU
263 | scripts/config --enable CONFIG_GENERIC_CPU4
264 | elif [[ "$_microarchitecture" = "64" ]]; then
265 | scripts/config --disable CONFIG_GENERIC_CPU
266 | scripts/config --enable CONFIG_MNATIVE_INTEL
267 | elif [[ "$_microarchitecture" = "65" ]]; then
268 | scripts/config --disable CONFIG_GENERIC_CPU
269 | scripts/config --enable CONFIG_MNATIVE_AMD
270 | else
271 | scripts/config --enable CONFIG_GENERIC_CPU
272 | fi
273 |
274 | plain ""
275 |
276 | sleep 2
277 | }
278 |
--------------------------------------------------------------------------------
/linux-cacule/.SRCINFO:
--------------------------------------------------------------------------------
1 | pkgbase = linux-cacule
2 | pkgdesc = Linux cacULE scheduler Kernel by CachyOS with other patches and improvements
3 | pkgver = 6.1.9
4 | pkgrel = 2
5 | url = https://github.com/CachyOS/linux-cachyos
6 | arch = x86_64
7 | arch = x86_64_v3
8 | license = GPL2
9 | makedepends = bc
10 | makedepends = libelf
11 | makedepends = pahole
12 | makedepends = cpio
13 | makedepends = perl
14 | makedepends = tar
15 | makedepends = xz
16 | makedepends = zstd
17 | makedepends = gcc
18 | makedepends = gcc-libs
19 | makedepends = glibc
20 | makedepends = binutils
21 | makedepends = make
22 | makedepends = patch
23 | options = !strip
24 | source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.9.tar.xz
25 | source = config
26 | source = auto-cpu-optimization.sh
27 | source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.1/all/0001-cachyos-base-all.patch
28 | source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.1/sched/0001-cacULE-cachy.patch
29 | sha256sums = d60cf185693c386e7acd9f3eb3a94ae30ffbfee0a9447a20e83711e0bdf5922b
30 | sha256sums = fab53ac59d4da6fb0433f6fd15877871f4124a89021237f90835d1ff3755ba9c
31 | sha256sums = 41c34759ed248175e905c57a25e2b0ed09b11d054fe1a8783d37459f34984106
32 | sha256sums = 3c31aea899ab3ba5d4119fc08935b31f66b2d4da65b6adfbfd3b410114c25753
33 | sha256sums = 48afb08df95035b315bb882c03d7b66d320bccf54977822050a5c3cd7acd2709
34 |
35 | pkgname = linux-cacule
36 | pkgdesc = The Linux cacULE scheduler Kernel by CachyOS with other patches and improvements kernel and modules
37 | depends = coreutils
38 | depends = kmod
39 | depends = initramfs
40 | optdepends = wireless-regdb: to set the correct wireless channels of your country
41 | optdepends = linux-firmware: firmware images needed for some devices
42 | optdepends = modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig
43 | optdepends = uksmd: Userspace KSM helper daemon
44 | provides = VIRTUALBOX-GUEST-MODULES
45 | provides = WIREGUARD-MODULE
46 | provides = KSMBD-MODULE
47 | provides = UKSMD-BUILTIN
48 |
49 | pkgname = linux-cacule-headers
50 | pkgdesc = Headers and scripts for building modules for the Linux cacULE scheduler Kernel by CachyOS with other patches and improvements kernel
51 | depends = pahole
52 | depends = linux-cacule
53 |
--------------------------------------------------------------------------------
/linux-cacule/PKGBUILD:
--------------------------------------------------------------------------------
1 | # Maintainer: Peter Jung ptr1337 && Piotr Gorski
2 | # Contributor: Jan Alexander Steffens (heftig)
3 | # Contributor: Tobias Powalowski
4 | # Contributor: Thomas Baechler
5 |
6 | ### Selecting CachyOS config
7 | # ATTENTION - one of two predefined values should be selected!
8 | # 'yes' - enable CachyOS config
9 | # 'no' - disable CachyOS config
10 | _cachy_config=${_cachy_config-'yes'}
11 |
12 | ### Selecting the CPU scheduler
13 | # ATTENTION - one of seven predefined values should be selected!
14 | # 'bmq' - select 'BitMap Queue CPU scheduler'
15 | # 'pds' - select 'Priority and Deadline based Skip list multiple queue CPU scheduler'
16 | # 'cacule' - select 'CacULE scheduler'
17 | # 'cacule-rdb' - select 'CacULE-RDB scheduler'
18 | # 'bore' - select 'Burst-Oriented Response Enhancer'
19 | # 'cfs' - select 'Completely Fair Scheduler'
20 | # 'tt' - select 'Task Type Scheduler by Hamad Marri'
21 | # 'bore-hardened' - select 'BORE Scheduler hardened' ## kernel with hardened config and hardening patches with the bore scheduler
22 | _cpusched=${_cpusched-'cacule'}
23 |
24 | ## Apply some suggested sysctl values from the bore developer
25 | ## These are adjusted to BORE
26 | _tune_bore=${_tune_bore-}
27 |
28 | ### BUILD OPTIONS
29 | # Set these variables to ANYTHING that is not null to enable them
30 |
31 | ### Tweak kernel options prior to a build via nconfig
32 | _makenconfig=${_makenconfig-}
33 |
34 | ### Tweak kernel options prior to a build via menuconfig
35 | _makemenuconfig=${_makemenuconfig-}
36 |
37 | ### Tweak kernel options prior to a build via xconfig
38 | _makexconfig=${_makexconfig-}
39 |
40 | ### Tweak kernel options prior to a build via gconfig
41 | _makegconfig=${_makegconfig-}
42 |
43 | # NUMA is optimized for multi-socket motherboards.
44 | # A single multi-core CPU actually runs slower with NUMA enabled.
45 | # See, https://bugs.archlinux.org/task/31187
46 | _NUMAdisable=${_NUMAdisable-}
47 |
48 | # Compile ONLY used modules to VASTLYreduce the number of modules built
49 | # and the build time.
50 | #
51 | # To keep track of which modules are needed for your specific system/hardware,
52 | # give module_db script a try: https://aur.archlinux.org/packages/modprobed-db
53 | # This PKGBUILD read the database kept if it exists
54 | #
55 | # More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db
56 | _localmodcfg=${_localmodcfg-}
57 |
58 | # Use the current kernel's .config file
59 | # Enabling this option will use the .config of the RUNNING kernel rather than
60 | # the ARCH defaults. Useful when the package gets updated and you already went
61 | # through the trouble of customizing your config options. NOT recommended when
62 | # a new kernel is released, but again, convenient for package bumps.
63 | _use_current=${_use_current-}
64 |
65 | ### Enable KBUILD_CFLAGS -O3
66 | _cc_harder=${_cc_harder-y}
67 |
68 | ### Set this to your number of threads you have in your machine otherwise it will default to 128
69 | _nr_cpus=${_nr_cpus-}
70 |
71 | ### Set performance governor as default
72 | _per_gov=${_per_gov-y}
73 |
74 | ### Enable TCP_CONG_BBR2
75 | _tcp_bbr2=${_tcp_bbr2-y}
76 |
77 | ### Running with a 1000HZ, 750Hz, 600 Hz, 500Hz, 300Hz, 250Hz and 100Hz tick rate
78 | _HZ_ticks=${_HZ_ticks-1000}
79 |
80 | ## Choose between perodic, idle or full
81 | ### Full tickless can give higher performances in various cases but, depending on hardware, lower consistency.
82 | _tickrate=${_tickrate-full}
83 |
84 | ## Choose between full(low-latency), voluntary or server
85 | _preempt=${_preempt-full}
86 |
87 | ### Disable MQ-Deadline I/O scheduler
88 | _mq_deadline_disable=${_mq_deadline_disable-y}
89 |
90 | ### Disable Kyber I/O scheduler
91 | _kyber_disable=${_kyber_disable-y}
92 |
93 | ### Enable multigenerational LRU
94 | # ATTENTION - one of three predefined values should be selected!
95 | # 'standard' - enable multigenerational LRU
96 | # 'stats' - enable multigenerational LRU with stats
97 | # 'none' - disable multigenerational LRU
98 | _lru_config=${_lru_config-'standard'}
99 |
100 | ### Enable per-VMA locking
101 | # ATTENTION - one of three predefined values should be selected!
102 | # 'standard' - enable per-VMA locking
103 | # 'stats' - enable per-VMA locking with stats
104 | # 'none' - disable per-VMA locking
105 | _vma_config=${_vma_config-'none'}
106 |
107 | ### Transparent Hugepages
108 | # ATTENTION - one of two predefined values should be selected!
109 | # 'always' - always enable THP
110 | # 'madvise' - madvise, prevent applications from allocating more memory resources than necessary
111 | # More infos here:
112 | # https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/performance_tuning_guide/sect-red_hat_enterprise_linux-performance_tuning_guide-configuring_transparent_huge_pages
113 | _hugepage=${_hugepage-'always'}
114 |
115 | ## Enable DAMON
116 | _damon=${_damon-}
117 |
118 | ## Enable Linux Random Number Generator
119 | _lrng_enable=${_lrng_enable-}
120 |
121 | # CPU compiler optimizations - Defaults to prompt at kernel config if left empty
122 | # AMD CPUs : "k8" "k8sse3" "k10" "barcelona" "bobcat" "jaguar" "bulldozer" "piledriver" "steamroller" "excavator" "zen" "zen2" "zen3"
123 | # Intel CPUs : "mpsc"(P4 & older Netburst based Xeon) "atom" "core2" "nehalem" "westmere" "silvermont" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylakex" "cannonlake" "icelake" "goldmont" "goldmontplus" "cascadelake" "cooperlake" "tigerlake" "sapphirerapids" "rocketlake" "alderlake"
124 | # Other options :
125 | # - "native_amd" (use compiler autodetection - Selecting your arch manually in the list above is recommended instead of this option)
126 | # - "native_intel" (use compiler autodetection and will prompt for P6_NOPS - Selecting your arch manually in the list above is recommended instead of this option)
127 | # - "generic" (kernel's default - to share the package between machines with different CPU µarch as long as they are x86-64)
128 | #
129 | # Or use the _use_auto_optimization with _use_auto_optimization=y
130 | _processor_opt=${_processor_opt-}
131 |
132 | _use_auto_optimization=${_use_auto_optimization-y}
133 |
134 | # disable debug to lower the size of the kernel
135 | _disable_debug=${_disable_debug-}
136 |
137 | ## Enable zram/zswap ZSTD compression
138 | _zstd_compression=${_zstd_compression-}
139 |
140 | ### Selecting the ZSTD kernel and modules compression level
141 | # ATTENTION - one of two predefined values should be selected!
142 | # 'ultra' - highest compression ratio
143 | # 'normal' - standard compression ratio
144 | # WARNING: the ultra settings can sometimes
145 | # be counterproductive in both size and speed.
146 | _zstd_level_value=${_zstd_level_value-'normal'}
147 |
148 | # Clang LTO mode, only available with the "llvm" compiler - options are "no", "full" or "thin".
149 | # "full: uses 1 thread for Linking, slow and uses more memory, theoretically with the highest performance gains."
150 | # "thin: uses multiple threads, faster and uses less memory, may have a lower runtime performance than Full."
151 | _use_llvm_lto=${_use_llvm_lto-}
152 |
153 | # Use suffix -lto only when requested by the user
154 | # Enabled by default.
155 | # If you do not want the suffix -lto remove the "y" sign next to the flag.
156 | # https://github.com/CachyOS/linux-cachyos/issues/36
157 | _use_lto_suffix=${_use_lto_suffix-y}
158 |
159 | # ATTENTION!: Really experimental LTO implementation for GCC
160 | # This can improve the performance of the kernel
161 | # The performance difference is currently negligible
162 | # DEBUG and BTF needs to be disabled, otherwise the compilation is failing
163 | # The Kernel is bigger with GCC LTO due to more inlining
164 | # More informations:
165 | # https://lore.kernel.org/lkml/20221114114344.18650-1-jirislaby@kernel.org/T/#md8014ad799b02221b67f33584002d98ede6234eb
166 | _use_gcc_lto=${_use_gcc_lto-}
167 |
168 | # KCFI is a proposed forward-edge control-flow integrity scheme for
169 | # Clang, which is more suitable for kernel use than the existing CFI
170 | # scheme used by CONFIG_CFI_CLANG. kCFI doesn't require LTO, doesn't
171 | # alter function references to point to a jump table, and won't break
172 | # function address equality.
173 | # ATTENTION!: You need llvm-git or a patched llvm 15
174 | # ATTENTION!: This is experimental, could fail to boot with nvidia
175 | _use_kcfi=${_use_kcfi-}
176 |
177 | # Build the zfs module in to the kernel
178 | _build_zfs=${_build_zfs-}
179 |
180 | # Enable bcachefs
181 | _bcachefs=${_bcachefs-}
182 |
183 | # Enable LATENCY NICE
184 | # Latency nice is a approach to sets latency-nice as a per-task attribute
185 | # It can improve the latency of applications similar to sched_nice, but focused on the latency
186 | # You need to set the values per task
187 | # Ananicy-cpp has a experimental implementation for this
188 | # It converts sched_nice to latency_nice and set this per task
189 | # You need to configure ananicy-cpp for this or use existing settings
190 | # If you want to test it, use the following branch
191 | # https://gitlab.com/ananicy-cpp/ananicy-cpp/-/tree/feature/latency-nice
192 | _latency_nice=${_latency_nice-}
193 |
194 | if [[ -n "$_use_llvm_lto" && -n "$_use_lto_suffix" ]]; then
195 | pkgsuffix=${_cpusched}-lto
196 | pkgbase=linux-$pkgsuffix
197 |
198 | else
199 | pkgsuffix=${_cpusched}
200 | pkgbase=linux-$pkgsuffix
201 | fi
202 | _major=6.1
203 | _minor=9
204 | #_minorc=$((_minor+1))
205 | #_rcver=rc8
206 | pkgver=${_major}.${_minor}
207 | _stable=${_major}.${_minor}
208 | #_stable=${_major}
209 | #_stablerc=${_major}-${_rcver}
210 | _srcname=linux-${_stable}
211 | #_srcname=linux-${_major}
212 | pkgdesc='Linux cacULE scheduler Kernel by CachyOS with other patches and improvements'
213 | pkgrel=2
214 | _kernver=$pkgver-$pkgrel
215 | arch=('x86_64' 'x86_64_v3')
216 | url="https://github.com/CachyOS/linux-cachyos"
217 | license=('GPL2')
218 | options=('!strip')
219 | makedepends=('bc' 'libelf' 'pahole' 'cpio' 'perl' 'tar' 'xz' 'zstd' 'gcc' 'gcc-libs' 'glibc' 'binutils' 'make' 'patch')
220 | # LLVM makedepends
221 | if [ -n "$_use_llvm_lto" ]; then
222 | makedepends+=(clang llvm lld python)
223 | BUILD_FLAGS=(
224 | CC=clang
225 | LD=ld.lld
226 | LLVM=1
227 | LLVM_IAS=1
228 | )
229 | fi
230 | # ZFS makedepends
231 | if [ -n "$_build_zfs" ]; then
232 | makedepends+=(git)
233 |
234 | fi
235 | _patchsource="https://raw.githubusercontent.com/cachyos/kernel-patches/master/${_major}"
236 | source=(
237 | "https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.xz"
238 | "config"
239 | "auto-cpu-optimization.sh"
240 | "${_patchsource}/all/0001-cachyos-base-all.patch")
241 | ## ZFS Support
242 | if [ -n "$_build_zfs" ]; then
243 | source+=("git+https://github.com/cachyos/zfs.git#commit=92e0d9d183ce6752cd52f7277c8321d81df9ffee")
244 | fi
245 | ## Latency NICE Support
246 | if [ -n "$_latency_nice" ]; then
247 | if [[ "$_cpusched" = "bore" || "$_cpusched" = "cfs" || "$_cpusched" = "hardened" ]]; then
248 | source+=("${_patchsource}/misc/0001-Add-latency-priority-for-CFS-class.patch")
249 | fi
250 | fi
251 |
252 | case "$_cpusched" in
253 | pds|bmq) # BMQ/PDS scheduler
254 | source+=("${_patchsource}/sched/0001-prjc-cachy.patch");;
255 | tt) ## TT Scheduler
256 | source+=("${_patchsource}/sched/0001-tt-cachy.patch");;
257 | cacule|cacule-rdb) ## CacULE(-RDB) Scheduler
258 | source+=("${_patchsource}/sched/0001-cacULE-cachy.patch");;
259 | bore) ## BORE Scheduler with latency_nice
260 | [ -n "$_tune_bore" ] && source+=("${_patchsource}/misc/0001-bore-tuning-sysctl.patch")
261 | source+=("${_patchsource}/sched/0001-bore-cachy.patch");;
262 | bore-hardened) ## Hardened Patches with BORE Scheduler
263 | source+=("${_patchsource}/sched/0001-bore-cachy.patch"
264 | "${_patchsource}/misc/0001-hardened.patch");;
265 | esac
266 |
267 | ## Kernel CFI Patch
268 | if [ -n "$_use_kcfi" ]; then
269 | BUILD_FLAGS=(
270 | CC=clang
271 | LD=ld.lld
272 | LLVM=1
273 | )
274 | fi
275 | ## bcachefs Support
276 | if [ -n "$_bcachefs" ]; then
277 | source+=("${_patchsource}/misc/0001-bcachefs.patch")
278 | fi
279 | if [ -n "$_use_gcc_lto" ]; then
280 | ## GCC-LTO Patch
281 | ## Fix for current gcc --enable-default-pie option
282 | source+=("${_patchsource}/misc/gcc-lto/0001-gcc-LTO-support-for-the-kernel.patch"
283 | "${_patchsource}/misc/gcc-lto/0002-gcc-lto-no-pie.patch")
284 | fi
285 | ## Use vma lock as an extra patch since it has some issues right now
286 | if [[ "$_vma_config" = "standard" || "$_vma_config" = "stats" ]]; then
287 | source+=("${_patchsource}/misc/0001-Introduce-per-VMA-lock.patch")
288 | fi
289 | ## lrng patchset
290 | if [ -n "$_lrng_enable" ]; then
291 | source+=("${_patchsource}/misc/0001-lrng.patch")
292 | fi
293 |
294 | export KBUILD_BUILD_HOST=cachyos
295 | export KBUILD_BUILD_USER=$pkgbase
296 | export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
297 |
298 | _die() { error "$@" ; exit; }
299 |
300 | prepare() {
301 |
302 | cd ${srcdir}/$_srcname
303 |
304 | echo "Setting version..."
305 | scripts/setlocalversion --save-scmversion
306 | echo "-$pkgrel" > localversion.10-pkgrel
307 | echo "${pkgbase#linux}" > localversion.20-pkgname
308 |
309 | local src
310 | for src in "${source[@]}"; do
311 | src="${src%%::*}"
312 | src="${src##*/}"
313 | [[ $src = *.patch ]] || continue
314 | echo "Applying patch $src..."
315 | patch -Np1 < "../$src"
316 | done
317 |
318 | echo "Setting config..."
319 | cp ../config .config
320 |
321 | ### Select CPU optimization
322 | if [ -n "$_processor_opt" ]; then
323 | MARCH=$(echo $_processor_opt|tr '[:lower:]' '[:upper:]'&&echo)
324 | MARCH2=M${MARCH}
325 | scripts/config -k -d CONFIG_GENERIC_CPU
326 | scripts/config -k -e CONFIG_${MARCH2}
327 | fi
328 |
329 | ### Use autooptimization
330 | if [ -n "$_use_auto_optimization" ]; then
331 | "${srcdir}"/auto-cpu-optimization.sh
332 | fi
333 |
334 | ### Selecting CachyOS config
335 | if [ "$_cachy_config" = "yes" ]; then
336 | echo "Enabling CachyOS config..."
337 | scripts/config -e CACHY
338 | elif [ "$_cachy_config" = "no" ]; then
339 | echo "Disabling CachyOS config..."
340 | scripts/config -d CACHY
341 | else
342 | if [ -n "$_cachy_config" ]; then
343 | error "The value $_cachy_config is invalid. Choose the correct one again."
344 | else
345 | error "The value is empty. Choose the correct one again."
346 | fi
347 | _die "Selecting CachyOS config failed!"
348 | fi
349 |
350 | ### Selecting the CPU scheduler
351 | [ -z "$_cpusched" ] && _die "The value is empty. Choose the correct one again."
352 |
353 | case "$_cpusched" in
354 | pds) scripts/config -e SCHED_ALT -d SCHED_BMQ -e SCHED_PDS;;
355 | bmq) scripts/config -e SCHED_ALT -e SCHED_BMQ -d SCHED_PDS;;
356 | tt) scripts/config -e TT_SCHED -e TT_ACCOUNTING_STATS;;
357 | bore|bore-hardened) scripts/config -e SCHED_BORE;;
358 | cacule) scripts/config -e CACULE_SCHED -d CACULE_RDB;;
359 | cacule-rdb) scripts/config -e CACULE_SCHED -e CACULE_RDB --set-val RDB_INTERVAL 19;;
360 | cfs) ;;
361 | *) _die "The value $_cpusched is invalid. Choose the correct one again.";;
362 | esac
363 |
364 | local sched_name="$(echo $_cpusched|tr '[:lower:]' '[:upper:]')"
365 | echo "Selecting ${sched_name} CPU scheduler..."
366 |
367 | ### Enable KCFI
368 | if [ -n "$_use_kcfi" ]; then
369 | echo "Enabling kCFI"
370 | scripts/config -e ARCH_SUPPORTS_CFI_CLANG \
371 | -e CFI_CLANG
372 | fi
373 |
374 | ### Select LLVM level
375 | if [ "$_use_llvm_lto" = "thin" ]; then
376 | echo "Enabling LLVM THIN LTO..."
377 | scripts/config -e LTO \
378 | -e LTO_CLANG \
379 | -e ARCH_SUPPORTS_LTO_CLANG \
380 | -e ARCH_SUPPORTS_LTO_CLANG_THIN \
381 | -d LTO_NONE \
382 | -e HAS_LTO_CLANG \
383 | -d LTO_CLANG_FULL \
384 | -e LTO_CLANG_THIN \
385 | -e HAVE_GCC_PLUGINS
386 | elif [ "$_use_llvm_lto" = "full" ]; then
387 | echo "Enabling LLVM FULL LTO..."
388 | scripts/config -e LTO \
389 | -e LTO_CLANG \
390 | -e ARCH_SUPPORTS_LTO_CLANG \
391 | -e ARCH_SUPPORTS_LTO_CLANG_THIN \
392 | -d LTO_NONE \
393 | -e HAS_LTO_CLANG \
394 | -e LTO_CLANG_FULL \
395 | -d LTO_CLANG_THIN \
396 | -e HAVE_GCC_PLUGINS
397 | else
398 | scripts/config -e LTO_NONE
399 | fi
400 |
401 | ### Enable GCC FULL LTO
402 | ### Disable LTO_CP_CLONE, its experimental
403 | if [ -n "$_use_gcc_lto" ]; then
404 | scripts/config -e LTO_GCC \
405 | -d LTO_CP_CLONE
406 | ### Disable DEBUG, pahole is currently broken with GCC LTO
407 | _disable_debug=y
408 | fi
409 |
410 | ### Select tick rate
411 | [ -z $_HZ_ticks ] && _die "The value is empty. Choose the correct one again."
412 |
413 | case "$_HZ_ticks" in
414 | 100|250|500|600|750|1000)
415 | scripts/config -d HZ_300 -e "HZ_${_HZ_ticks}" --set-val HZ "${_HZ_ticks}";;
416 | 300)
417 | scripts/config -e HZ_300 --set-val HZ 300;;
418 | *)
419 | _die "The value $_HZ_ticks is invalid. Choose the correct one again."
420 | esac
421 |
422 | echo "Setting tick rate to ${_HZ_ticks}Hz..."
423 |
424 | ### Disable NUMA
425 | if [ -n "$_NUMAdisable" ]; then
426 | echo "Disabling NUMA from kernel config..."
427 | scripts/config -d NUMA \
428 | -d AMD_NUMA \
429 | -d X86_64_ACPI_NUMA \
430 | -d NODES_SPAN_OTHER_NODES \
431 | -d NUMA_EMU \
432 | -d NEED_MULTIPLE_NODES \
433 | -d USE_PERCPU_NUMA_NODE_ID \
434 | -d ACPI_NUMA \
435 | -d ARCH_SUPPORTS_NUMA_BALANCING \
436 | -d NODES_SHIFT \
437 | -u NODES_SHIFT \
438 | -d NEED_MULTIPLE_NODES
439 | fi
440 |
441 | ### Setting NR_CPUS
442 | if [ -n "$_nr_cpus" ]; then
443 | echo "Setting custom NR_CPUS..."
444 | scripts/config --set-val NR_CPUS "$_nr_cpus"
445 | else
446 | echo "Setting default NR_CPUS..."
447 | scripts/config --set-val NR_CPUS 320
448 | fi
449 |
450 | ### Disable MQ Deadline I/O scheduler
451 | if [ -n "$_mq_deadline_disable" ]; then
452 | echo "Disabling MQ-Deadline I/O scheduler..."
453 | scripts/config -d MQ_IOSCHED_DEADLINE
454 | fi
455 |
456 | ### Disable Kyber I/O scheduler
457 | if [ -n "$_kyber_disable" ]; then
458 | echo "Disabling Kyber I/O scheduler..."
459 | scripts/config -d MQ_IOSCHED_KYBER
460 | fi
461 |
462 | ### Select performance governor
463 | if [ -n "$_per_gov" ]; then
464 | echo "Setting performance governor..."
465 | scripts/config -d CPU_FREQ_DEFAULT_GOV_SCHEDUTIL \
466 | -e CPU_FREQ_DEFAULT_GOV_PERFORMANCE
467 | fi
468 |
469 | ### Select tick type
470 | if [ "$_tickrate" = "periodic" ]; then
471 | echo "Enabling periodic ticks..."
472 | scripts/config -d NO_HZ_IDLE \
473 | -d NO_HZ_FULL \
474 | -d NO_HZ \
475 | -d NO_HZ_COMMON \
476 | -e HZ_PERIODIC
477 | elif [ "$_tickrate" = "idle" ]; then
478 | echo "Enabling idle ticks.."
479 | scripts/config -d HZ_PERIODIC \
480 | -d NO_HZ_FULL \
481 | -e NO_HZ_IDLE \
482 | -e NO_HZ \
483 | -e NO_HZ_COMMON
484 | elif [ "$_tickrate" = "full" ]; then
485 | echo "Enabling full ticks..."
486 | scripts/config -d HZ_PERIODIC \
487 | -d NO_HZ_IDLE \
488 | -d CONTEXT_TRACKING_FORCE \
489 | -e NO_HZ_FULL_NODEF \
490 | -e NO_HZ_FULL \
491 | -e NO_HZ \
492 | -e NO_HZ_COMMON \
493 | -e CONTEXT_TRACKING
494 | else
495 | if [ -n "$_tickrate" ]; then
496 | error "The value $_tickrate is invalid. Choose the correct one again."
497 | else
498 | error "The value is empty. Choose the correct one again."
499 | fi
500 | _die "Selecting the tick rate failed!"
501 | fi
502 |
503 | ### Select preempt type
504 | if [ "$_preempt" = "full" ]; then
505 | echo "Enabling low latency preempt..."
506 | scripts/config -e PREEMPT_BUILD \
507 | -d PREEMPT_NONE \
508 | -d PREEMPT_VOLUNTARY \
509 | -e PREEMPT \
510 | -e PREEMPT_COUNT \
511 | -e PREEMPTION \
512 | -e PREEMPT_DYNAMIC
513 | elif [ "$_preempt" = "voluntary" ]; then
514 | echo "Enabling voluntary preempt..."
515 | scripts/config -e PREEMPT_BUILD \
516 | -d PREEMPT_NONE \
517 | -e PREEMPT_VOLUNTARY \
518 | -d PREEMPT \
519 | -e PREEMPT_COUNT \
520 | -e PREEMPTION \
521 | -d PREEMPT_DYNAMIC
522 | elif [ "$_preempt" = "server" ]; then
523 | echo "Enabling server preempt..."
524 | scripts/config -e PREEMPT_NONE_BUILD \
525 | -e PREEMPT_NONE \
526 | -d PREEMPT_VOLUNTARY \
527 | -d PREEMPT \
528 | -d PREEMPT_COUNT \
529 | -d PREEMPTION \
530 | -d PREEMPT_DYNAMIC
531 | else
532 | if [ -n "$_preempt" ]; then
533 | error "The value $_preempt is invalid. Choose the correct one again."
534 | else
535 | error "The value is empty. Choose the correct one again."
536 | fi
537 | _die "Selecting PREEMPT failed!"
538 | fi
539 |
540 | ### Enable O3
541 | if [ -n "$_cc_harder" ]; then
542 | echo "Enabling KBUILD_CFLAGS -O3..."
543 | scripts/config -d CC_OPTIMIZE_FOR_PERFORMANCE \
544 | -e CC_OPTIMIZE_FOR_PERFORMANCE_O3
545 | fi
546 |
547 | ### Enable bbr2
548 | if [ -n "$_tcp_bbr2" ]; then
549 | echo "Disabling TCP_CONG_CUBIC..."
550 | scripts/config -m TCP_CONG_CUBIC \
551 | -d DEFAULT_CUBIC \
552 | -e TCP_CONG_BBR2 \
553 | -e DEFAULT_BBR2 \
554 | --set-str DEFAULT_TCP_CONG bbr2
555 | fi
556 |
557 | ### Select LRU config
558 | if [ "$_lru_config" = "standard" ]; then
559 | echo "Enabling multigenerational LRU..."
560 | scripts/config -e LRU_GEN \
561 | -e LRU_GEN_ENABLED \
562 | -d LRU_GEN_STATS
563 | elif [ "$_lru_config" = "stats" ]; then
564 | echo "Enabling multigenerational LRU with stats..."
565 | scripts/config -e LRU_GEN \
566 | -e LRU_GEN_ENABLED \
567 | -e LRU_GEN_STATS
568 | elif [ "$_lru_config" = "none" ]; then
569 | echo "Disabling multigenerational LRU..."
570 | scripts/config -d LRU_GEN
571 | else
572 | if [ -n "$_lru_config" ]; then
573 | error "The value $_lru_config is invalid. Choose the correct one again."
574 | else
575 | error "The value is empty. Choose the correct one again."
576 | fi
577 | error "Enabling multigenerational LRU failed!"
578 | exit
579 | fi
580 |
581 | ### Select VMA config
582 | if [ "$_vma_config" = "standard" ]; then
583 | echo "Enabling per-VMA locking..."
584 | scripts/config -e PER_VMA_LOCK \
585 | -d PER_VMA_LOCK_STATS
586 | elif [ "$_vma_config" = "stats" ]; then
587 | echo "Enabling per-VMA locking with stats..."
588 | scripts/config -e PER_VMA_LOCK \
589 | -e PER_VMA_LOCK_STATS
590 | elif [ "$_vma_config" = "none" ]; then
591 | echo "Disabling per-VMA locking..."
592 | scripts/config -d PER_VMA_LOCK
593 | else
594 | if [ -n "$_vma_config" ]; then
595 | error "The value $_vma_config is invalid. Choose the correct one again."
596 | else
597 | error "The value is empty. Choose the correct one again."
598 | fi
599 | _die "Enabling per-VMA locking failed!"
600 | fi
601 |
602 | ### Select THP
603 | if [ "$_hugepage" = "always" ]; then
604 | echo "Enable THP always..."
605 | scripts/config -d TRANSPARENT_HUGEPAGE_MADVISE \
606 | -e TRANSPARENT_HUGEPAGE_ALWAYS
607 | elif [ "$_hugepage" = "madvise" ]; then
608 | echo "Enable THP madvise..."
609 | scripts/config -d TRANSPARENT_HUGEPAGE_ALWAYS \
610 | -e TRANSPARENT_HUGEPAGE_MADVISE
611 | else
612 | if [ -n "$_hugepage" ]; then
613 | error "The value $_hugepage is invalid. Choose the correct one again."
614 | else
615 | error "The value is empty. Choose the correct one again."
616 | fi
617 | _die "Setting THP has failed!"
618 | fi
619 |
620 | ### Enable DAMON
621 | if [ -n "$_damon" ]; then
622 | echo "Enabling DAMON..."
623 | scripts/config -e DAMON \
624 | -e DAMON_VADDR \
625 | -e DAMON_DBGFS \
626 | -e DAMON_SYSFS \
627 | -e DAMON_PADDR \
628 | -e DAMON_RECLAIM \
629 | -e DAMON_LRU_SORT
630 | fi
631 |
632 | ### Enable LRNG
633 | if [ -n "$_lrng_enable" ]; then
634 | echo "Enabling Linux Random Number Generator ..."
635 | scripts/config -d RANDOM_DEFAULT_IMPL \
636 | -e LRNG \
637 | -e LRNG_SHA256 \
638 | -e LRNG_COMMON_DEV_IF \
639 | -e LRNG_DRNG_ATOMIC \
640 | -e LRNG_SYSCTL \
641 | -e LRNG_RANDOM_IF \
642 | -e LRNG_AIS2031_NTG1_SEEDING_STRATEGY \
643 | -m LRNG_KCAPI_IF \
644 | -m LRNG_HWRAND_IF \
645 | -e LRNG_DEV_IF \
646 | -e LRNG_RUNTIME_ES_CONFIG \
647 | -e LRNG_IRQ_DFLT_TIMER_ES \
648 | -d LRNG_SCHED_DFLT_TIMER_ES \
649 | -e LRNG_TIMER_COMMON \
650 | -d LRNG_COLLECTION_SIZE_256 \
651 | -d LRNG_COLLECTION_SIZE_512 \
652 | -e LRNG_COLLECTION_SIZE_1024 \
653 | -d LRNG_COLLECTION_SIZE_2048 \
654 | -d LRNG_COLLECTION_SIZE_4096 \
655 | -d LRNG_COLLECTION_SIZE_8192 \
656 | --set-val LRNG_COLLECTION_SIZE 1024 \
657 | -e LRNG_HEALTH_TESTS \
658 | --set-val LRNG_RCT_CUTOFF 31 \
659 | --set-val LRNG_APT_CUTOFF 325 \
660 | -e LRNG_IRQ \
661 | -e LRNG_CONTINUOUS_COMPRESSION_ENABLED \
662 | -d LRNG_CONTINUOUS_COMPRESSION_DISABLED \
663 | -e LRNG_ENABLE_CONTINUOUS_COMPRESSION \
664 | -e LRNG_SWITCHABLE_CONTINUOUS_COMPRESSION \
665 | --set-val LRNG_IRQ_ENTROPY_RATE 256 \
666 | -e LRNG_JENT \
667 | --set-val LRNG_JENT_ENTROPY_RATE 16 \
668 | -e LRNG_CPU \
669 | --set-val LRNG_CPU_FULL_ENT_MULTIPLIER 1 \
670 | --set-val LRNG_CPU_ENTROPY_RATE 8 \
671 | -e LRNG_SCHED \
672 | --set-val LRNG_SCHED_ENTROPY_RATE 4294967295 \
673 | -e LRNG_DRNG_CHACHA20 \
674 | -m LRNG_DRBG \
675 | -m LRNG_DRNG_KCAPI \
676 | -e LRNG_SWITCH \
677 | -e LRNG_SWITCH_HASH \
678 | -m LRNG_HASH_KCAPI \
679 | -e LRNG_SWITCH_DRNG \
680 | -m LRNG_SWITCH_DRBG \
681 | -m LRNG_SWITCH_DRNG_KCAPI \
682 | -e LRNG_DFLT_DRNG_CHACHA20 \
683 | -d LRNG_DFLT_DRNG_DRBG \
684 | -d LRNG_DFLT_DRNG_KCAPI \
685 | -e LRNG_TESTING_MENU \
686 | -d LRNG_RAW_HIRES_ENTROPY \
687 | -d LRNG_RAW_JIFFIES_ENTROPY \
688 | -d LRNG_RAW_IRQ_ENTROPY \
689 | -d LRNG_RAW_RETIP_ENTROPY \
690 | -d LRNG_RAW_REGS_ENTROPY \
691 | -d LRNG_RAW_ARRAY \
692 | -d LRNG_IRQ_PERF \
693 | -d LRNG_RAW_SCHED_HIRES_ENTROPY \
694 | -d LRNG_RAW_SCHED_PID_ENTROPY \
695 | -d LRNG_RAW_SCHED_START_TIME_ENTROPY \
696 | -d LRNG_RAW_SCHED_NVCSW_ENTROPY \
697 | -d LRNG_SCHED_PERF \
698 | -d LRNG_ACVT_HASH \
699 | -d LRNG_RUNTIME_MAX_WO_RESEED_CONFIG \
700 | -d LRNG_TEST_CPU_ES_COMPRESSION \
701 | -e LRNG_SELFTEST \
702 | -d LRNG_SELFTEST_PANIC \
703 | -d LRNG_RUNTIME_FORCE_SEEDING_DISABLE
704 | fi
705 |
706 | ### Enable zram/zswap ZSTD compression
707 | if [ -n "$_zstd_compression" ]; then
708 | echo "Enabling zram/swap ZSTD compression..."
709 | scripts/config -d ZRAM_DEF_COMP_LZORLE \
710 | -e ZRAM_DEF_COMP_ZSTD \
711 | --set-str ZRAM_DEF_COMP zstd \
712 | -d ZSWAP_COMPRESSOR_DEFAULT_LZ4 \
713 | -e ZSWAP_COMPRESSOR_DEFAULT_ZSTD \
714 | --set-str ZSWAP_COMPRESSOR_DEFAULT zstd
715 | fi
716 |
717 | ### Selecting the ZSTD modules and kernel compression level
718 | if [ "$_zstd_level_value" = "ultra" ]; then
719 | echo "Enabling highest ZSTD modules and kernel compression ratio..."
720 | scripts/config --set-val MODULE_COMPRESS_ZSTD_LEVEL 19 \
721 | -e MODULE_COMPRESS_ZSTD_ULTRA \
722 | --set-val MODULE_COMPRESS_ZSTD_LEVEL_ULTRA 22 \
723 | --set-val ZSTD_COMP_VAL 22
724 | elif [ "$_zstd_level_value" = "normal" ]; then
725 | echo "Enabling standard ZSTD modules and kernel compression ratio..."
726 | scripts/config --set-val MODULE_COMPRESS_ZSTD_LEVEL 9 \
727 | -d MODULE_COMPRESS_ZSTD_ULTRA \
728 | --set-val ZSTD_COMP_VAL 19
729 | else
730 | if [ -n "$_zstd_level_value" ]; then
731 | error "The value $_zstd_level_value is invalid. Choose the correct one again."
732 | else
733 | error "The value is empty. Choose the correct one again."
734 | fi
735 | _die "Selecting the ZSTD modules and kernel compression level failed!"
736 | fi
737 |
738 | ### Disable DEBUG
739 | if [ -n "$_disable_debug" ]; then
740 | scripts/config -d DEBUG_INFO \
741 | -d DEBUG_INFO_BTF \
742 | -d DEBUG_INFO_DWARF4 \
743 | -d DEBUG_INFO_DWARF5 \
744 | -d PAHOLE_HAS_SPLIT_BTF \
745 | -d DEBUG_INFO_BTF_MODULES \
746 | -d SLUB_DEBUG \
747 | -d PM_DEBUG \
748 | -d PM_ADVANCED_DEBUG \
749 | -d PM_SLEEP_DEBUG \
750 | -d ACPI_DEBUG \
751 | -d SCHED_DEBUG \
752 | -d LATENCYTOP \
753 | -d DEBUG_PREEMPT
754 | fi
755 |
756 | echo "Enable USER_NS_UNPRIVILEGED"
757 | scripts/config -e USER_NS
758 | echo "Enable WINE FASTSYNC"
759 | scripts/config -e WINESYNC
760 |
761 | ### Optionally use running kernel's config
762 | # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
763 | if [ -n "$_use_current" ]; then
764 | if [[ -s /proc/config.gz ]]; then
765 | echo "Extracting config from /proc/config.gz..."
766 | # modprobe configs
767 | zcat /proc/config.gz > ./.config
768 | else
769 | warning "Your kernel was not compiled with IKPROC!"
770 | warning "You cannot read the current config!"
771 | warning "Aborting!"
772 | exit
773 | fi
774 | fi
775 |
776 |
777 | ### Optionally load needed modules for the make localmodconfig
778 | # See https://aur.archlinux.org/packages/modprobed-db
779 | if [ -n "$_localmodcfg" ]; then
780 | if [ -e $HOME/.config/modprobed.db ]; then
781 | echo "Running Steven Rostedt's make localmodconfig now"
782 | make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
783 | else
784 | echo "No modprobed.db data found"
785 | exit
786 | fi
787 | fi
788 |
789 | ### Rewrite configuration
790 | echo "Rewrite configuration..."
791 | make ${BUILD_FLAGS[*]} prepare
792 | yes "" | make ${BUILD_FLAGS[*]} config >/dev/null
793 | diff -u ../config .config || :
794 |
795 | ### Prepared version
796 | make ${BUILD_FLAGS[*]} -s kernelrelease > version
797 | echo "Prepared $pkgbase version $( "${startdir}/config-${pkgver}-${pkgrel}${pkgbase#linux}"
814 |
815 | }
816 |
817 | build() {
818 | cd ${srcdir}/${_srcname}
819 | make ${BUILD_FLAGS[*]} -j$(nproc) all
820 |
821 | if [ -n "$_build_zfs" ]; then
822 | cd ${srcdir}/"zfs"
823 |
824 | if [ -n "$_use_llvm_lto" ]; then
825 | ./autogen.sh
826 | sed -i "s|\$(uname -r)|${pkgver}-${pkgsuffix}|g" configure
827 | ./configure KERNEL_LLVM=1 --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --libdir=/usr/lib \
828 | --datadir=/usr/share --includedir=/usr/include --with-udevdir=/lib/udev \
829 | --libexecdir=/usr/lib/zfs --with-config=kernel \
830 | --with-linux=${srcdir}/$_srcname
831 | else
832 | ./autogen.sh
833 | sed -i "s|\$(uname -r)|${pkgver}-${pkgsuffix}|g" configure
834 | ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --libdir=/usr/lib \
835 | --datadir=/usr/share --includedir=/usr/include --with-udevdir=/lib/udev \
836 | --libexecdir=/usr/lib/zfs --with-config=kernel \
837 | --with-linux=${srcdir}/$_srcname
838 | fi
839 | make ${BUILD_FLAGS[*]}
840 | fi
841 | }
842 |
843 | _package() {
844 | pkgdesc="The $pkgdesc kernel and modules"
845 | depends=('coreutils' 'kmod' 'initramfs')
846 | optdepends=('wireless-regdb: to set the correct wireless channels of your country'
847 | 'linux-firmware: firmware images needed for some devices'
848 | 'modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig'
849 | 'uksmd: Userspace KSM helper daemon')
850 | provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE UKSMD-BUILTIN)
851 |
852 | cd ${srcdir}/$_srcname
853 |
854 | local kernver="$(&2
8 | exit 1
9 | fi
10 | }
11 |
12 | # Call the function before running the rest of the script
13 | check_gcc
14 |
15 | # Get CPU type from GCC and convert to uppercase
16 | MARCH=$(gcc -Q -march=native --help=target|grep -m1 march=|awk '{print toupper($2)}')
17 |
18 | # Check for specific CPU types and set MARCH variable accordingly
19 | case $MARCH in
20 | ZNVER1) MARCH="ZEN";;
21 | ZNVER2) MARCH="ZEN2";;
22 | ZNVER3) MARCH="ZEN3";;
23 | ZNVER4) MARCH="ZEN4";;
24 | BDVER1) MARCH="BULLDOZER";;
25 | BDVER2) MARCH="PILEDRIVER";;
26 | BDVER3) MARCH="STEAMROLLER";;
27 | BDVER4) MARCH="EXCAVATOR";;
28 | BTVER1) MARCH="BOBCAT";;
29 | BTVER2) MARCH="JAGUAR";;
30 | AMDFAM10) MARCH="MK10";;
31 | K8-SSE3) MARCH="K8SSE3";;
32 | BONNELL) MARCH="ATOM";;
33 | GOLDMONT-PLUS) MARCH="GOLDMONTPLUS";;
34 | SKYLAKE-AVX512) MARCH="SKYLAKE2";;
35 | MIVYBRIDGE)
36 | scripts/config --disable CONFIG_AGP_AMD64
37 | scripts/config --disable CONFIG_MICROCODE_AMD
38 | MARCH="MIVYBRIDGE";;
39 | ICELAKE-CLIENT) MARCH="ICELAKE";;
40 | esac
41 |
42 | # Add "M" prefix to MARCH variable
43 | MARCH2=M${MARCH}
44 |
45 | # Display detected CPU and apply optimization
46 | echo "----------------------------------"
47 | echo "| APPLYING AUTO-CPU-OPTIMIZATION |"
48 | echo "----------------------------------"
49 | echo "[*] DETECTED CPU (MARCH) : ${MARCH2}"
50 | scripts/config -k --disable CONFIG_GENERIC_CPU
51 | scripts/config -k --enable CONFIG_${MARCH2}
52 |
--------------------------------------------------------------------------------
/linux-cacule/configure:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | cpu_arch() {
4 | plain ""
5 | plain "#########################################"
6 | plain "Set cpu microarchitecture optimization in GCC"
7 | read -rp "`echo $' > 1) M486SX : Select this for an 486-class CPU without an FPU such as AMD/Cyrix/IBM/Intel SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5S.\n \
8 | > 2) M486 : Select this for an 486-class CPU such as AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 and UMC U5D.\n \
9 | > 3) M586 : Select this for an 586 or 686 series processor such as the AMD K5,the Cyrix 5x86, 6x86 and 6x86MX. This choice does not assume the RDTSC (Read Time Stamp Counter) instruction.\n \
10 | > 4) M586TSC : Select this for a Pentium Classic processor with the RDTSC (Read Time Stamp Counter) instruction for benchmarking.\n \
11 | > 5) M586MMX : Select this for a Pentium with the MMX graphics/multimedia extended instructions.\n \
12 | > 6) M686 : Select this for Intel Pentium Pro chips.\n \
13 | > 7) MPENTIUMII : Select this for Intel chips based on the Pentium-II and pre-Coppermine Celeron core.\n \
14 | > 8) MPENTIUMIII : Select this for Intel chips based on the Pentium-III and Celeron-Coppermine core.\n \
15 | > 9) MPENTIUMM : Select this for Intel Pentium M (not Pentium-4 M) notebook chips.\n \
16 | > 10) MPENTIUM4 : Select this for Intel Pentium 4 chips.\n \
17 | > 11) MK6 : Select this for an AMD K6-family processor.\n \
18 | > 12) MK7 : Select this for an AMD Athlon K7-family processor.\n \
19 | > 13) MK8 : Select this for an AMD Opteron or Athlon64 Hammer-family processor.\n \
20 | > 14) MK8SSE3 : Select this for improved AMD Opteron or Athlon64 Hammer-family processors.\n \
21 | > 15) MK10 : Select this for an AMD 61xx Eight-Core Magny-Cours, Athlon X2 7x50,Phenom X3/X4/II, Athlon II X2/X3/X4, or Turion II-family processor.\n \
22 | > 16) MBARCELONA : Select this for AMD Family 10h Barcelona processors.\n \
23 | > 17) MBOBCAT : Select this for AMD Family 14h Bobcat processors.\n \
24 | > 18) MJAGUAR : Select this for AMD Family 16h Jaguar processors.\n \
25 | > 19) MBULLDOZER : Select this for AMD Family 15h Bulldozer processors.\n \
26 | > 20) MPILEDRIVER : Select this for AMD Family 15h Piledriver processors.\n \
27 | > 21) MSTEAMROLLER : Select this for AMD Family 15h Steamroller processors.\n \
28 | > 22) MEXCAVATOR : Select this for AMD Family 15h Excavator processors.\n \
29 | > 23) MZEN : Select this for AMD Family 17h Zen processors.\n \
30 | > 24) MZEN2 : Select this for AMD Family 17h Zen 2 processors.\n \
31 | > 25) MZEN3 : Select this for AMD Family 19h Zen 3 processors. - GCC 10.3 required\n \
32 | > 26) MZEN4 : Select this for AMD Family 19h Zen 4 processors. - GCC 13.1 required\n \
33 | > 27) MCRUSOE : Select this for a Transmeta Crusoe processor.\n \
34 | > 28) MEFFICEON : Select this for a Transmeta Efficeon processor.\n \
35 | > 29) MWINCHIPC6 : Select this for an IDT Winchip C6 chip.\n \
36 | > 30) MWINCHIP3D : Select this for an IDT Winchip-2, 2A or 3.\n \
37 | > 31) MELAN : Select this for an AMD Elan processor.\n \
38 | > 32) MGEODEGX1 : Select this for a Geode GX1 (Cyrix MediaGX) chip.\n \
39 | > 33) MGEODE_LX Select this for AMD Geode GX and LX processors.\n \
40 | > 34) MCYRIXIII : Select this for a Cyrix III or C3 chip.\n \
41 | > 35) MVIAC3_2 : Select this for a VIA C3 "Nehemiah".\n \
42 | > 36) MVIAC7 : Select this for a VIA C7.\n \
43 | > 37) MPSC : Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey Xeon CPUs with Intel 64bit which is compatible with x86-64.\n \
44 | > 38) MATOM : Select this for the Intel Atom platform.\n \
45 | > 39) MCORE2 : Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx) CPUs.\n \
46 | > 40) MNEHALEM : Select this for 1st Gen Core processors in the Nehalem family.\n \
47 | > 41) MWESTMERE : Select this for the Intel Westmere formerly Nehalem-C family.\n \
48 | > 42) MSILVERMONT Select this for the Intel Silvermont platform.\n \
49 | > 43) MGOLDMONT : Select this for the Intel Goldmont platform including Apollo Lake and Denverton.\n \
50 | > 44) MGOLDMONTPLUS : Select this for the Intel Goldmont Plus platform including Gemini Lake.\n \
51 | > 45) MSANDYBRIDGE : Select this for 2nd Gen Core processors in the Sandy Bridge family.\n \
52 | > 46) MIVYBRIDGE : Select this for 3rd Gen Core processors in the Ivy Bridge family.\n \
53 | > 47) MHASWELL : Select this for 4th Gen Core processors in the Haswell family.\n \
54 | > 48) MBROADWELL : Select this for 5th Gen Core processors in the Broadwell family.\n \
55 | > 49) MSKYLAKE : Select this for 6th Gen Core processors in the Skylake family.\n \
56 | > 50) MSKYLAKEX : Select this for 6th Gen Core processors in the Skylake X family.\n \
57 | > 51) MCANNONLAKE : Select this for 8th Gen Core processors.\n \
58 | > 52) MICELAKE : Select this for 10th Gen Core processors in the Ice Lake family.\n \
59 | > 53) MCASCADELAKE : Select this for Xeon processors in the Cascade Lake family.\n \
60 | > 54) MCOOPERLAKE : Select this for Xeon processors in the Cooper Lake family. - GCC 10.1 required\n \
61 | > 55) MTIGERLAKE : Select this for third-generation 10 nm process processors in the Tiger Lake family. - GCC 10.1 required\n \
62 | > 56) MSAPPHIRERAPIDS : Select this for third-generation 10 nm process processors in the Sapphire Rapids family. - GCC 11 required\n \
63 | > 57) MALDERLAKE : Select this for twelfth-generation processors in the Alder Lake family.- GCC 11 required\n \
64 | > 58) MRAPTORLAKE : Select this for thirteenth-generation processors in the Raptor Lake family.- GCC 13 required\n \
65 | > 59) MMETORLAKE : Select this for fourteenth-generation processors in the Meteor Lake family.- GCC 13 required\n \
66 | > 60) GENERIC_CPU : Generic x86-64 CPU. Run equally well on all x86-64 CPUs.\n \
67 | > 61) GENERIC_CPU2 : Run equally well on all x86-64 CPUs with min support of x86-64-v2. - GCC 11 required\n \
68 | > 62) GENERIC_CPU3 : Generic x86-64-v3 CPU with v3 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v3. - GCC 11 required\n \
69 | > 63) GENERIC_CPU4 : Generic x86-64 CPU with v4 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v4. - GCC 11 required\n \
70 | > 64) MNATIVE_INTEL : Intel-Native optimizations autodetected by GCC.\n \
71 | > 65) MNATIVE_AMD : AMD-Native optimizations autodetected by GCC.\n \
72 | > Default (60 : Gneric CPU)\nchoice[0-65]: '`" _microarchitecture
73 |
74 | if [[ "$_microarchitecture" = "1" ]]; then
75 | scripts/config --disable CONFIG_GENERIC_CPU
76 | scripts/config --enable CONFIG_M486
77 | elif [[ "$_microarchitecture" = "2" ]]; then
78 | scripts/config --disable CONFIG_GENERIC_CPU
79 | scripts/config --enable CONFIG_M486
80 | elif [[ "$_microarchitecture" = "3" ]]; then
81 | scripts/config --disable CONFIG_GENERIC_CPU
82 | scripts/config --enable CONFIG_M586
83 | elif [[ "$_microarchitecture" = "4" ]]; then
84 | scripts/config --disable CONFIG_GENERIC_CPU
85 | scripts/config --enable CONFIG_M586TSC
86 | elif [[ "$_microarchitecture" = "5" ]]; then
87 | scripts/config --disable CONFIG_GENERIC_CPU
88 | scripts/config --enable CONFIG_M586MMX
89 | elif [[ "$_microarchitecture" = "6" ]]; then
90 | scripts/config --disable CONFIG_GENERIC_CPU
91 | scripts/config --enable CONFIG_M686
92 | elif [[ "$_microarchitecture" = "7" ]]; then
93 | scripts/config --disable CONFIG_GENERIC_CPU
94 | scripts/config --enable CONFIG_MPENTIUMII
95 | elif [[ "$_microarchitecture" = "8" ]]; then
96 | scripts/config --disable CONFIG_GENERIC_CPU
97 | scripts/config --enable CONFIG_MPENTIUMIII
98 | elif [[ "$_microarchitecture" = "9" ]]; then
99 | scripts/config --disable CONFIG_GENERIC_CPU
100 | scripts/config --enable CONFIG_MPENTIUMM
101 | elif [[ "$_microarchitecture" = "10" ]]; then
102 | scripts/config --disable CONFIG_GENERIC_CPU
103 | scripts/config --enable CONFIG_MPENTIUM4
104 | elif [[ "$_microarchitecture" = "11" ]]; then
105 | scripts/config --disable CONFIG_GENERIC_CPU
106 | scripts/config --enable CONFIG_MK6
107 | elif [[ "$_microarchitecture" = "12" ]]; then
108 | scripts/config --disable CONFIG_GENERIC_CPU
109 | scripts/config --enable CONFIG_MK7
110 | elif [[ "$_microarchitecture" = "13" ]]; then
111 | scripts/config --disable CONFIG_GENERIC_CPU
112 | scripts/config --enable CONFIG_MK8
113 | elif [[ "$_microarchitecture" = "14" ]]; then
114 | scripts/config --disable CONFIG_GENERIC_CPU
115 | scripts/config --enable CONFIG_MK8SSE3
116 | elif [[ "$_microarchitecture" = "15" ]]; then
117 | scripts/config --disable CONFIG_GENERIC_CPU
118 | scripts/config --enable CONFIG_MK10
119 | elif [[ "$_microarchitecture" = "16" ]]; then
120 | scripts/config --disable CONFIG_GENERIC_CPU
121 | scripts/config --enable CONFIG_MBARCELONA
122 | elif [[ "$_microarchitecture" = "17" ]]; then
123 | scripts/config --disable CONFIG_GENERIC_CPU
124 | scripts/config --enable CONFIG_MBOBCAT
125 | elif [[ "$_microarchitecture" = "18" ]]; then
126 | scripts/config --disable CONFIG_GENERIC_CPU
127 | scripts/config --enable CONFIG_MJAGUAR
128 | elif [[ "$_microarchitecture" = "19" ]]; then
129 | scripts/config --disable CONFIG_GENERIC_CPU
130 | scripts/config --enable CONFIG_MBULLDOZER
131 | elif [[ "$_microarchitecture" = "20" ]]; then
132 | scripts/config --disable CONFIG_GENERIC_CPU
133 | scripts/config --enable CONFIG_MPILEDRIVER
134 | elif [[ "$_microarchitecture" = "21" ]]; then
135 | scripts/config --disable CONFIG_GENERIC_CPU
136 | scripts/config --enable CONFIG_MSTEAMROLLER
137 | elif [[ "$_microarchitecture" = "22" ]]; then
138 | scripts/config --disable CONFIG_GENERIC_CPU
139 | scripts/config --enable CONFIG_MEXCAVATOR
140 | elif [[ "$_microarchitecture" = "23" ]]; then
141 | scripts/config --disable CONFIG_GENERIC_CPU
142 | scripts/config --enable CONFIG_MZEN
143 | elif [[ "$_microarchitecture" = "24" ]]; then
144 | scripts/config --disable CONFIG_GENERIC_CPU
145 | scripts/config --enable CONFIG_MZEN2
146 | elif [[ "$_microarchitecture" = "25" ]]; then
147 | scripts/config --disable CONFIG_GENERIC_CPU
148 | scripts/config --enable CONFIG_MZEN3
149 | elif [[ "$_microarchitecture" = "26" ]]; then
150 | scripts/config --disable CONFIG_GENERIC_CPU
151 | scripts/config --enable CONFIG_MZEN4
152 | elif [[ "$_microarchitecture" = "27" ]]; then
153 | scripts/config --disable CONFIG_GENERIC_CPU
154 | scripts/config --enable CONFIG_MCRUSOE
155 | elif [[ "$_microarchitecture" = "28" ]]; then
156 | scripts/config --disable CONFIG_GENERIC_CPU
157 | scripts/config --enable CONFIG_MEFFICEON
158 | elif [[ "$_microarchitecture" = "29" ]]; then
159 | scripts/config --disable CONFIG_GENERIC_CPU
160 | scripts/config --enable CONFIG_MWINCHIPC6
161 | elif [[ "$_microarchitecture" = "30" ]]; then
162 | scripts/config --disable CONFIG_GENERIC_CPU
163 | scripts/config --enable CONFIG_MWINCHIP3D
164 | elif [[ "$_microarchitecture" = "31" ]]; then
165 | scripts/config --disable CONFIG_GENERIC_CPU
166 | scripts/config --enable CONFIG_MELAN
167 | elif [[ "$_microarchitecture" = "32" ]]; then
168 | scripts/config --disable CONFIG_GENERIC_CPU
169 | scripts/config --enable CONFIG_MGEODEGX1
170 | elif [[ "$_microarchitecture" = "33" ]]; then
171 | scripts/config --disable CONFIG_GENERIC_CPU
172 | scripts/config --enable CONFIG_MGEODE_LX
173 | elif [[ "$_microarchitecture" = "34" ]]; then
174 | scripts/config --disable CONFIG_GENERIC_CPU
175 | scripts/config --enable CONFIG_MCYRIXIII
176 | elif [[ "$_microarchitecture" = "35" ]]; then
177 | scripts/config --disable CONFIG_GENERIC_CPU
178 | scripts/config --enable CONFIG_MVIAC3_2
179 | elif [[ "$_microarchitecture" = "36" ]]; then
180 | scripts/config --disable CONFIG_GENERIC_CPU
181 | scripts/config --enable CONFIG_MVIAC7
182 | elif [[ "$_microarchitecture" = "37" ]]; then
183 | scripts/config --disable CONFIG_GENERIC_CPU
184 | scripts/config --enable CONFIG_MPSC
185 | elif [[ "$_microarchitecture" = "38" ]]; then
186 | scripts/config --disable CONFIG_GENERIC_CPU
187 | scripts/config --enable CONFIG_MATOM
188 | elif [[ "$_microarchitecture" = "39" ]]; then
189 | scripts/config --disable CONFIG_GENERIC_CPU
190 | scripts/config --enable CONFIG_MCORE2
191 | elif [[ "$_microarchitecture" = "40" ]]; then
192 | scripts/config --disable CONFIG_GENERIC_CPU
193 | scripts/config --enable CONFIG_MNEHALEM
194 | elif [[ "$_microarchitecture" = "41" ]]; then
195 | scripts/config --disable CONFIG_GENERIC_CPU
196 | scripts/config --enable CONFIG_MWESTMERE
197 | elif [[ "$_microarchitecture" = "42" ]]; then
198 | scripts/config --disable CONFIG_GENERIC_CPU
199 | scripts/config --enable CONFIG_MSILVERMONT
200 | elif [[ "$_microarchitecture" = "43" ]]; then
201 | scripts/config --disable CONFIG_GENERIC_CPU
202 | scripts/config --enable CONFIG_MGOLDMONT
203 | elif [[ "$_microarchitecture" = "44" ]]; then
204 | scripts/config --disable CONFIG_GENERIC_CPU
205 | scripts/config --enable CONFIG_MGOLDMONTPLUS
206 | elif [[ "$_microarchitecture" = "45" ]]; then
207 | scripts/config --disable CONFIG_GENERIC_CPU
208 | scripts/config --enable CONFIG_MSANDYBRIDGE
209 | elif [[ "$_microarchitecture" = "46" ]]; then
210 | scripts/config --disable CONFIG_GENERIC_CPU
211 | scripts/config --disable CONFIG_AGP_AMD64
212 | scripts/config --disable CONFIG_MICROCODE_AMD
213 | scripts/config --enable CONFIG_MIVYBRIDGE
214 | elif [[ "$_microarchitecture" = "47" ]]; then
215 | scripts/config --disable CONFIG_GENERIC_CPU
216 | scripts/config --enable CONFIG_MHASWELL
217 | elif [[ "$_microarchitecture" = "48" ]]; then
218 | scripts/config --disable CONFIG_GENERIC_CPU
219 | scripts/config --enable CONFIG_MBROADWELL
220 | elif [[ "$_microarchitecture" = "49" ]]; then
221 | scripts/config --disable CONFIG_GENERIC_CPU
222 | scripts/config --enable CONFIG_MSKYLAKE
223 | elif [[ "$_microarchitecture" = "50" ]]; then
224 | scripts/config --disable CONFIG_GENERIC_CPU
225 | scripts/config --enable CONFIG_MSKYLAKEX
226 | elif [[ "$_microarchitecture" = "51" ]]; then
227 | scripts/config --disable CONFIG_GENERIC_CPU
228 | scripts/config --enable CONFIG_MCANNONLAKE
229 | elif [[ "$_microarchitecture" = "52" ]]; then
230 | scripts/config --disable CONFIG_GENERIC_CPU
231 | scripts/config --enable CONFIG_MICELAKE
232 | elif [[ "$_microarchitecture" = "53" ]]; then
233 | scripts/config --disable CONFIG_GENERIC_CPU
234 | scripts/config --enable CONFIG_MCASCADELAKE
235 | elif [[ "$_microarchitecture" = "54" ]]; then
236 | scripts/config --disable CONFIG_GENERIC_CPU
237 | scripts/config --enable CONFIG_MCOOPERLAKE
238 | elif [[ "$_microarchitecture" = "55" ]]; then
239 | scripts/config --disable CONFIG_GENERIC_CPU
240 | scripts/config --enable CONFIG_MTIGERLAKE
241 | elif [[ "$_microarchitecture" = "56" ]]; then
242 | scripts/config --disable CONFIG_GENERIC_CPU
243 | scripts/config --enable CONFIG_MSAPPHIRERAPIDS
244 | elif [[ "$_microarchitecture" = "57" ]]; then
245 | scripts/config --disable CONFIG_GENERIC_CPU
246 | scripts/config --enable CONFIG_MALDERLAKE
247 | elif [[ "$_microarchitecture" = "58" ]]; then
248 | scripts/config --disable CONFIG_GENERIC_CPU
249 | scripts/config --enable CONFIG_MRAPTORLAKE
250 | elif [[ "$_microarchitecture" = "59" ]]; then
251 | scripts/config --disable CONFIG_GENERIC_CPU
252 | scripts/config --enable CONFIG_MMETORLAKE
253 | elif [[ "$_microarchitecture" = "60" ]]; then
254 | scripts/config --enable CONFIG_GENERIC_CPU
255 | elif [[ "$_microarchitecture" = "61" ]]; then
256 | scripts/config --disable CONFIG_GENERIC_CPU
257 | scripts/config --enable CONFIG_GENERIC_CPU2
258 | elif [[ "$_microarchitecture" = "62" ]]; then
259 | scripts/config --disable CONFIG_GENERIC_CPU
260 | scripts/config --enable CONFIG_GENERIC_CPU3
261 | elif [[ "$_microarchitecture" = "63" ]]; then
262 | scripts/config --disable CONFIG_GENERIC_CPU
263 | scripts/config --enable CONFIG_GENERIC_CPU4
264 | elif [[ "$_microarchitecture" = "64" ]]; then
265 | scripts/config --disable CONFIG_GENERIC_CPU
266 | scripts/config --enable CONFIG_MNATIVE_INTEL
267 | elif [[ "$_microarchitecture" = "65" ]]; then
268 | scripts/config --disable CONFIG_GENERIC_CPU
269 | scripts/config --enable CONFIG_MNATIVE_AMD
270 | else
271 | scripts/config --enable CONFIG_GENERIC_CPU
272 | fi
273 |
274 | plain ""
275 |
276 | sleep 2
277 | }
278 |
--------------------------------------------------------------------------------
/linux-tt/.SRCINFO:
--------------------------------------------------------------------------------
1 | pkgbase = linux-tt
2 | pkgdesc = Linux TT scheduler Kernel by CachyOS with other patches and improvements
3 | pkgver = 6.1.9
4 | pkgrel = 2
5 | url = https://github.com/CachyOS/linux-cachyos
6 | arch = x86_64
7 | arch = x86_64_v3
8 | license = GPL2
9 | makedepends = bc
10 | makedepends = libelf
11 | makedepends = pahole
12 | makedepends = cpio
13 | makedepends = perl
14 | makedepends = tar
15 | makedepends = xz
16 | makedepends = zstd
17 | makedepends = gcc
18 | makedepends = gcc-libs
19 | makedepends = glibc
20 | makedepends = binutils
21 | makedepends = make
22 | makedepends = patch
23 | options = !strip
24 | source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.9.tar.xz
25 | source = config
26 | source = auto-cpu-optimization.sh
27 | source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.1/all/0001-cachyos-base-all.patch
28 | source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.1/sched/0001-tt-cachy.patch
29 | sha256sums = d60cf185693c386e7acd9f3eb3a94ae30ffbfee0a9447a20e83711e0bdf5922b
30 | sha256sums = fab53ac59d4da6fb0433f6fd15877871f4124a89021237f90835d1ff3755ba9c
31 | sha256sums = 41c34759ed248175e905c57a25e2b0ed09b11d054fe1a8783d37459f34984106
32 | sha256sums = 3c31aea899ab3ba5d4119fc08935b31f66b2d4da65b6adfbfd3b410114c25753
33 | sha256sums = d23955f69440adab0e1edd4e372bcf424c4772556a6bca7565ddd087eaf31fec
34 |
35 | pkgname = linux-tt
36 | pkgdesc = The Linux TT scheduler Kernel by CachyOS with other patches and improvements kernel and modules
37 | depends = coreutils
38 | depends = kmod
39 | depends = initramfs
40 | optdepends = wireless-regdb: to set the correct wireless channels of your country
41 | optdepends = linux-firmware: firmware images needed for some devices
42 | optdepends = modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig
43 | optdepends = uksmd: Userspace KSM helper daemon
44 | provides = VIRTUALBOX-GUEST-MODULES
45 | provides = WIREGUARD-MODULE
46 | provides = KSMBD-MODULE
47 | provides = UKSMD-BUILTIN
48 |
49 | pkgname = linux-tt-headers
50 | pkgdesc = Headers and scripts for building modules for the Linux TT scheduler Kernel by CachyOS with other patches and improvements kernel
51 | depends = pahole
52 | depends = linux-tt
53 |
--------------------------------------------------------------------------------
/linux-tt/PKGBUILD:
--------------------------------------------------------------------------------
1 | # Maintainer: Peter Jung ptr1337 && Piotr Gorski
2 | # Contributor: Jan Alexander Steffens (heftig)
3 | # Contributor: Tobias Powalowski
4 | # Contributor: Thomas Baechler
5 |
6 | ### Selecting CachyOS config
7 | # ATTENTION - one of two predefined values should be selected!
8 | # 'yes' - enable CachyOS config
9 | # 'no' - disable CachyOS config
10 | _cachy_config=${_cachy_config-'yes'}
11 |
12 | ### Selecting the CPU scheduler
13 | # ATTENTION - one of seven predefined values should be selected!
14 | # 'bmq' - select 'BitMap Queue CPU scheduler'
15 | # 'pds' - select 'Priority and Deadline based Skip list multiple queue CPU scheduler'
16 | # 'cacule' - select 'CacULE scheduler'
17 | # 'cacule-rdb' - select 'CacULE-RDB scheduler'
18 | # 'bore' - select 'Burst-Oriented Response Enhancer'
19 | # 'cfs' - select 'Completely Fair Scheduler'
20 | # 'tt' - select 'Task Type Scheduler by Hamad Marri'
21 | # 'bore-hardened' - select 'BORE Scheduler hardened' ## kernel with hardened config and hardening patches with the bore scheduler
22 | _cpusched=${_cpusched-'tt'}
23 |
24 | ## Apply some suggested sysctl values from the bore developer
25 | ## These are adjusted to BORE
26 | _tune_bore=${_tune_bore-}
27 |
28 | ### BUILD OPTIONS
29 | # Set these variables to ANYTHING that is not null to enable them
30 |
31 | ### Tweak kernel options prior to a build via nconfig
32 | _makenconfig=${_makenconfig-}
33 |
34 | ### Tweak kernel options prior to a build via menuconfig
35 | _makemenuconfig=${_makemenuconfig-}
36 |
37 | ### Tweak kernel options prior to a build via xconfig
38 | _makexconfig=${_makexconfig-}
39 |
40 | ### Tweak kernel options prior to a build via gconfig
41 | _makegconfig=${_makegconfig-}
42 |
43 | # NUMA is optimized for multi-socket motherboards.
44 | # A single multi-core CPU actually runs slower with NUMA enabled.
45 | # See, https://bugs.archlinux.org/task/31187
46 | _NUMAdisable=${_NUMAdisable-}
47 |
48 | # Compile ONLY used modules to VASTLYreduce the number of modules built
49 | # and the build time.
50 | #
51 | # To keep track of which modules are needed for your specific system/hardware,
52 | # give module_db script a try: https://aur.archlinux.org/packages/modprobed-db
53 | # This PKGBUILD read the database kept if it exists
54 | #
55 | # More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db
56 | _localmodcfg=${_localmodcfg-}
57 |
58 | # Use the current kernel's .config file
59 | # Enabling this option will use the .config of the RUNNING kernel rather than
60 | # the ARCH defaults. Useful when the package gets updated and you already went
61 | # through the trouble of customizing your config options. NOT recommended when
62 | # a new kernel is released, but again, convenient for package bumps.
63 | _use_current=${_use_current-}
64 |
65 | ### Enable KBUILD_CFLAGS -O3
66 | _cc_harder=${_cc_harder-y}
67 |
68 | ### Set this to your number of threads you have in your machine otherwise it will default to 128
69 | _nr_cpus=${_nr_cpus-}
70 |
71 | ### Set performance governor as default
72 | _per_gov=${_per_gov-y}
73 |
74 | ### Enable TCP_CONG_BBR2
75 | _tcp_bbr2=${_tcp_bbr2-y}
76 |
77 | ### Running with a 1000HZ, 750Hz, 600 Hz, 500Hz, 300Hz, 250Hz and 100Hz tick rate
78 | _HZ_ticks=${_HZ_ticks-1000}
79 |
80 | ## Choose between perodic, idle or full
81 | ### Full tickless can give higher performances in various cases but, depending on hardware, lower consistency.
82 | _tickrate=${_tickrate-full}
83 |
84 | ## Choose between full(low-latency), voluntary or server
85 | _preempt=${_preempt-full}
86 |
87 | ### Disable MQ-Deadline I/O scheduler
88 | _mq_deadline_disable=${_mq_deadline_disable-y}
89 |
90 | ### Disable Kyber I/O scheduler
91 | _kyber_disable=${_kyber_disable-y}
92 |
93 | ### Enable multigenerational LRU
94 | # ATTENTION - one of three predefined values should be selected!
95 | # 'standard' - enable multigenerational LRU
96 | # 'stats' - enable multigenerational LRU with stats
97 | # 'none' - disable multigenerational LRU
98 | _lru_config=${_lru_config-'standard'}
99 |
100 | ### Enable per-VMA locking
101 | # ATTENTION - one of three predefined values should be selected!
102 | # 'standard' - enable per-VMA locking
103 | # 'stats' - enable per-VMA locking with stats
104 | # 'none' - disable per-VMA locking
105 | _vma_config=${_vma_config-'none'}
106 |
107 | ### Transparent Hugepages
108 | # ATTENTION - one of two predefined values should be selected!
109 | # 'always' - always enable THP
110 | # 'madvise' - madvise, prevent applications from allocating more memory resources than necessary
111 | # More infos here:
112 | # https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/performance_tuning_guide/sect-red_hat_enterprise_linux-performance_tuning_guide-configuring_transparent_huge_pages
113 | _hugepage=${_hugepage-'always'}
114 |
115 | ## Enable DAMON
116 | _damon=${_damon-}
117 |
118 | ## Enable Linux Random Number Generator
119 | _lrng_enable=${_lrng_enable-}
120 |
121 | # CPU compiler optimizations - Defaults to prompt at kernel config if left empty
122 | # AMD CPUs : "k8" "k8sse3" "k10" "barcelona" "bobcat" "jaguar" "bulldozer" "piledriver" "steamroller" "excavator" "zen" "zen2" "zen3"
123 | # Intel CPUs : "mpsc"(P4 & older Netburst based Xeon) "atom" "core2" "nehalem" "westmere" "silvermont" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylakex" "cannonlake" "icelake" "goldmont" "goldmontplus" "cascadelake" "cooperlake" "tigerlake" "sapphirerapids" "rocketlake" "alderlake"
124 | # Other options :
125 | # - "native_amd" (use compiler autodetection - Selecting your arch manually in the list above is recommended instead of this option)
126 | # - "native_intel" (use compiler autodetection and will prompt for P6_NOPS - Selecting your arch manually in the list above is recommended instead of this option)
127 | # - "generic" (kernel's default - to share the package between machines with different CPU µarch as long as they are x86-64)
128 | #
129 | # Or use the _use_auto_optimization with _use_auto_optimization=y
130 | _processor_opt=${_processor_opt-}
131 |
132 | _use_auto_optimization=${_use_auto_optimization-y}
133 |
134 | # disable debug to lower the size of the kernel
135 | _disable_debug=${_disable_debug-}
136 |
137 | ## Enable zram/zswap ZSTD compression
138 | _zstd_compression=${_zstd_compression-}
139 |
140 | ### Selecting the ZSTD kernel and modules compression level
141 | # ATTENTION - one of two predefined values should be selected!
142 | # 'ultra' - highest compression ratio
143 | # 'normal' - standard compression ratio
144 | # WARNING: the ultra settings can sometimes
145 | # be counterproductive in both size and speed.
146 | _zstd_level_value=${_zstd_level_value-'normal'}
147 |
148 | # Clang LTO mode, only available with the "llvm" compiler - options are "no", "full" or "thin".
149 | # "full: uses 1 thread for Linking, slow and uses more memory, theoretically with the highest performance gains."
150 | # "thin: uses multiple threads, faster and uses less memory, may have a lower runtime performance than Full."
151 | _use_llvm_lto=${_use_llvm_lto-}
152 |
153 | # Use suffix -lto only when requested by the user
154 | # Enabled by default.
155 | # If you do not want the suffix -lto remove the "y" sign next to the flag.
156 | # https://github.com/CachyOS/linux-cachyos/issues/36
157 | _use_lto_suffix=${_use_lto_suffix-y}
158 |
159 | # ATTENTION!: Really experimental LTO implementation for GCC
160 | # This can improve the performance of the kernel
161 | # The performance difference is currently negligible
162 | # DEBUG and BTF needs to be disabled, otherwise the compilation is failing
163 | # The Kernel is bigger with GCC LTO due to more inlining
164 | # More informations:
165 | # https://lore.kernel.org/lkml/20221114114344.18650-1-jirislaby@kernel.org/T/#md8014ad799b02221b67f33584002d98ede6234eb
166 | _use_gcc_lto=${_use_gcc_lto-}
167 |
168 | # KCFI is a proposed forward-edge control-flow integrity scheme for
169 | # Clang, which is more suitable for kernel use than the existing CFI
170 | # scheme used by CONFIG_CFI_CLANG. kCFI doesn't require LTO, doesn't
171 | # alter function references to point to a jump table, and won't break
172 | # function address equality.
173 | # ATTENTION!: You need llvm-git or a patched llvm 15
174 | # ATTENTION!: This is experimental, could fail to boot with nvidia
175 | _use_kcfi=${_use_kcfi-}
176 |
177 | # Build the zfs module in to the kernel
178 | _build_zfs=${_build_zfs-}
179 |
180 | # Enable bcachefs
181 | _bcachefs=${_bcachefs-}
182 |
183 | # Enable LATENCY NICE
184 | # Latency nice is a approach to sets latency-nice as a per-task attribute
185 | # It can improve the latency of applications similar to sched_nice, but focused on the latency
186 | # You need to set the values per task
187 | # Ananicy-cpp has a experimental implementation for this
188 | # It converts sched_nice to latency_nice and set this per task
189 | # You need to configure ananicy-cpp for this or use existing settings
190 | # If you want to test it, use the following branch
191 | # https://gitlab.com/ananicy-cpp/ananicy-cpp/-/tree/feature/latency-nice
192 | _latency_nice=${_latency_nice-}
193 |
194 | if [[ -n "$_use_llvm_lto" && -n "$_use_lto_suffix" ]]; then
195 | pkgsuffix=${_cpusched}-lto
196 | pkgbase=linux-$pkgsuffix
197 |
198 | else
199 | pkgsuffix=${_cpusched}
200 | pkgbase=linux-$pkgsuffix
201 | fi
202 | _major=6.1
203 | _minor=9
204 | #_minorc=$((_minor+1))
205 | #_rcver=rc8
206 | pkgver=${_major}.${_minor}
207 | _stable=${_major}.${_minor}
208 | #_stable=${_major}
209 | #_stablerc=${_major}-${_rcver}
210 | _srcname=linux-${_stable}
211 | #_srcname=linux-${_major}
212 | pkgdesc='Linux TT scheduler Kernel by CachyOS with other patches and improvements'
213 | pkgrel=2
214 | _kernver=$pkgver-$pkgrel
215 | arch=('x86_64' 'x86_64_v3')
216 | url="https://github.com/CachyOS/linux-cachyos"
217 | license=('GPL2')
218 | options=('!strip')
219 | makedepends=('bc' 'libelf' 'pahole' 'cpio' 'perl' 'tar' 'xz' 'zstd' 'gcc' 'gcc-libs' 'glibc' 'binutils' 'make' 'patch')
220 | # LLVM makedepends
221 | if [ -n "$_use_llvm_lto" ]; then
222 | makedepends+=(clang llvm lld python)
223 | BUILD_FLAGS=(
224 | CC=clang
225 | LD=ld.lld
226 | LLVM=1
227 | LLVM_IAS=1
228 | )
229 | fi
230 | # ZFS makedepends
231 | if [ -n "$_build_zfs" ]; then
232 | makedepends+=(git)
233 |
234 | fi
235 | _patchsource="https://raw.githubusercontent.com/cachyos/kernel-patches/master/${_major}"
236 | source=(
237 | "https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.xz"
238 | "config"
239 | "auto-cpu-optimization.sh"
240 | "${_patchsource}/all/0001-cachyos-base-all.patch")
241 | ## ZFS Support
242 | if [ -n "$_build_zfs" ]; then
243 | source+=("git+https://github.com/cachyos/zfs.git#commit=92e0d9d183ce6752cd52f7277c8321d81df9ffee")
244 | fi
245 | ## Latency NICE Support
246 | if [ -n "$_latency_nice" ]; then
247 | if [[ "$_cpusched" = "bore" || "$_cpusched" = "cfs" || "$_cpusched" = "hardened" ]]; then
248 | source+=("${_patchsource}/misc/0001-Add-latency-priority-for-CFS-class.patch")
249 | fi
250 | fi
251 |
252 | case "$_cpusched" in
253 | pds|bmq) # BMQ/PDS scheduler
254 | source+=("${_patchsource}/sched/0001-prjc-cachy.patch");;
255 | tt) ## TT Scheduler
256 | source+=("${_patchsource}/sched/0001-tt-cachy.patch");;
257 | cacule|cacule-rdb) ## CacULE(-RDB) Scheduler
258 | source+=("${_patchsource}/sched/0001-cacULE-cachy.patch");;
259 | bore) ## BORE Scheduler with latency_nice
260 | [ -n "$_tune_bore" ] && source+=("${_patchsource}/misc/0001-bore-tuning-sysctl.patch")
261 | source+=("${_patchsource}/sched/0001-bore-cachy.patch");;
262 | bore-hardened) ## Hardened Patches with BORE Scheduler
263 | source+=("${_patchsource}/sched/0001-bore-cachy.patch"
264 | "${_patchsource}/misc/0001-hardened.patch");;
265 | esac
266 |
267 | ## Kernel CFI Patch
268 | if [ -n "$_use_kcfi" ]; then
269 | BUILD_FLAGS=(
270 | CC=clang
271 | LD=ld.lld
272 | LLVM=1
273 | )
274 | fi
275 | ## bcachefs Support
276 | if [ -n "$_bcachefs" ]; then
277 | source+=("${_patchsource}/misc/0001-bcachefs.patch")
278 | fi
279 | if [ -n "$_use_gcc_lto" ]; then
280 | ## GCC-LTO Patch
281 | ## Fix for current gcc --enable-default-pie option
282 | source+=("${_patchsource}/misc/gcc-lto/0001-gcc-LTO-support-for-the-kernel.patch"
283 | "${_patchsource}/misc/gcc-lto/0002-gcc-lto-no-pie.patch")
284 | fi
285 | ## Use vma lock as an extra patch since it has some issues right now
286 | if [[ "$_vma_config" = "standard" || "$_vma_config" = "stats" ]]; then
287 | source+=("${_patchsource}/misc/0001-Introduce-per-VMA-lock.patch")
288 | fi
289 | ## lrng patchset
290 | if [ -n "$_lrng_enable" ]; then
291 | source+=("${_patchsource}/misc/0001-lrng.patch")
292 | fi
293 |
294 | export KBUILD_BUILD_HOST=cachyos
295 | export KBUILD_BUILD_USER=$pkgbase
296 | export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
297 |
298 | _die() { error "$@" ; exit; }
299 |
300 | prepare() {
301 |
302 | cd ${srcdir}/$_srcname
303 |
304 | echo "Setting version..."
305 | scripts/setlocalversion --save-scmversion
306 | echo "-$pkgrel" > localversion.10-pkgrel
307 | echo "${pkgbase#linux}" > localversion.20-pkgname
308 |
309 | local src
310 | for src in "${source[@]}"; do
311 | src="${src%%::*}"
312 | src="${src##*/}"
313 | [[ $src = *.patch ]] || continue
314 | echo "Applying patch $src..."
315 | patch -Np1 < "../$src"
316 | done
317 |
318 | echo "Setting config..."
319 | cp ../config .config
320 |
321 | ### Select CPU optimization
322 | if [ -n "$_processor_opt" ]; then
323 | MARCH=$(echo $_processor_opt|tr '[:lower:]' '[:upper:]'&&echo)
324 | MARCH2=M${MARCH}
325 | scripts/config -k -d CONFIG_GENERIC_CPU
326 | scripts/config -k -e CONFIG_${MARCH2}
327 | fi
328 |
329 | ### Use autooptimization
330 | if [ -n "$_use_auto_optimization" ]; then
331 | "${srcdir}"/auto-cpu-optimization.sh
332 | fi
333 |
334 | ### Selecting CachyOS config
335 | if [ "$_cachy_config" = "yes" ]; then
336 | echo "Enabling CachyOS config..."
337 | scripts/config -e CACHY
338 | elif [ "$_cachy_config" = "no" ]; then
339 | echo "Disabling CachyOS config..."
340 | scripts/config -d CACHY
341 | else
342 | if [ -n "$_cachy_config" ]; then
343 | error "The value $_cachy_config is invalid. Choose the correct one again."
344 | else
345 | error "The value is empty. Choose the correct one again."
346 | fi
347 | _die "Selecting CachyOS config failed!"
348 | fi
349 |
350 | ### Selecting the CPU scheduler
351 | [ -z "$_cpusched" ] && _die "The value is empty. Choose the correct one again."
352 |
353 | case "$_cpusched" in
354 | pds) scripts/config -e SCHED_ALT -d SCHED_BMQ -e SCHED_PDS;;
355 | bmq) scripts/config -e SCHED_ALT -e SCHED_BMQ -d SCHED_PDS;;
356 | tt) scripts/config -e TT_SCHED -e TT_ACCOUNTING_STATS;;
357 | bore|bore-hardened) scripts/config -e SCHED_BORE;;
358 | cacule) scripts/config -e CACULE_SCHED -d CACULE_RDB;;
359 | cacule-rdb) scripts/config -e CACULE_SCHED -e CACULE_RDB --set-val RDB_INTERVAL 19;;
360 | cfs) ;;
361 | *) _die "The value $_cpusched is invalid. Choose the correct one again.";;
362 | esac
363 |
364 | local sched_name="$(echo $_cpusched|tr '[:lower:]' '[:upper:]')"
365 | echo "Selecting ${sched_name} CPU scheduler..."
366 |
367 | ### Enable KCFI
368 | if [ -n "$_use_kcfi" ]; then
369 | echo "Enabling kCFI"
370 | scripts/config -e ARCH_SUPPORTS_CFI_CLANG \
371 | -e CFI_CLANG
372 | fi
373 |
374 | ### Select LLVM level
375 | if [ "$_use_llvm_lto" = "thin" ]; then
376 | echo "Enabling LLVM THIN LTO..."
377 | scripts/config -e LTO \
378 | -e LTO_CLANG \
379 | -e ARCH_SUPPORTS_LTO_CLANG \
380 | -e ARCH_SUPPORTS_LTO_CLANG_THIN \
381 | -d LTO_NONE \
382 | -e HAS_LTO_CLANG \
383 | -d LTO_CLANG_FULL \
384 | -e LTO_CLANG_THIN \
385 | -e HAVE_GCC_PLUGINS
386 | elif [ "$_use_llvm_lto" = "full" ]; then
387 | echo "Enabling LLVM FULL LTO..."
388 | scripts/config -e LTO \
389 | -e LTO_CLANG \
390 | -e ARCH_SUPPORTS_LTO_CLANG \
391 | -e ARCH_SUPPORTS_LTO_CLANG_THIN \
392 | -d LTO_NONE \
393 | -e HAS_LTO_CLANG \
394 | -e LTO_CLANG_FULL \
395 | -d LTO_CLANG_THIN \
396 | -e HAVE_GCC_PLUGINS
397 | else
398 | scripts/config -e LTO_NONE
399 | fi
400 |
401 | ### Enable GCC FULL LTO
402 | ### Disable LTO_CP_CLONE, its experimental
403 | if [ -n "$_use_gcc_lto" ]; then
404 | scripts/config -e LTO_GCC \
405 | -d LTO_CP_CLONE
406 | ### Disable DEBUG, pahole is currently broken with GCC LTO
407 | _disable_debug=y
408 | fi
409 |
410 | ### Select tick rate
411 | [ -z $_HZ_ticks ] && _die "The value is empty. Choose the correct one again."
412 |
413 | case "$_HZ_ticks" in
414 | 100|250|500|600|750|1000)
415 | scripts/config -d HZ_300 -e "HZ_${_HZ_ticks}" --set-val HZ "${_HZ_ticks}";;
416 | 300)
417 | scripts/config -e HZ_300 --set-val HZ 300;;
418 | *)
419 | _die "The value $_HZ_ticks is invalid. Choose the correct one again."
420 | esac
421 |
422 | echo "Setting tick rate to ${_HZ_ticks}Hz..."
423 |
424 | ### Disable NUMA
425 | if [ -n "$_NUMAdisable" ]; then
426 | echo "Disabling NUMA from kernel config..."
427 | scripts/config -d NUMA \
428 | -d AMD_NUMA \
429 | -d X86_64_ACPI_NUMA \
430 | -d NODES_SPAN_OTHER_NODES \
431 | -d NUMA_EMU \
432 | -d NEED_MULTIPLE_NODES \
433 | -d USE_PERCPU_NUMA_NODE_ID \
434 | -d ACPI_NUMA \
435 | -d ARCH_SUPPORTS_NUMA_BALANCING \
436 | -d NODES_SHIFT \
437 | -u NODES_SHIFT \
438 | -d NEED_MULTIPLE_NODES
439 | fi
440 |
441 | ### Setting NR_CPUS
442 | if [ -n "$_nr_cpus" ]; then
443 | echo "Setting custom NR_CPUS..."
444 | scripts/config --set-val NR_CPUS "$_nr_cpus"
445 | else
446 | echo "Setting default NR_CPUS..."
447 | scripts/config --set-val NR_CPUS 320
448 | fi
449 |
450 | ### Disable MQ Deadline I/O scheduler
451 | if [ -n "$_mq_deadline_disable" ]; then
452 | echo "Disabling MQ-Deadline I/O scheduler..."
453 | scripts/config -d MQ_IOSCHED_DEADLINE
454 | fi
455 |
456 | ### Disable Kyber I/O scheduler
457 | if [ -n "$_kyber_disable" ]; then
458 | echo "Disabling Kyber I/O scheduler..."
459 | scripts/config -d MQ_IOSCHED_KYBER
460 | fi
461 |
462 | ### Select performance governor
463 | if [ -n "$_per_gov" ]; then
464 | echo "Setting performance governor..."
465 | scripts/config -d CPU_FREQ_DEFAULT_GOV_SCHEDUTIL \
466 | -e CPU_FREQ_DEFAULT_GOV_PERFORMANCE
467 | fi
468 |
469 | ### Select tick type
470 | if [ "$_tickrate" = "periodic" ]; then
471 | echo "Enabling periodic ticks..."
472 | scripts/config -d NO_HZ_IDLE \
473 | -d NO_HZ_FULL \
474 | -d NO_HZ \
475 | -d NO_HZ_COMMON \
476 | -e HZ_PERIODIC
477 | elif [ "$_tickrate" = "idle" ]; then
478 | echo "Enabling idle ticks.."
479 | scripts/config -d HZ_PERIODIC \
480 | -d NO_HZ_FULL \
481 | -e NO_HZ_IDLE \
482 | -e NO_HZ \
483 | -e NO_HZ_COMMON
484 | elif [ "$_tickrate" = "full" ]; then
485 | echo "Enabling full ticks..."
486 | scripts/config -d HZ_PERIODIC \
487 | -d NO_HZ_IDLE \
488 | -d CONTEXT_TRACKING_FORCE \
489 | -e NO_HZ_FULL_NODEF \
490 | -e NO_HZ_FULL \
491 | -e NO_HZ \
492 | -e NO_HZ_COMMON \
493 | -e CONTEXT_TRACKING
494 | else
495 | if [ -n "$_tickrate" ]; then
496 | error "The value $_tickrate is invalid. Choose the correct one again."
497 | else
498 | error "The value is empty. Choose the correct one again."
499 | fi
500 | _die "Selecting the tick rate failed!"
501 | fi
502 |
503 | ### Select preempt type
504 | if [ "$_preempt" = "full" ]; then
505 | echo "Enabling low latency preempt..."
506 | scripts/config -e PREEMPT_BUILD \
507 | -d PREEMPT_NONE \
508 | -d PREEMPT_VOLUNTARY \
509 | -e PREEMPT \
510 | -e PREEMPT_COUNT \
511 | -e PREEMPTION \
512 | -e PREEMPT_DYNAMIC
513 | elif [ "$_preempt" = "voluntary" ]; then
514 | echo "Enabling voluntary preempt..."
515 | scripts/config -e PREEMPT_BUILD \
516 | -d PREEMPT_NONE \
517 | -e PREEMPT_VOLUNTARY \
518 | -d PREEMPT \
519 | -e PREEMPT_COUNT \
520 | -e PREEMPTION \
521 | -d PREEMPT_DYNAMIC
522 | elif [ "$_preempt" = "server" ]; then
523 | echo "Enabling server preempt..."
524 | scripts/config -e PREEMPT_NONE_BUILD \
525 | -e PREEMPT_NONE \
526 | -d PREEMPT_VOLUNTARY \
527 | -d PREEMPT \
528 | -d PREEMPT_COUNT \
529 | -d PREEMPTION \
530 | -d PREEMPT_DYNAMIC
531 | else
532 | if [ -n "$_preempt" ]; then
533 | error "The value $_preempt is invalid. Choose the correct one again."
534 | else
535 | error "The value is empty. Choose the correct one again."
536 | fi
537 | _die "Selecting PREEMPT failed!"
538 | fi
539 |
540 | ### Enable O3
541 | if [ -n "$_cc_harder" ]; then
542 | echo "Enabling KBUILD_CFLAGS -O3..."
543 | scripts/config -d CC_OPTIMIZE_FOR_PERFORMANCE \
544 | -e CC_OPTIMIZE_FOR_PERFORMANCE_O3
545 | fi
546 |
547 | ### Enable bbr2
548 | if [ -n "$_tcp_bbr2" ]; then
549 | echo "Disabling TCP_CONG_CUBIC..."
550 | scripts/config -m TCP_CONG_CUBIC \
551 | -d DEFAULT_CUBIC \
552 | -e TCP_CONG_BBR2 \
553 | -e DEFAULT_BBR2 \
554 | --set-str DEFAULT_TCP_CONG bbr2
555 | fi
556 |
557 | ### Select LRU config
558 | if [ "$_lru_config" = "standard" ]; then
559 | echo "Enabling multigenerational LRU..."
560 | scripts/config -e LRU_GEN \
561 | -e LRU_GEN_ENABLED \
562 | -d LRU_GEN_STATS
563 | elif [ "$_lru_config" = "stats" ]; then
564 | echo "Enabling multigenerational LRU with stats..."
565 | scripts/config -e LRU_GEN \
566 | -e LRU_GEN_ENABLED \
567 | -e LRU_GEN_STATS
568 | elif [ "$_lru_config" = "none" ]; then
569 | echo "Disabling multigenerational LRU..."
570 | scripts/config -d LRU_GEN
571 | else
572 | if [ -n "$_lru_config" ]; then
573 | error "The value $_lru_config is invalid. Choose the correct one again."
574 | else
575 | error "The value is empty. Choose the correct one again."
576 | fi
577 | error "Enabling multigenerational LRU failed!"
578 | exit
579 | fi
580 |
581 | ### Select VMA config
582 | if [ "$_vma_config" = "standard" ]; then
583 | echo "Enabling per-VMA locking..."
584 | scripts/config -e PER_VMA_LOCK \
585 | -d PER_VMA_LOCK_STATS
586 | elif [ "$_vma_config" = "stats" ]; then
587 | echo "Enabling per-VMA locking with stats..."
588 | scripts/config -e PER_VMA_LOCK \
589 | -e PER_VMA_LOCK_STATS
590 | elif [ "$_vma_config" = "none" ]; then
591 | echo "Disabling per-VMA locking..."
592 | scripts/config -d PER_VMA_LOCK
593 | else
594 | if [ -n "$_vma_config" ]; then
595 | error "The value $_vma_config is invalid. Choose the correct one again."
596 | else
597 | error "The value is empty. Choose the correct one again."
598 | fi
599 | _die "Enabling per-VMA locking failed!"
600 | fi
601 |
602 | ### Select THP
603 | if [ "$_hugepage" = "always" ]; then
604 | echo "Enable THP always..."
605 | scripts/config -d TRANSPARENT_HUGEPAGE_MADVISE \
606 | -e TRANSPARENT_HUGEPAGE_ALWAYS
607 | elif [ "$_hugepage" = "madvise" ]; then
608 | echo "Enable THP madvise..."
609 | scripts/config -d TRANSPARENT_HUGEPAGE_ALWAYS \
610 | -e TRANSPARENT_HUGEPAGE_MADVISE
611 | else
612 | if [ -n "$_hugepage" ]; then
613 | error "The value $_hugepage is invalid. Choose the correct one again."
614 | else
615 | error "The value is empty. Choose the correct one again."
616 | fi
617 | _die "Setting THP has failed!"
618 | fi
619 |
620 | ### Enable DAMON
621 | if [ -n "$_damon" ]; then
622 | echo "Enabling DAMON..."
623 | scripts/config -e DAMON \
624 | -e DAMON_VADDR \
625 | -e DAMON_DBGFS \
626 | -e DAMON_SYSFS \
627 | -e DAMON_PADDR \
628 | -e DAMON_RECLAIM \
629 | -e DAMON_LRU_SORT
630 | fi
631 |
632 | ### Enable LRNG
633 | if [ -n "$_lrng_enable" ]; then
634 | echo "Enabling Linux Random Number Generator ..."
635 | scripts/config -d RANDOM_DEFAULT_IMPL \
636 | -e LRNG \
637 | -e LRNG_SHA256 \
638 | -e LRNG_COMMON_DEV_IF \
639 | -e LRNG_DRNG_ATOMIC \
640 | -e LRNG_SYSCTL \
641 | -e LRNG_RANDOM_IF \
642 | -e LRNG_AIS2031_NTG1_SEEDING_STRATEGY \
643 | -m LRNG_KCAPI_IF \
644 | -m LRNG_HWRAND_IF \
645 | -e LRNG_DEV_IF \
646 | -e LRNG_RUNTIME_ES_CONFIG \
647 | -e LRNG_IRQ_DFLT_TIMER_ES \
648 | -d LRNG_SCHED_DFLT_TIMER_ES \
649 | -e LRNG_TIMER_COMMON \
650 | -d LRNG_COLLECTION_SIZE_256 \
651 | -d LRNG_COLLECTION_SIZE_512 \
652 | -e LRNG_COLLECTION_SIZE_1024 \
653 | -d LRNG_COLLECTION_SIZE_2048 \
654 | -d LRNG_COLLECTION_SIZE_4096 \
655 | -d LRNG_COLLECTION_SIZE_8192 \
656 | --set-val LRNG_COLLECTION_SIZE 1024 \
657 | -e LRNG_HEALTH_TESTS \
658 | --set-val LRNG_RCT_CUTOFF 31 \
659 | --set-val LRNG_APT_CUTOFF 325 \
660 | -e LRNG_IRQ \
661 | -e LRNG_CONTINUOUS_COMPRESSION_ENABLED \
662 | -d LRNG_CONTINUOUS_COMPRESSION_DISABLED \
663 | -e LRNG_ENABLE_CONTINUOUS_COMPRESSION \
664 | -e LRNG_SWITCHABLE_CONTINUOUS_COMPRESSION \
665 | --set-val LRNG_IRQ_ENTROPY_RATE 256 \
666 | -e LRNG_JENT \
667 | --set-val LRNG_JENT_ENTROPY_RATE 16 \
668 | -e LRNG_CPU \
669 | --set-val LRNG_CPU_FULL_ENT_MULTIPLIER 1 \
670 | --set-val LRNG_CPU_ENTROPY_RATE 8 \
671 | -e LRNG_SCHED \
672 | --set-val LRNG_SCHED_ENTROPY_RATE 4294967295 \
673 | -e LRNG_DRNG_CHACHA20 \
674 | -m LRNG_DRBG \
675 | -m LRNG_DRNG_KCAPI \
676 | -e LRNG_SWITCH \
677 | -e LRNG_SWITCH_HASH \
678 | -m LRNG_HASH_KCAPI \
679 | -e LRNG_SWITCH_DRNG \
680 | -m LRNG_SWITCH_DRBG \
681 | -m LRNG_SWITCH_DRNG_KCAPI \
682 | -e LRNG_DFLT_DRNG_CHACHA20 \
683 | -d LRNG_DFLT_DRNG_DRBG \
684 | -d LRNG_DFLT_DRNG_KCAPI \
685 | -e LRNG_TESTING_MENU \
686 | -d LRNG_RAW_HIRES_ENTROPY \
687 | -d LRNG_RAW_JIFFIES_ENTROPY \
688 | -d LRNG_RAW_IRQ_ENTROPY \
689 | -d LRNG_RAW_RETIP_ENTROPY \
690 | -d LRNG_RAW_REGS_ENTROPY \
691 | -d LRNG_RAW_ARRAY \
692 | -d LRNG_IRQ_PERF \
693 | -d LRNG_RAW_SCHED_HIRES_ENTROPY \
694 | -d LRNG_RAW_SCHED_PID_ENTROPY \
695 | -d LRNG_RAW_SCHED_START_TIME_ENTROPY \
696 | -d LRNG_RAW_SCHED_NVCSW_ENTROPY \
697 | -d LRNG_SCHED_PERF \
698 | -d LRNG_ACVT_HASH \
699 | -d LRNG_RUNTIME_MAX_WO_RESEED_CONFIG \
700 | -d LRNG_TEST_CPU_ES_COMPRESSION \
701 | -e LRNG_SELFTEST \
702 | -d LRNG_SELFTEST_PANIC \
703 | -d LRNG_RUNTIME_FORCE_SEEDING_DISABLE
704 | fi
705 |
706 | ### Enable zram/zswap ZSTD compression
707 | if [ -n "$_zstd_compression" ]; then
708 | echo "Enabling zram/swap ZSTD compression..."
709 | scripts/config -d ZRAM_DEF_COMP_LZORLE \
710 | -e ZRAM_DEF_COMP_ZSTD \
711 | --set-str ZRAM_DEF_COMP zstd \
712 | -d ZSWAP_COMPRESSOR_DEFAULT_LZ4 \
713 | -e ZSWAP_COMPRESSOR_DEFAULT_ZSTD \
714 | --set-str ZSWAP_COMPRESSOR_DEFAULT zstd
715 | fi
716 |
717 | ### Selecting the ZSTD modules and kernel compression level
718 | if [ "$_zstd_level_value" = "ultra" ]; then
719 | echo "Enabling highest ZSTD modules and kernel compression ratio..."
720 | scripts/config --set-val MODULE_COMPRESS_ZSTD_LEVEL 19 \
721 | -e MODULE_COMPRESS_ZSTD_ULTRA \
722 | --set-val MODULE_COMPRESS_ZSTD_LEVEL_ULTRA 22 \
723 | --set-val ZSTD_COMP_VAL 22
724 | elif [ "$_zstd_level_value" = "normal" ]; then
725 | echo "Enabling standard ZSTD modules and kernel compression ratio..."
726 | scripts/config --set-val MODULE_COMPRESS_ZSTD_LEVEL 9 \
727 | -d MODULE_COMPRESS_ZSTD_ULTRA \
728 | --set-val ZSTD_COMP_VAL 19
729 | else
730 | if [ -n "$_zstd_level_value" ]; then
731 | error "The value $_zstd_level_value is invalid. Choose the correct one again."
732 | else
733 | error "The value is empty. Choose the correct one again."
734 | fi
735 | _die "Selecting the ZSTD modules and kernel compression level failed!"
736 | fi
737 |
738 | ### Disable DEBUG
739 | if [ -n "$_disable_debug" ]; then
740 | scripts/config -d DEBUG_INFO \
741 | -d DEBUG_INFO_BTF \
742 | -d DEBUG_INFO_DWARF4 \
743 | -d DEBUG_INFO_DWARF5 \
744 | -d PAHOLE_HAS_SPLIT_BTF \
745 | -d DEBUG_INFO_BTF_MODULES \
746 | -d SLUB_DEBUG \
747 | -d PM_DEBUG \
748 | -d PM_ADVANCED_DEBUG \
749 | -d PM_SLEEP_DEBUG \
750 | -d ACPI_DEBUG \
751 | -d SCHED_DEBUG \
752 | -d LATENCYTOP \
753 | -d DEBUG_PREEMPT
754 | fi
755 |
756 | echo "Enable USER_NS_UNPRIVILEGED"
757 | scripts/config -e USER_NS
758 | echo "Enable WINE FASTSYNC"
759 | scripts/config -e WINESYNC
760 |
761 | ### Optionally use running kernel's config
762 | # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
763 | if [ -n "$_use_current" ]; then
764 | if [[ -s /proc/config.gz ]]; then
765 | echo "Extracting config from /proc/config.gz..."
766 | # modprobe configs
767 | zcat /proc/config.gz > ./.config
768 | else
769 | warning "Your kernel was not compiled with IKPROC!"
770 | warning "You cannot read the current config!"
771 | warning "Aborting!"
772 | exit
773 | fi
774 | fi
775 |
776 |
777 | ### Optionally load needed modules for the make localmodconfig
778 | # See https://aur.archlinux.org/packages/modprobed-db
779 | if [ -n "$_localmodcfg" ]; then
780 | if [ -e $HOME/.config/modprobed.db ]; then
781 | echo "Running Steven Rostedt's make localmodconfig now"
782 | make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
783 | else
784 | echo "No modprobed.db data found"
785 | exit
786 | fi
787 | fi
788 |
789 | ### Rewrite configuration
790 | echo "Rewrite configuration..."
791 | make ${BUILD_FLAGS[*]} prepare
792 | yes "" | make ${BUILD_FLAGS[*]} config >/dev/null
793 | diff -u ../config .config || :
794 |
795 | ### Prepared version
796 | make ${BUILD_FLAGS[*]} -s kernelrelease > version
797 | echo "Prepared $pkgbase version $( "${startdir}/config-${pkgver}-${pkgrel}${pkgbase#linux}"
814 |
815 | }
816 |
817 | build() {
818 | cd ${srcdir}/${_srcname}
819 | make ${BUILD_FLAGS[*]} -j$(nproc) all
820 |
821 | if [ -n "$_build_zfs" ]; then
822 | cd ${srcdir}/"zfs"
823 |
824 | if [ -n "$_use_llvm_lto" ]; then
825 | ./autogen.sh
826 | sed -i "s|\$(uname -r)|${pkgver}-${pkgsuffix}|g" configure
827 | ./configure KERNEL_LLVM=1 --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --libdir=/usr/lib \
828 | --datadir=/usr/share --includedir=/usr/include --with-udevdir=/lib/udev \
829 | --libexecdir=/usr/lib/zfs --with-config=kernel \
830 | --with-linux=${srcdir}/$_srcname
831 | else
832 | ./autogen.sh
833 | sed -i "s|\$(uname -r)|${pkgver}-${pkgsuffix}|g" configure
834 | ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --libdir=/usr/lib \
835 | --datadir=/usr/share --includedir=/usr/include --with-udevdir=/lib/udev \
836 | --libexecdir=/usr/lib/zfs --with-config=kernel \
837 | --with-linux=${srcdir}/$_srcname
838 | fi
839 | make ${BUILD_FLAGS[*]}
840 | fi
841 | }
842 |
843 | _package() {
844 | pkgdesc="The $pkgdesc kernel and modules"
845 | depends=('coreutils' 'kmod' 'initramfs')
846 | optdepends=('wireless-regdb: to set the correct wireless channels of your country'
847 | 'linux-firmware: firmware images needed for some devices'
848 | 'modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig'
849 | 'uksmd: Userspace KSM helper daemon')
850 | provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE UKSMD-BUILTIN)
851 |
852 | cd ${srcdir}/$_srcname
853 |
854 | local kernver="$(&2
8 | exit 1
9 | fi
10 | }
11 |
12 | # Call the function before running the rest of the script
13 | check_gcc
14 |
15 | # Get CPU type from GCC and convert to uppercase
16 | MARCH=$(gcc -Q -march=native --help=target|grep -m1 march=|awk '{print toupper($2)}')
17 |
18 | # Check for specific CPU types and set MARCH variable accordingly
19 | case $MARCH in
20 | ZNVER1) MARCH="ZEN";;
21 | ZNVER2) MARCH="ZEN2";;
22 | ZNVER3) MARCH="ZEN3";;
23 | ZNVER4) MARCH="ZEN4";;
24 | BDVER1) MARCH="BULLDOZER";;
25 | BDVER2) MARCH="PILEDRIVER";;
26 | BDVER3) MARCH="STEAMROLLER";;
27 | BDVER4) MARCH="EXCAVATOR";;
28 | BTVER1) MARCH="BOBCAT";;
29 | BTVER2) MARCH="JAGUAR";;
30 | AMDFAM10) MARCH="MK10";;
31 | K8-SSE3) MARCH="K8SSE3";;
32 | BONNELL) MARCH="ATOM";;
33 | GOLDMONT-PLUS) MARCH="GOLDMONTPLUS";;
34 | SKYLAKE-AVX512) MARCH="SKYLAKE2";;
35 | MIVYBRIDGE)
36 | scripts/config --disable CONFIG_AGP_AMD64
37 | scripts/config --disable CONFIG_MICROCODE_AMD
38 | MARCH="MIVYBRIDGE";;
39 | ICELAKE-CLIENT) MARCH="ICELAKE";;
40 | esac
41 |
42 | # Add "M" prefix to MARCH variable
43 | MARCH2=M${MARCH}
44 |
45 | # Display detected CPU and apply optimization
46 | echo "----------------------------------"
47 | echo "| APPLYING AUTO-CPU-OPTIMIZATION |"
48 | echo "----------------------------------"
49 | echo "[*] DETECTED CPU (MARCH) : ${MARCH2}"
50 | scripts/config -k --disable CONFIG_GENERIC_CPU
51 | scripts/config -k --enable CONFIG_${MARCH2}
52 |
--------------------------------------------------------------------------------
/linux-tt/configure:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | cpu_arch() {
4 | plain ""
5 | plain "#########################################"
6 | plain "Set cpu microarchitecture optimization in GCC"
7 | read -rp "`echo $' > 1) M486SX : Select this for an 486-class CPU without an FPU such as AMD/Cyrix/IBM/Intel SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5S.\n \
8 | > 2) M486 : Select this for an 486-class CPU such as AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 and UMC U5D.\n \
9 | > 3) M586 : Select this for an 586 or 686 series processor such as the AMD K5,the Cyrix 5x86, 6x86 and 6x86MX. This choice does not assume the RDTSC (Read Time Stamp Counter) instruction.\n \
10 | > 4) M586TSC : Select this for a Pentium Classic processor with the RDTSC (Read Time Stamp Counter) instruction for benchmarking.\n \
11 | > 5) M586MMX : Select this for a Pentium with the MMX graphics/multimedia extended instructions.\n \
12 | > 6) M686 : Select this for Intel Pentium Pro chips.\n \
13 | > 7) MPENTIUMII : Select this for Intel chips based on the Pentium-II and pre-Coppermine Celeron core.\n \
14 | > 8) MPENTIUMIII : Select this for Intel chips based on the Pentium-III and Celeron-Coppermine core.\n \
15 | > 9) MPENTIUMM : Select this for Intel Pentium M (not Pentium-4 M) notebook chips.\n \
16 | > 10) MPENTIUM4 : Select this for Intel Pentium 4 chips.\n \
17 | > 11) MK6 : Select this for an AMD K6-family processor.\n \
18 | > 12) MK7 : Select this for an AMD Athlon K7-family processor.\n \
19 | > 13) MK8 : Select this for an AMD Opteron or Athlon64 Hammer-family processor.\n \
20 | > 14) MK8SSE3 : Select this for improved AMD Opteron or Athlon64 Hammer-family processors.\n \
21 | > 15) MK10 : Select this for an AMD 61xx Eight-Core Magny-Cours, Athlon X2 7x50,Phenom X3/X4/II, Athlon II X2/X3/X4, or Turion II-family processor.\n \
22 | > 16) MBARCELONA : Select this for AMD Family 10h Barcelona processors.\n \
23 | > 17) MBOBCAT : Select this for AMD Family 14h Bobcat processors.\n \
24 | > 18) MJAGUAR : Select this for AMD Family 16h Jaguar processors.\n \
25 | > 19) MBULLDOZER : Select this for AMD Family 15h Bulldozer processors.\n \
26 | > 20) MPILEDRIVER : Select this for AMD Family 15h Piledriver processors.\n \
27 | > 21) MSTEAMROLLER : Select this for AMD Family 15h Steamroller processors.\n \
28 | > 22) MEXCAVATOR : Select this for AMD Family 15h Excavator processors.\n \
29 | > 23) MZEN : Select this for AMD Family 17h Zen processors.\n \
30 | > 24) MZEN2 : Select this for AMD Family 17h Zen 2 processors.\n \
31 | > 25) MZEN3 : Select this for AMD Family 19h Zen 3 processors. - GCC 10.3 required\n \
32 | > 26) MZEN4 : Select this for AMD Family 19h Zen 4 processors. - GCC 13.1 required\n \
33 | > 27) MCRUSOE : Select this for a Transmeta Crusoe processor.\n \
34 | > 28) MEFFICEON : Select this for a Transmeta Efficeon processor.\n \
35 | > 29) MWINCHIPC6 : Select this for an IDT Winchip C6 chip.\n \
36 | > 30) MWINCHIP3D : Select this for an IDT Winchip-2, 2A or 3.\n \
37 | > 31) MELAN : Select this for an AMD Elan processor.\n \
38 | > 32) MGEODEGX1 : Select this for a Geode GX1 (Cyrix MediaGX) chip.\n \
39 | > 33) MGEODE_LX Select this for AMD Geode GX and LX processors.\n \
40 | > 34) MCYRIXIII : Select this for a Cyrix III or C3 chip.\n \
41 | > 35) MVIAC3_2 : Select this for a VIA C3 "Nehemiah".\n \
42 | > 36) MVIAC7 : Select this for a VIA C7.\n \
43 | > 37) MPSC : Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey Xeon CPUs with Intel 64bit which is compatible with x86-64.\n \
44 | > 38) MATOM : Select this for the Intel Atom platform.\n \
45 | > 39) MCORE2 : Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx) CPUs.\n \
46 | > 40) MNEHALEM : Select this for 1st Gen Core processors in the Nehalem family.\n \
47 | > 41) MWESTMERE : Select this for the Intel Westmere formerly Nehalem-C family.\n \
48 | > 42) MSILVERMONT Select this for the Intel Silvermont platform.\n \
49 | > 43) MGOLDMONT : Select this for the Intel Goldmont platform including Apollo Lake and Denverton.\n \
50 | > 44) MGOLDMONTPLUS : Select this for the Intel Goldmont Plus platform including Gemini Lake.\n \
51 | > 45) MSANDYBRIDGE : Select this for 2nd Gen Core processors in the Sandy Bridge family.\n \
52 | > 46) MIVYBRIDGE : Select this for 3rd Gen Core processors in the Ivy Bridge family.\n \
53 | > 47) MHASWELL : Select this for 4th Gen Core processors in the Haswell family.\n \
54 | > 48) MBROADWELL : Select this for 5th Gen Core processors in the Broadwell family.\n \
55 | > 49) MSKYLAKE : Select this for 6th Gen Core processors in the Skylake family.\n \
56 | > 50) MSKYLAKEX : Select this for 6th Gen Core processors in the Skylake X family.\n \
57 | > 51) MCANNONLAKE : Select this for 8th Gen Core processors.\n \
58 | > 52) MICELAKE : Select this for 10th Gen Core processors in the Ice Lake family.\n \
59 | > 53) MCASCADELAKE : Select this for Xeon processors in the Cascade Lake family.\n \
60 | > 54) MCOOPERLAKE : Select this for Xeon processors in the Cooper Lake family. - GCC 10.1 required\n \
61 | > 55) MTIGERLAKE : Select this for third-generation 10 nm process processors in the Tiger Lake family. - GCC 10.1 required\n \
62 | > 56) MSAPPHIRERAPIDS : Select this for third-generation 10 nm process processors in the Sapphire Rapids family. - GCC 11 required\n \
63 | > 57) MALDERLAKE : Select this for twelfth-generation processors in the Alder Lake family.- GCC 11 required\n \
64 | > 58) MRAPTORLAKE : Select this for thirteenth-generation processors in the Raptor Lake family.- GCC 13 required\n \
65 | > 59) MMETORLAKE : Select this for fourteenth-generation processors in the Meteor Lake family.- GCC 13 required\n \
66 | > 60) GENERIC_CPU : Generic x86-64 CPU. Run equally well on all x86-64 CPUs.\n \
67 | > 61) GENERIC_CPU2 : Run equally well on all x86-64 CPUs with min support of x86-64-v2. - GCC 11 required\n \
68 | > 62) GENERIC_CPU3 : Generic x86-64-v3 CPU with v3 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v3. - GCC 11 required\n \
69 | > 63) GENERIC_CPU4 : Generic x86-64 CPU with v4 instructions. Run equally well on all x86-64 CPUs with min support of x86-64-v4. - GCC 11 required\n \
70 | > 64) MNATIVE_INTEL : Intel-Native optimizations autodetected by GCC.\n \
71 | > 65) MNATIVE_AMD : AMD-Native optimizations autodetected by GCC.\n \
72 | > Default (60 : Gneric CPU)\nchoice[0-65]: '`" _microarchitecture
73 |
74 | if [[ "$_microarchitecture" = "1" ]]; then
75 | scripts/config --disable CONFIG_GENERIC_CPU
76 | scripts/config --enable CONFIG_M486
77 | elif [[ "$_microarchitecture" = "2" ]]; then
78 | scripts/config --disable CONFIG_GENERIC_CPU
79 | scripts/config --enable CONFIG_M486
80 | elif [[ "$_microarchitecture" = "3" ]]; then
81 | scripts/config --disable CONFIG_GENERIC_CPU
82 | scripts/config --enable CONFIG_M586
83 | elif [[ "$_microarchitecture" = "4" ]]; then
84 | scripts/config --disable CONFIG_GENERIC_CPU
85 | scripts/config --enable CONFIG_M586TSC
86 | elif [[ "$_microarchitecture" = "5" ]]; then
87 | scripts/config --disable CONFIG_GENERIC_CPU
88 | scripts/config --enable CONFIG_M586MMX
89 | elif [[ "$_microarchitecture" = "6" ]]; then
90 | scripts/config --disable CONFIG_GENERIC_CPU
91 | scripts/config --enable CONFIG_M686
92 | elif [[ "$_microarchitecture" = "7" ]]; then
93 | scripts/config --disable CONFIG_GENERIC_CPU
94 | scripts/config --enable CONFIG_MPENTIUMII
95 | elif [[ "$_microarchitecture" = "8" ]]; then
96 | scripts/config --disable CONFIG_GENERIC_CPU
97 | scripts/config --enable CONFIG_MPENTIUMIII
98 | elif [[ "$_microarchitecture" = "9" ]]; then
99 | scripts/config --disable CONFIG_GENERIC_CPU
100 | scripts/config --enable CONFIG_MPENTIUMM
101 | elif [[ "$_microarchitecture" = "10" ]]; then
102 | scripts/config --disable CONFIG_GENERIC_CPU
103 | scripts/config --enable CONFIG_MPENTIUM4
104 | elif [[ "$_microarchitecture" = "11" ]]; then
105 | scripts/config --disable CONFIG_GENERIC_CPU
106 | scripts/config --enable CONFIG_MK6
107 | elif [[ "$_microarchitecture" = "12" ]]; then
108 | scripts/config --disable CONFIG_GENERIC_CPU
109 | scripts/config --enable CONFIG_MK7
110 | elif [[ "$_microarchitecture" = "13" ]]; then
111 | scripts/config --disable CONFIG_GENERIC_CPU
112 | scripts/config --enable CONFIG_MK8
113 | elif [[ "$_microarchitecture" = "14" ]]; then
114 | scripts/config --disable CONFIG_GENERIC_CPU
115 | scripts/config --enable CONFIG_MK8SSE3
116 | elif [[ "$_microarchitecture" = "15" ]]; then
117 | scripts/config --disable CONFIG_GENERIC_CPU
118 | scripts/config --enable CONFIG_MK10
119 | elif [[ "$_microarchitecture" = "16" ]]; then
120 | scripts/config --disable CONFIG_GENERIC_CPU
121 | scripts/config --enable CONFIG_MBARCELONA
122 | elif [[ "$_microarchitecture" = "17" ]]; then
123 | scripts/config --disable CONFIG_GENERIC_CPU
124 | scripts/config --enable CONFIG_MBOBCAT
125 | elif [[ "$_microarchitecture" = "18" ]]; then
126 | scripts/config --disable CONFIG_GENERIC_CPU
127 | scripts/config --enable CONFIG_MJAGUAR
128 | elif [[ "$_microarchitecture" = "19" ]]; then
129 | scripts/config --disable CONFIG_GENERIC_CPU
130 | scripts/config --enable CONFIG_MBULLDOZER
131 | elif [[ "$_microarchitecture" = "20" ]]; then
132 | scripts/config --disable CONFIG_GENERIC_CPU
133 | scripts/config --enable CONFIG_MPILEDRIVER
134 | elif [[ "$_microarchitecture" = "21" ]]; then
135 | scripts/config --disable CONFIG_GENERIC_CPU
136 | scripts/config --enable CONFIG_MSTEAMROLLER
137 | elif [[ "$_microarchitecture" = "22" ]]; then
138 | scripts/config --disable CONFIG_GENERIC_CPU
139 | scripts/config --enable CONFIG_MEXCAVATOR
140 | elif [[ "$_microarchitecture" = "23" ]]; then
141 | scripts/config --disable CONFIG_GENERIC_CPU
142 | scripts/config --enable CONFIG_MZEN
143 | elif [[ "$_microarchitecture" = "24" ]]; then
144 | scripts/config --disable CONFIG_GENERIC_CPU
145 | scripts/config --enable CONFIG_MZEN2
146 | elif [[ "$_microarchitecture" = "25" ]]; then
147 | scripts/config --disable CONFIG_GENERIC_CPU
148 | scripts/config --enable CONFIG_MZEN3
149 | elif [[ "$_microarchitecture" = "26" ]]; then
150 | scripts/config --disable CONFIG_GENERIC_CPU
151 | scripts/config --enable CONFIG_MZEN4
152 | elif [[ "$_microarchitecture" = "27" ]]; then
153 | scripts/config --disable CONFIG_GENERIC_CPU
154 | scripts/config --enable CONFIG_MCRUSOE
155 | elif [[ "$_microarchitecture" = "28" ]]; then
156 | scripts/config --disable CONFIG_GENERIC_CPU
157 | scripts/config --enable CONFIG_MEFFICEON
158 | elif [[ "$_microarchitecture" = "29" ]]; then
159 | scripts/config --disable CONFIG_GENERIC_CPU
160 | scripts/config --enable CONFIG_MWINCHIPC6
161 | elif [[ "$_microarchitecture" = "30" ]]; then
162 | scripts/config --disable CONFIG_GENERIC_CPU
163 | scripts/config --enable CONFIG_MWINCHIP3D
164 | elif [[ "$_microarchitecture" = "31" ]]; then
165 | scripts/config --disable CONFIG_GENERIC_CPU
166 | scripts/config --enable CONFIG_MELAN
167 | elif [[ "$_microarchitecture" = "32" ]]; then
168 | scripts/config --disable CONFIG_GENERIC_CPU
169 | scripts/config --enable CONFIG_MGEODEGX1
170 | elif [[ "$_microarchitecture" = "33" ]]; then
171 | scripts/config --disable CONFIG_GENERIC_CPU
172 | scripts/config --enable CONFIG_MGEODE_LX
173 | elif [[ "$_microarchitecture" = "34" ]]; then
174 | scripts/config --disable CONFIG_GENERIC_CPU
175 | scripts/config --enable CONFIG_MCYRIXIII
176 | elif [[ "$_microarchitecture" = "35" ]]; then
177 | scripts/config --disable CONFIG_GENERIC_CPU
178 | scripts/config --enable CONFIG_MVIAC3_2
179 | elif [[ "$_microarchitecture" = "36" ]]; then
180 | scripts/config --disable CONFIG_GENERIC_CPU
181 | scripts/config --enable CONFIG_MVIAC7
182 | elif [[ "$_microarchitecture" = "37" ]]; then
183 | scripts/config --disable CONFIG_GENERIC_CPU
184 | scripts/config --enable CONFIG_MPSC
185 | elif [[ "$_microarchitecture" = "38" ]]; then
186 | scripts/config --disable CONFIG_GENERIC_CPU
187 | scripts/config --enable CONFIG_MATOM
188 | elif [[ "$_microarchitecture" = "39" ]]; then
189 | scripts/config --disable CONFIG_GENERIC_CPU
190 | scripts/config --enable CONFIG_MCORE2
191 | elif [[ "$_microarchitecture" = "40" ]]; then
192 | scripts/config --disable CONFIG_GENERIC_CPU
193 | scripts/config --enable CONFIG_MNEHALEM
194 | elif [[ "$_microarchitecture" = "41" ]]; then
195 | scripts/config --disable CONFIG_GENERIC_CPU
196 | scripts/config --enable CONFIG_MWESTMERE
197 | elif [[ "$_microarchitecture" = "42" ]]; then
198 | scripts/config --disable CONFIG_GENERIC_CPU
199 | scripts/config --enable CONFIG_MSILVERMONT
200 | elif [[ "$_microarchitecture" = "43" ]]; then
201 | scripts/config --disable CONFIG_GENERIC_CPU
202 | scripts/config --enable CONFIG_MGOLDMONT
203 | elif [[ "$_microarchitecture" = "44" ]]; then
204 | scripts/config --disable CONFIG_GENERIC_CPU
205 | scripts/config --enable CONFIG_MGOLDMONTPLUS
206 | elif [[ "$_microarchitecture" = "45" ]]; then
207 | scripts/config --disable CONFIG_GENERIC_CPU
208 | scripts/config --enable CONFIG_MSANDYBRIDGE
209 | elif [[ "$_microarchitecture" = "46" ]]; then
210 | scripts/config --disable CONFIG_GENERIC_CPU
211 | scripts/config --disable CONFIG_AGP_AMD64
212 | scripts/config --disable CONFIG_MICROCODE_AMD
213 | scripts/config --enable CONFIG_MIVYBRIDGE
214 | elif [[ "$_microarchitecture" = "47" ]]; then
215 | scripts/config --disable CONFIG_GENERIC_CPU
216 | scripts/config --enable CONFIG_MHASWELL
217 | elif [[ "$_microarchitecture" = "48" ]]; then
218 | scripts/config --disable CONFIG_GENERIC_CPU
219 | scripts/config --enable CONFIG_MBROADWELL
220 | elif [[ "$_microarchitecture" = "49" ]]; then
221 | scripts/config --disable CONFIG_GENERIC_CPU
222 | scripts/config --enable CONFIG_MSKYLAKE
223 | elif [[ "$_microarchitecture" = "50" ]]; then
224 | scripts/config --disable CONFIG_GENERIC_CPU
225 | scripts/config --enable CONFIG_MSKYLAKEX
226 | elif [[ "$_microarchitecture" = "51" ]]; then
227 | scripts/config --disable CONFIG_GENERIC_CPU
228 | scripts/config --enable CONFIG_MCANNONLAKE
229 | elif [[ "$_microarchitecture" = "52" ]]; then
230 | scripts/config --disable CONFIG_GENERIC_CPU
231 | scripts/config --enable CONFIG_MICELAKE
232 | elif [[ "$_microarchitecture" = "53" ]]; then
233 | scripts/config --disable CONFIG_GENERIC_CPU
234 | scripts/config --enable CONFIG_MCASCADELAKE
235 | elif [[ "$_microarchitecture" = "54" ]]; then
236 | scripts/config --disable CONFIG_GENERIC_CPU
237 | scripts/config --enable CONFIG_MCOOPERLAKE
238 | elif [[ "$_microarchitecture" = "55" ]]; then
239 | scripts/config --disable CONFIG_GENERIC_CPU
240 | scripts/config --enable CONFIG_MTIGERLAKE
241 | elif [[ "$_microarchitecture" = "56" ]]; then
242 | scripts/config --disable CONFIG_GENERIC_CPU
243 | scripts/config --enable CONFIG_MSAPPHIRERAPIDS
244 | elif [[ "$_microarchitecture" = "57" ]]; then
245 | scripts/config --disable CONFIG_GENERIC_CPU
246 | scripts/config --enable CONFIG_MALDERLAKE
247 | elif [[ "$_microarchitecture" = "58" ]]; then
248 | scripts/config --disable CONFIG_GENERIC_CPU
249 | scripts/config --enable CONFIG_MRAPTORLAKE
250 | elif [[ "$_microarchitecture" = "59" ]]; then
251 | scripts/config --disable CONFIG_GENERIC_CPU
252 | scripts/config --enable CONFIG_MMETORLAKE
253 | elif [[ "$_microarchitecture" = "60" ]]; then
254 | scripts/config --enable CONFIG_GENERIC_CPU
255 | elif [[ "$_microarchitecture" = "61" ]]; then
256 | scripts/config --disable CONFIG_GENERIC_CPU
257 | scripts/config --enable CONFIG_GENERIC_CPU2
258 | elif [[ "$_microarchitecture" = "62" ]]; then
259 | scripts/config --disable CONFIG_GENERIC_CPU
260 | scripts/config --enable CONFIG_GENERIC_CPU3
261 | elif [[ "$_microarchitecture" = "63" ]]; then
262 | scripts/config --disable CONFIG_GENERIC_CPU
263 | scripts/config --enable CONFIG_GENERIC_CPU4
264 | elif [[ "$_microarchitecture" = "64" ]]; then
265 | scripts/config --disable CONFIG_GENERIC_CPU
266 | scripts/config --enable CONFIG_MNATIVE_INTEL
267 | elif [[ "$_microarchitecture" = "65" ]]; then
268 | scripts/config --disable CONFIG_GENERIC_CPU
269 | scripts/config --enable CONFIG_MNATIVE_AMD
270 | else
271 | scripts/config --enable CONFIG_GENERIC_CPU
272 | fi
273 |
274 | plain ""
275 |
276 | sleep 2
277 | }
278 |
--------------------------------------------------------------------------------