Skip to content

preempt_rt_kernel

Dan Zimmerman edited this page Oct 16, 2024 · 14 revisions

Building The PREEMPT_RT Realtime Kernel

Bookworm - Raspberry Pi OS

Following cross-compile instructions here:

https://www.raspberrypi.com/documentation/computers/linux_kernel.html#cross-compile-the-kernel

Doing this on WSL 2, Ubuntu Noble 24.04.1 LTS

  1. Clone the Raspberry Pi OS kernel sources
git clone --depth=1 https://github.com/raspberrypi/linux
  1. Prepare for cross-compilation

Install some tools:

sudo apt update
sudo apt install bc bison flex libssl-dev make libc6-dev libncurses5-dev

And get cross-build for ARM64:

sudo apt install crossbuild-essential-arm64
  1. Patch the kernel

https://www.raspberrypi.com/documentation/computers/linux_kernel.html#patch-the-kernel

See also:

https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/master/doc/real_time.rst

Check the kernel version:

dan@karman:~/linux$ head Makefile -n 4
# SPDX-License-Identifier: GPL-2.0
VERSION = 6
PATCHLEVEL = 6
SUBLEVEL = 56

We actually want 6.6.53 after 4ad9fa5c30edc19acf05b2960dd686c29cbe75a2

Let's get a 500-deep history:

git clone --depth=500 https://github.com/raspberrypi/linux

We can follow the Makefile

git log --follow Makefile

This isn't working that well.

Clone this wiki locally