twobob
Posts: 6
Joined: Mon Jun 02, 2014 2:30 pm

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Sun Jun 08, 2014 1:45 pm

Aye all good advice.

However having spent many days in the past faffing around with the "wrong" files on other projects it would be nice to know that I am at least starting with the right ones :)

Thanks for the feedback, I read the entire thread again just in case I missed something.

clouded
Posts: 14
Joined: Mon May 12, 2014 8:02 am

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Wed Jan 21, 2015 3:17 pm

Hello realtimers,

I build kernels with PREEMPT_RT from time to time and just built the fresh one a couple of days ago - 3.12.36-rt50+.
Links to sources, kernel and SD image are provided below.
Cyclictest results: #Min: 00011uS #Avg: 00023uS #Max: 00066uS

Raspberry Pi linux kernel source patched with rt-patch and config for PREEMPT_RT:
https://github.com/emlid/linux-rt-rpi

Standalone Raspberry Pi linux kernel with modules version 3.12.36-rt50+:
https://mega.co.nz/#!YNRV3RzL!Zvj6-2E8P ... YxYPM5vC5Q

SD card image based on 2014-12-24 Raspbian with 3.12.36-rt50+ kernel and few modifications:
https://mega.co.nz/#!UMZRkJ6Z!4uJF3UTsa ... wIW7Q9WlSc

More information about the image can be found at http://www.emlid.com/new-raspbian-with- ... -jan-2015/.

clouded
Posts: 14
Joined: Mon May 12, 2014 8:02 am

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Fri Feb 27, 2015 3:05 pm

Hi everyone,

I tried the new 3.18 rt kernels for Raspberry Pi A+\B+ as well as new Raspberry Pi 2.

Kernel for Raspberry Pi A+\B+ seems to work okay.

Kernel for Raspberry Pi 2 has a problem - it freezes without any message (even with debug information enabled) when some process is run on cpu0 with priority <= -51, which is probably caused by the FIQ USB driver. Non-FIQ USB driver does not boot with an error.

If anyone wants to play with rt kernels for old and new RPis here's the patched source code with configs for rt - https://github.com/Clouded/linux-rt-rpi2

clouded
Posts: 14
Joined: Mon May 12, 2014 8:02 am

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Mon Mar 30, 2015 10:58 am

I was able to solve the issue that prevented booting with the non-FIQ USB driver. It required the following fix:
https://github.com/Clouded/linux-rt-rpi ... 71a99b283a

Now it is possible to boot with the non-FIQ USB driver by adding these options to the /boot/cmdline.txt :
dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0

Compiled PREEMPT_RT kernel 3.18 for Raspberry Pi 2 can be downloaded here:
https://mega.co.nz/#!NBhBCSDJ!KSQm9OKU9 ... yexdcg6N1I

Patched source code is available here:
https://github.com/Clouded/linux-rt-rpi2

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Tue Mar 31, 2015 11:26 am

clouded wrote:I was able to solve the issue that prevented booting with the non-FIQ USB driver. It required the following fix:
https://github.com/Clouded/linux-rt-rpi ... 71a99b283a

Now it is possible to boot with the non-FIQ USB driver by adding these options to the /boot/cmdline.txt :
dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0

Compiled PREEMPT_RT kernel 3.18 for Raspberry Pi 2 can be downloaded here:
https://mega.co.nz/#!NBhBCSDJ!KSQm9OKU9 ... yexdcg6N1I

Patched source code is available here:
https://github.com/Clouded/linux-rt-rpi2
Interesting, have you got details of your kernel config?

I compiled for rpi2 with full RT_PREEMPT about a month ago the patch applied totally clean and the kernel booted without problem or error. The cyclictest results (max about 150 min 15us, though my memory is probably a bit poor so could be different) were only marginally better than for a rpi1, but the system never showed any error.

Also what are the cyclictest results with your patched kernel?

PabloGN
Posts: 1
Joined: Fri Feb 12, 2016 6:55 pm

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Mon Feb 15, 2016 12:12 am

Hi people.

I didn't found your work before starting the work I describe in http://www.ehu.eus/ehusfera/pablogn/201 ... berry-sbc/

It is a very easy way of kernel building (thanks to Hypriot guys), and it behaves well until stressed with cyclictest and commands like

Code: Select all

