====== Raspberry PI4 ====== ===== Overclock ===== echo "force_turbo=1 over_voltage=8 arm_freq=2147 gpu_freq=750" >> /boot/config.txt ===== Matlab x86/amd64 binary auf raspberry ausfuehren ===== Getestet mit Matlab 2023a auf raspbian lite 64bit. ==== Mittels debootstrap eine amd64 Umgebung erstellen ==== apt-get update apt-get -y install qemu-user qemu-user-static binfmt-support debootstrap binutils mkdir emu debootstrap --foreign --arch amd64 bookworm emu http://deb.debian.org/debian/ cp /etc/passwd emu/etc/passwd ==== chroot.sh ==== #!/bin/bash set -x dir=/home/pi/emu mount -t sysfs /sys $dir/sys/ mount -t proc /proc $dir/proc/ mount --bind /dev $dir/dev/ #mount --bind /dev/pts $dir/dev/pts/ mount --bind /dev/shm $dir/dev/shm/ chroot $dir /bin/bash ==== Abhaengigkeiten in chroot installieren ==== ./chroot.sh apt-get update apt-get -y install unzip gawk libgl-dev libxt6 ==== MCR 9.14 in chroot installieren ==== mkdir mcr cd mcr wget "https://ssd.mathworks.com/supportfiles/downloads/R2023a/Release/6/deployment_files/installer/complete/glnxa64/MATLAB_Runtime_R2023a_Update_6_glnxa64.zip" unzip MATLAB_Runtime_R2023a_Update_6_glnxa64.zip ./install -agreeToLicense yes ==== /etc/bash.bashrc ==== In chroot folgendes hinzufuegen: export LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Runtime/R2023a/runtime/glnxa64/:/usr/local/MATLAB/MATLAB_Runtime/R2023a/bin/glnxa64/ ==== Matlab compiled binary ausfuehren ==== file hello hello: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=7e3a0e581d7a55241b73ca61c144529927a9b93e, stripped root@raspberrypi:/# ./hello Hello World! ===== RT Kernel ===== - git clone https://github.com/raspberrypi/linux.git sudo apt install crossbuild-essential-armhf - [[https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/|Hier]] schauen was der sinnvoll neueste RT Patch ist. Aktuell war es 5.10.90. Diesen herunterladen - git log und dort nach "5.10.90" suchen. Beispiel: commit d3e491a20d152e5fba6c02a38916d63f982d98a5 Author: Greg Kroah-Hartman Date: Wed Jan 5 12:40:34 2022 +0100 Linux 5.10.90 Link: https://lore.kernel.org/r/20220103142053.466768714@linuxfoundation.org Tested-by: Salvatore Bonaccorso Tested-by: Guenter Roeck Tested-by: Linux Kernel Functional Testing Tested-by: Jon Hunter Link: https://lore.kernel.org/r/20220104073841.681360658@linuxfoundation.org Tested-by: Jon Hunter Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Shuah Khan Tested-by: Linux Kernel Functional Testing Tested-by: Sudip Mukherjee Tested-by: Salvatore Bonaccorso Signed-off-by: Greg Kroah-Hartman Datum merken. - Naechsten commit suchen, der arch/arm/config/bcm2711_defconfig enthaelt suchen und den auschecken. - RT Patch anwenden: wget "https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.10/patch-5.10.90-rt60.patch.xz" xzcat patch-5.10.90-rt60.patch.xz | patch -p1 - Konfigurieren: cd linux KERNEL=kernel7l make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig - In menuconfig "fully preemptible" einschalten: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig - Bauen: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j24 - Installieren: mkdir mnt mkdir mnt/fat32 mkdir mnt/ext4 sudo mount /dev/sdb1 mnt/fat32 sudo mount /dev/sdb2 mnt/ext4 sudo env PATH=$PATH make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img sudo cp arch/arm/boot/zImage mnt/fat32/$KERNEL.img sudo cp arch/arm/boot/dts/*.dtb mnt/fat32/ sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/ sudo cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/ sudo umount mnt/fat32 sudo umount mnt/ext4 ===== IRQ Prioritaeten ===== - in /boot/cmdline.txt "threadirqsi" hinzufuegen. - apt-get install rtirq-init - In /etc/default/rtirq RTIRQ_NAME_LIST="74 73" editieren und RTIRQ_RESET_ALL=1 einschalten. ===== Cores isolieren ===== - in /boot/cmdline.txt "isolcpus=2,3" hinzufuegen. - Tasks bspw. mit taskset --cpu-list 2-3 [TASK} starten ===== Image von /boot ===== * {{ :it:linux:raspi_4_boot_5.10.90_rt60_220203.tar.gz |}} * {{ :it:linux:kernel_6.4.6-rt8-v8_.tar.gz |}} ===== Links ===== - [[https://www.raspberrypi.com/documentation/computers/linux_kernel.html]] - [[https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/preemptrt_setup]]