I'd like to change the default RPi 3B+ kernel to use the version 5.10 with the rt_preempt patch. To accomplish this, I'm trying to follow this guide and the official Raspberry guide, adapting some steps to apply the newer version of the kernel (I'm currently building the kernel on WSL1 with Ubuntu 18.04):

  • Install required tools:

    sudo apt install git build-essential libncurses5-dev bc bison flex libssl-dev make libc6-dev
    sudo apt install crossbuild-essential-armhf
  • Clone kernel repository:

    git clone -b 'rpi-5.10.y' --depth 1 https://github.com/raspberrypi/linux.git
  • Download patch:

    wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.10/patch-5.10.65-rt53.patch.xz
  • Setup ENV variables in the file setup.sh:

    export KERNEL=kernel7
    export ARCH=arm
    export CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
    export INSTALL_MOD_PATH=mnt/d
  • Apply the patch:

    cd linux
    xzcat ../patch-5.10.65-rt53.patch.xz   | patch -p1

At this point I have some errors in the patching log:

patching file include/linux/local_lock_internal.h
Hunk #1 FAILED at 7.
Hunk #2 FAILED at 21.
Hunk #3 FAILED at 47.
Hunk #4 succeeded at 59 (offset -7 lines).
Hunk #5 succeeded at 77 (offset -7 lines).
Hunk #6 succeeded at 88 (offset -7 lines).
3 out of 6 hunks FAILED -- saving rejects to file      include/linux/local_lock_internal.h.rej


patching file kernel/cgroup/cpuset.c
Hunk #2 succeeded at 1280 (offset -2 lines).
Hunk #3 FAILED at 1304.
Hunk #4 succeeded at 1404 with fuzz 1 (offset -3 lines).
Hunk #5 FAILED at 1441.
Hunk #6 succeeded at 1553 (offset -6 lines).
Hunk #7 succeeded at 1564 (offset -6 lines).
Hunk #8 succeeded at 1758 (offset -6 lines).
Hunk #9 succeeded at 1828 (offset -6 lines).
Hunk #10 succeeded at 1921 (offset -6 lines).
Hunk #11 FAILED at 2020.
Hunk #12 succeeded at 2432 (offset -6 lines).
Hunk #13 succeeded at 2454 (offset -6 lines).
Hunk #14 succeeded at 2767 (offset -6 lines).
Hunk #15 succeeded at 2801 (offset -6 lines).
Hunk #16 succeeded at 2862 (offset -6 lines).
Hunk #17 succeeded at 2873 (offset -6 lines).
Hunk #18 succeeded at 2970 (offset -6 lines).
Hunk #19 succeeded at 3012 (offset -6 lines).
Hunk #20 FAILED at 3088.
Hunk #21 FAILED at 3105.
Hunk #22 succeeded at 3170 (offset -17 lines).
Hunk #23 succeeded at 3190 (offset -17 lines).
Hunk #24 succeeded at 3301 (offset -17 lines).
Hunk #25 succeeded at 3366 (offset -17 lines).
Hunk #26 succeeded at 3462 (offset -17 lines).
5 out of 26 hunks FAILED -- saving rejects to file kernel/cgroup/cpuset.c.rej

From here I don't know how to solve the problem. This is the fist time I'm dealing with kernel compilation and I'm not sure if the problem may be related to the patch compatibility/version, to some compilation settings or other stuff. Is it possible to solve this issue?

1 Answer 1


adapting some steps to apply the newer version of the kernel

Reasonably enough, any given unit of source code from one version to another is potentially different, otherwise there'd only be no point in progressive versions.

patch can work around this, and some of your output reflects that (the offsets detected and the bit about "fuzz" -- there's discussion of this at the beginning of man patch). However, that has its limits and it could always be that some parts of a patch may not have any correlative when used against a different version.

Is it possible to solve this issue?

You need a kernel and a patch with the same version. The current Pi 5.10.y is actually 5.10.63, which there is no corresponding patch for. However, in that directory there is one for 5.10.56 (and an "older" subdirectory).

To get the Pi kernel 5.10.56 source, you'll have to roll back to commit 9746c25334cb364ab6651ee6dfd4cab3218d0c06 (you can find this correspondence by clicking on "History" for the Makefile in the previous link and scrolling down to Aug 4th).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.