ssh user@desktop cat /dev/zero | dd of=/dev/null 
Would you tell me the way to configure? It's maybe the soft irqs, maybe the parameters for cyclictest.
mung wrote:
clouded wrote:I was able to solve the issue that prevented booting with the non-FIQ USB driver. It required the following fix:
https://github.com/Clouded/linux-rt-rpi ... 71a99b283a

Now it is possible to boot with the non-FIQ USB driver by adding these options to the /boot/cmdline.txt :
dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0

Compiled PREEMPT_RT kernel 3.18 for Raspberry Pi 2 can be downloaded here:
https://mega.co.nz/#!NBhBCSDJ!KSQm9OKU9 ... yexdcg6N1I

Patched source code is available here:
https://github.com/Clouded/linux-rt-rpi2
Interesting, have you got details of your kernel config?

I compiled for rpi2 with full RT_PREEMPT about a month ago the patch applied totally clean and the kernel booted without problem or error. The cyclictest results (max about 150 min 15us, though my memory is probably a bit poor so could be different) were only marginally better than for a rpi1, but the system never showed any error.

Also what are the cyclictest results with your patched kernel?

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Mon Mar 07, 2016 3:10 pm

I have patched 4.4 kernels for RPi1/2 available here.

To install for RPi2:

Code: Select all

apt-key adv --keyserver hkp://keys.gnupg.net --recv-key 43DDF224
echo "deb http://deb.machinekit.io/debian raspbian main" > /etc/apt/sources.list.d/machinekit.list
apt-get update
apt-get install -y linux-image-rpi2-rt
cd /boot
echo kernel=$(ls kernel_rt*.img) >> config.txt
echo device_tree=dtbs_rt/bcm2709-rpi-2-b.dtb >> config.txt
For RPi v1, use

Code: Select all

apt-get install -y linux-image-rpi-rt
and adjust device_tree accordingly.

Don't forget to append the following entries to /boot/cmdline.txt:

Code: Select all

dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0
Sources are located here.

Cheers

Update:
- fixed device_tree entry
Last edited by kinsa on Sun May 15, 2016 3:16 pm, edited 1 time in total.
42

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Sat Mar 12, 2016 11:31 am

BTW, linux 4.4 needs an updated bootloader, do:

Code: Select all

sudo apt-get update
sudo apt-get install -y raspberrypi-bootloader
42

DaveO16
Posts: 3
Joined: Sat May 07, 2016 5:26 pm

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Sat May 07, 2016 5:30 pm

I've followed these steps with a B+ "Raspberry Pi Model B+ V1.2", ammending dtoverlay in config.txt to
dtoverlay=dtbs_rt/bcm2708-rpi-b-plus.dtb

When I reboot I get a rainbow screen.

if I comment out the "new" kernel in config.txt all is OK.

The image I've installed this on is the most recent.

How do I debug this?

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Sat May 07, 2016 11:48 pm

Can you post your config.txt?
42

cjan
Posts: 843
Joined: Sun May 06, 2012 12:00 am

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Sun May 08, 2016 1:04 am

supported 4.4, does it mean 4.4.1~x ?

DaveO16
Posts: 3
Joined: Sat May 07, 2016 5:26 pm

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Mon May 09, 2016 12:58 pm

kinsa wrote:Can you post your config.txt?
Yup, absolutely... thank you for being willing to help...

Code: Select all

$ cat /cygdrive/e/config.txt
# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=17

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
arm_freq=900

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
core_freq=250
sdram_freq=450
over_voltage=2
kernel=kernel_rt-4.4.4-rt9+.img
dtoverlay=dtbs_rt/bcm2708-rpi-b-plus.dtb

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2945
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Mon May 09, 2016 2:04 pm

This looks wrong:

Code: Select all

dtoverlay=dtbs_rt/bcm2708-rpi-b-plus.dtb
The file is named like a base DTB file (a complete description of the common hardware for a board) but you are loading it like an overlay (a patch to modify a base DTB).

Try this:

Code: Select all

device_tree=dtbs_rt/bcm2708-rpi-b-plus.dtb

DaveO16
Posts: 3
Joined: Sat May 07, 2016 5:26 pm

Re: CONFIG_PREEMPT_RT on Raspberry Pi

Thu May 12, 2016 10:14 am

That worked... time to learn about PREEMPT_RT!

Thank you!

Return to “Advanced users”