Install dependancies
apt-get install build-essential libnuma-dev libncurses5-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf fakeroot dwarves zstd
Create directory to build kernel
mkdir -p ~/kernel
cd -p ~/kernel
Download and extract kernel source
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.65.tar.gz
tar -xzf linux-5.15.65.tar.gz
Download and extract patch
wget https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/patch-5.15.65-rt49.patch.gz
gunzip patch-5.15.65-rt49.patch.gz
apply patch to kernel source
cd linux-5.15.65
patch -p1 < ../patch-5.15.65-rt49.patch
Copy old config file
cp /boot/config-$(uname -r) .config
Set default yes to old config
yes '' | make oldconfig
Modify config file
make menuconfig
Set config according to follwiong steps
# Enable CONFIG_NO_HZ_FULL
-> General setup
-> Timers subsystem
-> Timer tick handling (Full dynticks system (tickless))
(X) Full dynticks system (tickless)
# Enable CONFIG_PREEMPT_RT
-> General Setup
-> Preemption Model (Fully Preemptible Kernel (Real-Time))
(X) Fully Preemptible Kernel (Real-Time)
# Set CONFIG_HZ_1000
-> Processor type and features
-> Timer frequency (1000 HZ)
(X) 1000 HZ
# Set CPU_FREQ_DEFAULT_GOV_PERFORMANCE [=y]
-> Power management and ACPI options
-> CPU Frequency scaling
-> CPU Frequency scaling (CPU_FREQ [=y])
-> Default CPUFreq governor (<choice> [=y])
(X) performance
Remove SYSTEM_TRUSTED_KEYS and SYSTEM_REVOCATION_KEYS
scripts/config --set-str SYSTEM_TRUSTED_KEYS ""
scripts/config --set-str SYSTEM_REVOCATION_KEYS ""
make and install kernel
make modules_install
make install
update-grub