Build and install RT kernel (patched) on rocky 8 or 9.4

·

2 min read

xen-netfront, xen-blkfront cause issues during compilation (they are missing)

so if the contents of the file /etc/dracut.conf.d/xen.conf is add_drivers+=" xen-netfront xen-blkfront " remove it:

sudo rm /etc/dracut.conf.d/xen.conf

sudo dnf update -y

PLEASE reboot (probably the kernel will be updated, also the changes to dracut needs to be applied)

sudo dnf groupinstall -y "Development Tools"

sudo yum install -y wget ncurses-devel make gcc bc bison flex elfutils-libelf-devel openssl-devel

sudo dnf config-manager --set-enabled powertools ONLY FOR 8

sudo dnf install dwarves patch -y

wget https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-6.9.tar.xz

wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.9/patch-6.9-rt5.patch.xz

tar -xvf linux-6.9.tar.xz

cd linux-6.9/

xzcat ../patch-6.9-rt5.patch.xz | patch -p1

cp /boot/config-$(uname -r) .config

in .config, check for CONFIG_SYSTEM_TRUSTED_KEYS="certs/rhel.pem"

change it to CONFIG_SYSTEM_TRUSTED_KEYS=""

make menuconfig

In General setup enable Configure standard kernel features (expert users)

now you should see in General setup / Preemption Model (……) the option Fully Preemptible Kernel (Real-Time)

If no worky:

fter checking kernel/Kconfig.preempt I got the answer:

config PREEMPT_RT
    bool "Fully Preemptible Kernel (Real-Time)"
    depends on EXPERT && ARCH_SUPPORTS_RT
    select PREEMPTION
-> https://elixir.bootlin.com/linux/latest/source/kernel/Kconfig.preempt#L61

I had enabled the EXPERT flag (via the toggle Embedded System as krishna chaitanya in the comment above) but my configuration file was missing the entry: CONFIG_ARCH_SUPPORTS_RT

When I entered the flag manually, it would be overwritten by a make step. To enable this flag by default open the file arch/Kconfig and search for the entry: ARCH_SUPPORTS_RT. (in nano press CTRL+W for search)

Change the entry from

config ARCH_SUPPORTS_RT
    bool
to

config ARCH_SUPPORTS_RT
    def_bool y
When you now also have the EXPERT (General Setup -> Embedded System) flag enabled you should see the option "Fully Preemptible Kernel (Real-Time)" under General Setup -> Preemption Model.

Also in General Setup you should enable Kernel .config support to have the config available when the kernel is installed in /proc/config.gz

Also you might need to disable ssl verification for modules:
If you can through the interface

Enable loadable module support -> Module signature verification

and if you cannot

scripts/config --disable MODULE_SIG
scripts/config --disable MODULE_SIG_ALL
scripts/config --disable MODULE_SIG_FORCE

Now you should Save

make ARCH=arm64 -j$(nproc) &> build.log

sudo make ARCH=arm64 modules_install

sudo make install

sudo grubby --set-default /boot/vmlinuz-KERNEL

sudo grubby --default-kernel

reboot

uname -a

uname -r

ls /sys/kernel/realtime