Raspberry 2 realtime kernel image

You are welcome… as we use to say in Italy, “we are all on the same boat ;)”… hopefully Schettino is not the captain eheheh :smiley:


That makes sense, I’d forgotten I’d zero’d the unused variables in that structure. When I tried the structure wasn’t what the compiled kernel was saying so I left the zero’ing in and fixed the structure which made it work so assumed it was the structure change. (I guess I have some old header files lying around).
At least it working now (although possibly not so stable yet)

In case you are interested a couple of about 1 hour tests on the standard raspbian kernel come to…
pi@raspberrypi2 ~/rt-tests $ sudo ./cyclictest --smp -p99 -m -n

/dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 0.08 0.13 0.13 1/91 2480

T: 0 ( 2437) P:99 I:1000 C:3313797 Min: 11 Act: 22 Avg: 24 Max: 828
T: 1 ( 2438) P:99 I:1500 C:2209185 Min: 11 Act: 29 Avg: 21 Max: 129
T: 2 ( 2439) P:99 I:2000 C:1656879 Min: 11 Act: 21 Avg: 21 Max: 104
T: 3 ( 2440) P:99 I:2500 C:1325495 Min: 11 Act: 21 Avg: 22 Max: 97
^Cpi@raspberrypi2 ~/rt-tests $ sudo ./cyclictest --smp -p99 -m -n
/dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 0.00 0.04 0.10 1/91 2519

T: 0 ( 2483) P:99 I:1000 C:3089499 Min: 11 Act: 22 Avg: 25 Max: 1752
T: 1 ( 2484) P:99 I:1500 C:2059650 Min: 10 Act: 18 Avg: 21 Max: 729
T: 2 ( 2485) P:99 I:2000 C:1544729 Min: 11 Act: 22 Avg: 21 Max: 1288
T: 3 ( 2486) P:99 I:2500 C:1235776 Min: 11 Act: 18 Avg: 21 Max: 107
^Cpi@raspberrypi2 ~/rt-tests $ sudo ./cyclictest --smp -p99 -m -n
/dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 0.73 0.63 0.58 1/91 2556

T: 0 ( 2522) P:99 I:1000 C:3038859 Min: 9 Act: 17 Avg: 25 Max: 2005
T: 1 ( 2523) P:99 I:1500 C:2025891 Min: 9 Act: 23 Avg: 22 Max: 176
T: 2 ( 2524) P:99 I:2000 C:1519411 Min: 11 Act: 22 Avg: 22 Max: 511
T: 3 ( 2525) P:99 I:2500 C:1215523 Min: 11 Act: 28 Avg: 21 Max: 152

I’m sure the RT kernel can do much better on the max values, but the average isnt too bad.

Ran on the PI 2 with the rt2 kernel, worked for around 40 mins then the screen went black. (using HDMI without the Navio connected and using a USB keyboard as wifi didnt seem to be functioning). Also noticed the keyboard works when booted but seems to die at some point after starting cyclictest, cpu load from cyclictest also goes from 8.5% to 108% at the same time.

Guys any news for the new kernel?

Well, it’s 99% ready, there is only one thing holding us - unstable work of rt kernel with usb driver on RPi2. The problem is that new RPi’s USB driver uses FIQ and it somehow causes hangs on SMP system under rt preempt, while the standard USB driver doesn’t work on Raspberry Pi 2 at all. I’ve contacted Raspberry Pi Foundation and opened an issue about the standard USB driver, hope we can work something out soon.

I’d like to share the good news - it seems that I’ve been able to fix the USB driver to work with RT kernel on Raspberry Pi 2.
Overnight stability test has been successful.
I will run a couple of additional tests and if it’s okay will publish the kernel and the SD card image.


That is a fantastic news!!! Could you share the kernel as a package (zip/tgz/…) Without the rest of the sd image ?

Thanks a lot… Waiting for the event,


Sure, here’s the rt kernel for Raspberry Pi 2 with modules:

IMPORTANT - add this to the /boot/cmdline.txt:

dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0
1 Like

Sorry for asking a obvious question. I have little experienced with Linux.
How do I make a bootable SD card from this file?

(Do I combine the files with a standard RPi2 image?)

You will have to use a standard RPi2 raspbian image. You boot your RPi2 with it. Then you have to copy the rt kernel over and modify the bootloader to use the new kernel. There are many tutorials about this on the web.
I decided, I just wait for the complete image , because by the time I done all this, the image is probably ready for download.

@ogulbrandsen We are going to post a complete, tested image next week. It would be great if we all use the same image for flying.

The SD card image is almost ready, we’ll do a couple of additional flight tests today and I’ll upload it:)

Hooray! Keep up the good work

Hey guys,

Here’s the SD card image of Raspbian with real-time kernel for Raspberry Pi 2:
emlid-raspberrypi2-raspbian-rt-20150327.img.xz on MEGA

To run APM on it use the code from the navio branch (we’ve added RPi version autodetect in it):

The image is for Raspberry Pi 2 only, do not use it on previous models. Also, do not use deb packet from the docs - currently there’s no support for RPi2. In a few days we will update the deb package and some time later will also update the sd card image to support all Raspberries, so it will be a universal image.

Hi mikhail

Thank you for the RPI2 image.
However, i do get compiling error on Ardupilot branch.

when typing: make configure i get this output.
…/mk/configure.mk:2: WARNING - A /home/pi/ardupilot/config.mk file has been written,
…/mk/configure.mk:2: Please edit the file to match your system configuration.

Any advice?


Its just a notice. Everything should be fine.

I got my rover up and rolling with the RPi2 and APM. Everything is working so far. I could not test it outside today, perhaps I should build a submarine :smile:

Enabling NavEKF still makes the compass go crazy.

What am I missing:

root@navio-rpi:/home/pi# git clone -b navio-rpi2 https://git@github.com/emlid/ardupilot
Cloning into ‘ardupilot’…
remote: Counting objects: 108067, done.
remote: Total 108067 (delta 0), reused 0 (delta 0), pack-reused 108067
Receiving objects: 100% (108067/108067), 55.56 MiB | 362 KiB/s, done.
Resolving deltas: 100% (76283/76283), done.
Checking out files: 100% (2146/2146), done.
root@navio-rpi:/home/pi# cd ardupilot/APMrover2
root@navio-rpi:/home/pi/ardupilot/APMrover2# make configure
…/mk/configure.mk:2: WARNING - A /home/pi/ardupilot/config.mk file has been written
…/mk/configure.mk:2: Please edit the file to match your system configuration, if you use a different board or port
root@navio-rpi:/home/pi/ardupilot/APMrover2# make
…/mk/find_arduino.mk:45: *** ERROR: Cannot find Arduino on this system, please specify on the commandline with ARDUINO= or on the config.mk file. Stop.

‘make navio’