• Raspberry Pi 3 model B
  • OS: Raspbian 9.3 stretch
  • Kernel: armv7l Linux 4.9.76-v7+
  • CPU: ARMv7 rev 4 (v7l) @ 1.2GHz RAM: 1GB

I'm trying to apply the real-time patch (it's highly desirable for my project). I sourced the patch from the following site. After wget-ing patch-4.9.76-rt61.patch I then ran cat patch-4.9.76-rt61.patch | patch -p1. The issue is

pi@raspberrypi:~/rt $ cat patch-4.9.76-rt61.patch | patch -p1
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
|index 3a3b30ac2a75..9e0745cafbd8 100644
|--- a/Documentation/sysrq.txt
|+++ b/Documentation/sysrq.txt
File to patch:

This is my first time patching so perhaps it's an obvious mistake but I don't understand the "File to patch:..." bit. Didn't I just pipe the contents into it?

  • did you download the kernel sources? are they in the same folder as the patch? did you take a look if Documentation/sysrq.txt is there?
    – Christian
    Commented Jan 20, 2018 at 16:26
  • Do you have to apply patches to kernel source code then compile? I thought it being a patch that it would just apply to the current working kernel hence the diff tags.
    – shmink
    Commented Jan 20, 2018 at 18:19
  • yes the patch patches the kernel source code, you can not patch a binary
    – Christian
    Commented Jan 20, 2018 at 18:26
  • did you take a look at these links: frank-durr.de/?p=203 raspberrypi.org/documentation/linux/kernel/building.md ?
    – Christian
    Commented Jan 20, 2018 at 18:27
  • Yeah I actually installed that precompiled kernel onto my Pi earlier and it just failed to boot. I think it was due to the hardware difference being BCM2708 and mine being BCM 2709 but I'm not really sure myself. If I have to do the actual building that's fine but if there's an easier way to do it why make life harder I suppose.
    – shmink
    Commented Jan 20, 2018 at 18:35

1 Answer 1


You need to compile the sources, this worked for me (only valid for Cross compiling on 64-bit linux for Raspberry Pi 3):

cd ~
sudo rm -rf ~/linux #only if checked out before
git clone https://github.com/raspberrypi/linux
cd linux
wget https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/patch-4.9.76-rt61.patch.gz
zcat patch-4.9.76-rt61.patch.gz | patch -p1
export KERNEL=kernel7
make -j 4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
nano .config
#CTRL-W search for PREEMPT, comment out whatever sheduler is selected and comment in CONFIG_PREEMT_RT_FULL=y
make -j 6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs

adjust for latest rt patch

echo $PATH

should give:


at least for 64 bit hosts, which is every recent host





  • added this because posting commands in comments is rather hard to read, I know this is not a high quality answer and will probably be outdated soon
    – Christian
    Commented Jan 20, 2018 at 20:16
  • Yeah commenting on here sucks. Thanks for the answer. Do you not need the tools though? github.com/raspberrypi/tools.git
    – shmink
    Commented Jan 20, 2018 at 20:19
  • So I just comment out the one thing? There is still a lot of PREEMPT stuff in the .config file.
    – shmink
    Commented Jan 20, 2018 at 20:28
  • yes you need the tools, and you need to do the bashrc thing, but only once, if you do it more than once it will mess up your shell. I only changed two lines in the config. You can also try "make menuconfig" but that was breaking things for me
    – Christian
    Commented Jan 20, 2018 at 20:32
  • does making defconfig work for you now? thats very important
    – Christian
    Commented Jan 20, 2018 at 20:32

Your Answer

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

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