6

I'm planning to do some realtime control loop tasks with the RPi. In this post PREEMPT_RT and Xenomai were proposed. I'm thinking about trying PREEMPT_RT, as I'd like to keep it as simple as possible.

In the linked post, @Nakedible opposes that the current (as of his writing from Sep 29 '12) drivers are a work-in-progress and might still contain long blocking sleeps.

Is this still the case, or are the drivers real-time capable already? I'll need I2C and maybe SPI drivers.

Also, are there good tutorials on how to compile a working RPi kernel with PREEMPT_RT? So far I've found this and that, but I have never built a kernel yet.

fabb
  • 283
  • 3
  • 11
  • You may just start building a stock kernel without rt yet. That is simple, but it needs a few iterations to get things running smoothly. – minghua Jan 26 '13 at 19:09
  • Nakedible does not really oppose the use of it. In Linux as well as windows or any software system, there are many bugs that will break the system once the use model changes in a certain way. Nakedible is reminding us that if you run rt you are in an area that less people use and test the same kind of system as yours. You need to take care of more testing and fixing work by yourself. That's one of the very nature when you go deeper into programming world, as if you do kernel programming, driver development, etc. – minghua Jan 26 '13 at 19:17

2 Answers2

2

There doesn't seem to be any tutorial for building an RT kernel. I'm working on it, but no success so far. Here's as far as I've got:

  • Start by getting the 3.6 source as described here
  • Apply the stock 3.6.11-rt25 patch
  • One line of the patch fails - you have to manually add a line to a makefile
  • Using the .config from the stock raspbian wheezy distro seems easiest - the defconfig included in the source leaves too many things undefined
  • Modify the config for PREEMPT_RT
  • Complete the build as per the link above.

However, the MMC/SD driver still seems to be broken.

Tom
  • 181
  • 4
  • How exactly it fail? At runtime or build time? What board model do you test on? – minghua Jan 26 '13 at 19:10
  • 1
    The boot just stops - no panic, no oops. The MMC driver shows its usual initialisation output, but it doesn't find the SD card. The same card still works with a non-RT kernel, so it's (probably not) a dud card. – Tom Jan 28 '13 at 11:03
  • 1
    I've also tried putting the root partition on a USB key. Now the rootfs is mounted okay but then nothing else happens - I haven't had a chance to look further into this. Magic SysRq doesn't work over a serial console, so it seems to be at least fairly seriously broken, but I've haven't had a chance to try it on a USB keyboard yet. – Tom Jan 28 '13 at 11:04
  • Thanks Tom for sharing this. Just keep in mind that it may or may not be the mmc driver. – minghua Jan 29 '13 at 06:41
  • 2
    Confirmed that it is the MMC driver - 3.6.11-rt31 boots if you disable the MMC subsystem in the kernel configuration. This, of course, means your root filesystem needs to be on something else - I'm using a USB stick. – Tom Apr 09 '13 at 13:10
  • Tom great you found the root cause and a work-around! – minghua May 09 '13 at 01:38
1

I wrote this tutorial for creating an PREEMPT_RT kernel for Raspberry Pi 3 (and only the version 3). It will install Linux kernel 4.14.14 with RT Linux patch 4.14.12-rt10 on Raspbian version 2017-11-29.

Also I included some pointers for how to adapt this for different combinations of kernels and RT Linux patches, but this still remains the challenge in the process.

tanius
  • 203
  • 1
  • 5