Raspberry PI4 - Realtime-Kernel
14.07.2019
Part2: How to compile LinCNC on a RASPI 4
How to install a realtime kernel on a raspberry PI model 4B
(update-hints 16.07.2019)
install stock kernel 4.19.50 on PI4 !!!
get the source of this kernel
sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update
wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source
/usr/bin/rpi-source -q --tag-update
get the kernel-source
/usr/bin/rpi-source
-------------------------------
*** Using: /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz
*** Latest firmware revision: 88ca9081f5e51cdedd16d5dbc85ed12a25123201
*** Linux source commit: 883a1a5bf14abc9b3a014a3907772cd0b3129c8a
*** Download kernel source
--2019-07-15 19:16:55-- https://github.com/raspberrypi/linux/archive/883a1a5bf14abc9b3a014a3907772cd0b3129c8a.tar.gz
Auflösen des Hostnamens github.com (github.com)… 140.82.118.3
Verbindungsaufbau zu github.com (github.com)|140.82.118.3|:443 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 302 Found
Platz: https://codeload.github.com/raspberrypi/linux/tar.gz/883a1a5bf14abc9b3a014a3907772cd0b3129c8a [folgend]
--------------------------------
and you will get
linux-883a1a5bf14abc9b3a014a3907772cd0b3129c8a.tar.gz
you may also get this file with:
wget https://codeload.github.com/raspberrypi/linux/tar.gz/883a1a5bf14abc9b3a014a3907772cd0b3129c8a
unzip file
linux-883a1a5bf14abc9b3a014a3907772cd0b3129c8a.tar.gz
cd linux-883a1a5bf14abc9b3a014a3907772cd0b3129c8a
compile and install this kernel
KERNEL=kernel7l
make bcm2711_defconfig
make -j4 zImage modules 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
reboot and test this kernel:
Linux raspberrypi 4.19.50-v7l+ #1 SMP Sat Jul 13 07:11:29 BST 2019 armv7l GNU/Linux
get RT-patch for this kernel:
https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.19/patch-4.19.50-rt22.patch.xz
patch the kernel:
xzcat patch-4.19.50-rt22.patch.xz | patch -p1
make oldconfig
and compile and install the patched kernel:
make -j4 zImage modules 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
reboot and test the RT-kernel:
Linux raspberrypi 4.19.50-rt22-v7l+ #2 SMP PREEMPT RT Sat Jul 13 09:21:03 BST 2019 armv7l GNU/Linux
you're done.....
if I have forgotten something drop me a mail: wicki@erste.de
results of latnecy-tests:
PI4 - while compiling a kernel-source
Linux raspberrypi 4.19.50-rt22-v7l+ #2 SMP PREEMPT RT Sat Jul 13
09:21:03 BST 2019 armv7l GNU/Linux
T: 0 ( 1079) P:99 I:1000 C: 77229 Min: 6 Act: 17 Avg: 14 Max: 51
T: 1 ( 1080) P:99 I:1500 C: 51486 Min: 6 Act: 22 Avg: 14 Max: 75
T: 2 ( 1081) P:99 I:2000 C: 38614 Min: 6 Act: 22 Avg: 16 Max: 64
T: 3 ( 1082) P:99 I:2500 C: 30891 Min: 6 Act: 18 Avg: 16 Max: 46
same test with a PI3 - while idle
Linux cerec 4.4.4-rt9-v7+ #7 SMP PREEMPT RT Mon Mar 7 14:53:11 UTC 2016
armv7l GNU/Linux
T: 0 ( 1121) P:99 I:1000 C: 66259 Min: 10 Act: 11 Avg: 17 Max: 101
T: 1 ( 1122) P:99 I:1500 C: 44173 Min: 10 Act: 11 Avg: 14 Max: 92
T: 2 ( 1123) P:99 I:2000 C: 33129 Min: 11 Act: 12 Avg: 13 Max: 42
T: 3 ( 1124) P:99 I:2500 C: 26503 Min: 10 Act: 11 Avg: 13 Max: 49
LinCNC latency-test PI3 (top) vs. PI4 (bottom) while systems are idle.
Packages I installed before compiling linuxcnc
sudo apt-get install autoconf
sudo apt-get install cython
sudo apt-get install glib
sudo apt-get install glibc
sudo apt-get install glibc2
sudo apt-get install glib-networking-common
sudo apt-get install gtk2
sudo apt-get install intltool
sudo apt-get install intltool-extract
sudo apt-get install libczmq
sudo apt-get install libczmq3
sudo apt-get install libczmq3-dev
sudo apt-get install libczmq4
sudo apt-get install libczmq-dev
sudo apt-get install libglib
sudo apt-get install libglib2.0
sudo apt-get install libglibmm
sudo apt-get install libglib-perl
sudo apt-get install libgtk2.0-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libncurses-dev
sudo apt-get install libpng-devel
sudo apt-get install libpng++-dev libpng-dev
sudo apt-get install libpng-tools libpng12-dev libpnglite-dev libpnglite0 tkpng
sudo apt-get install libreadline-gplv2-dev
sudo apt-get install libsystemd-dev
sudo apt-get install libtcl
sudo apt-get install libtcl8.6
sudo apt-get install libtcl8.6 8.6.9+dfsg-2
sudo apt-get install libtcl8.6.9+dfsg-2
sudo apt-get install libtk-img
sudo apt-get install libtk-img-dev
sudo apt-get install libudev-dev
sudo apt-get install linuxcnc
sudo apt-get install locate
sudo apt-get install locatedb
sudo apt-get install mc vim
sudo apt-get install package uuid-runtime
sudo apt-get install python-yapps python3-yapps yapps2
sudo apt-get install tcl
sudo apt-get install tclx
sudo apt-get install uuid-runtime
sudo apt-get install yapps
sudo apt-get install yapps2
sudo apt-get install yapps-dev
sudo apt-get install yapps-devel
sudo apt-get install debhelper libpth-dev dvipng tcl8.4-dev tk8.4-dev bwidget blt libxaw7-dev libncurses-dev libreadline-dev asciidoc source-highlight dblatex groff python-dev python-tk libglu1-mesa-dev libgl1-mesa-dev libgtk2.0-dev gettext autoconf libboost-python-dev
sudo apt-get install git bc bison flex libssl-dev
sudo apt-get install glibc
sudo apt-get install glibc-source
sudo apt-get install libmodbus-dev
sudo apt-get install libtk-img
sudo apt-get install libudev-dev
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libreadline-gplv2-dev
sudo apt-get install mesa-utils
compile linuxcnc
cd src
./autoconf.sh
./configure
make
this may take about half an hour....
sudo make setuid
start it......
Latency PI4 - 3 glxgears
20.07.2019 - BCM2855-library will nicht
bcm2835_init: gpio mmap failed: Cannot allocate memory
Unable to init bcm2835.
ist die neuste version der bc2835
http://www.airspayce.com/mikem/bcm2835/
hat vermutlich mit /proc/device-tree/soc/ranges zu tun....
so bekommt man sie provisorisch zum laufen:
bcm2835_peripherals_base = 0xfe000000;
bcm2835_peripherals_size = 16777216;
statisch in bcm2835.c verdrahten - dann gehts auch mit dem PI4.
(aber dann nur mit dem PI4, nehme ich an)