1

I need to patch and compile (not cross-compiling) the Kernel 4.14.97-v7+ (Raspbian Stretch) to support realtime operations. However, I did not find the corresponding patch. The folder

https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.14/

does not contain the patch for my kernel.

Furthermore, all the procedures I found illustrate the steps for previous kernels.

Did anyone go through the patch I want to apply? Any further suggestion to make everything working?

Thanks, F

  • I believe that you should be able to apply the latest 'patch' version of the 4.14 RT branch. According to the patch docs 4.14.93 RT is applicable to any 4.14.x kernel. You cannot however patch a previously patched kernel with a newer patch - you must remove the old patch first. – tobyd Feb 9 at 17:05
  • tobyd: thanks for the reply. do you know if there are post-patch boot options to add/set to cmdline.txt? – Fabio Feb 9 at 17:12
  • Once you've applied the patch you gain a few extra options in the config (menuconfig, the ui one, whatever kernel configuration you are using), the RT one in the kernel options, pre-emption section. You'll gain FULL-RT and a new timer section to complete to make the thing fully RT. Once its compiled and installed with its modules you only have to tell config.txt which kernel img to use as normal. – tobyd Feb 9 at 17:14
3

It seems I could successfully compile and install the kernel by performing the following procedure

git clone --depth=1 https://github.com/raspberrypi/linux
cd linux
KERNEL=kernel7
make bcm2709_defconfig
wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.14/patch-4.14.93-rt53.patch.gz
gunzip patch-4.14.93-rt53.patch.gz 
cat patch-4.14.93-rt53.patch | patch -p1
make menuconfig
make zImage
make modules
make dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img

A reboot resulted in a non-bootable system. The following options added to cmdline.txt

dwc_otg.fiq_enable=0
dwc_otg.fiq_fsm_enable=0
sdhci_bcm2708.enable_llm=0

made the system bootable again. I ran

sudo ./cyclictest -m -t1 -p 80 -n -i 500 -l 100000

from rt-tests and I get 15/20 ms latency.

The aim of this was to enhance the performance of sunvox, however I still have a very slow response from the program. But, the kernel-related issue is solved.

  • RT preempt is just half the picture you still need to provide real time drivers for hardware and provide a performant rt scheduler like xenomai and compile against it for applications to take advantage of the new scheduling class. However it is great that you got the patch working I have been curious about this myself. – crasic Feb 11 at 22:36
  • 1
    Thanks Crasic, it got some times to figure out the full procedure for compiling the kernel and having a working board. I'll try to go through the compilation/installation of xenomai asap, I guess your suggestion will be meaningful to achieve outstanding performance on the RPI3. Thanks again. – Fabio Feb 13 at 15:10
  • Be careful because RT does not get better performance except for certain specific tasks. It's mostly about preemption and scheduling guaranatees than anything. If you have a board that is struggling to poll many sensors, RT will help, but so would using an Arduino as coproccessor to sample in baremetal (and in many systems that is better approach). If you are looking for better computational performance, no improvement should be expected. In fact due to strictures of RT code it may reduce performance of computational tasks and non rt task in preference of RT io tasks – crasic Feb 16 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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