Kenny Posted May 28, 2023 Posted May 28, 2023 Hey folks, im trying to compile a realtime kernel for mt orange pi 5. I plan to use it for djing. A fully preemptive kernel delivers better performance for this, as less xruns appear. I am following the official dev instructions and am using the docker method, Compiling only the kernel, not the entire armbian OS. I copied a realtime patch (actually I tried several sub versions of 5.10) from the kernel.org realtime project site into the userpatches directory (I looked up the correct orange pi 5 subfolder name but forgot it rn) but compiling throws me some errors. Has anyone succeeded in creating a kernel like this for the orange pi 5 and/or could give me any advice for doing so? I actually dont care much about the kernel version, I just need it to be fully preemptive .. Help is much apprecieated! Kenny 0 Quote
royk Posted May 29, 2023 Posted May 29, 2023 Yes I've compiled a few rt kernels and it does work pretty well. To use the legacy kernel you really don't want to patch it yourself, some parts are patched many versions ahead and some parts are left behind. But there luckily is an already by Rockchip rt patched kernel. You only need to use the right config and add the dtb to make it work. I've made a patch for it so you could make your own, a bit messy but works very well (at least for LinuxCNC). https://mega.nz/folder/zhwVyJBK#iWqElAfYL21Rn08PmB55DA You want to use it for music? DJ-ing? It depends on what you exactly need for that, the 5.10.x kernel has a lot of issues with usb audio interfaces, this seems to be fixed since 5.15 or 5.16, my Motu M4 is unusable with it but you could try yours. If you want to use USB audio interface as input and output I recommend to use a newer kernel version, the rt patches over the 6.2 kernel from balbes150 his github did compile without problems, compare the kernel config with the 5.10.x rt kernel but keep the pancsf module. The 6.2 kernel I didn't upload but should have it somewhere laying around. The armbian build system has issues with local versions, the rt patches adds that so you'll need to remove that. Results with the 5.10.x kernel: https://forum.linuxcnc.org/18-computer/48079-can-the-opi5-be-configured-to-run-lcnc?start=170#271679 0 Quote
going Posted May 29, 2023 Posted May 29, 2023 1 час назад, royk сказал: Results with the 5.10.x kernel: Hi. I'll try to clarify. Did you get this result by applying using remote desktop (VNC)? What will be the result if you connect HDMI and the XFCE desktop is installed? 0 Quote
royk Posted May 29, 2023 Posted May 29, 2023 (edited) @going TBH I don't know how he did test it, I assumed he connected a monitor via HDMI. I've never tested it with 4 cores isolated because isolating core 5 and 7 is good enough. This is the result of a test I did with Wayland and xwayland and isolcpus=5,7 (connected with HDMI) https://forum.linuxcnc.org/18-computer/48079-can-the-opi5-be-configured-to-run-lcnc?start=40#268426 With XFCE It shall be around the same but the graphics acceleration will be worse. Without isolating cpus the latency will be around 20 uS With the 6.2 kernel I've tried with XFCE, it worked well, but its hw support is still in progress: https://forum.linuxcnc.org/18-computer/48079-can-the-opi5-be-configured-to-run-lcnc?start=120#270027 A bit off-topic but read someone from this forum was busy creating a rt-kernel for a s922 sbc, the s9xx kernel did also work fine for a s912 tv-box (connected with HDMI): https://forum.linuxcnc.org/18-computer/39371-results-of-latency-test-list-of-computers-tested-for-use-with-linuxcnc?start=330#270625 Edited May 29, 2023 by royk 0 Quote
going Posted May 29, 2023 Posted May 29, 2023 @royk I already realized that this is not your snapshot of the test. I am reading this post listed in the link. Rod wrote about my repository. This is currently in development and not finished. In the final version, this branch will collect an image with a real-time kernel and linuxcnc + a certain number of libraries and settings necessary for work. All in one build system. When I am ready, I will join your company on the linuxcnc forum. 1 час назад, royk сказал: work fine for a s912 tv-box (connected with HDMI): https://forum.linuxcnc.org/18-computer/39371-results-of-latency-test-list-of-computers-tested-for-use-with-linuxcnc?start=330#270625 It looks like the truth. 1 Quote
ichigonitro Posted October 13, 2023 Posted October 13, 2023 I know this post is a couple months old and on the OPI5 it says it detects the SD card and all other drivers fine but it doesnt see the system partition or a kernal (if its not already installed...?) But when i try to install it via Etcher (BelenaEtcher as recommended) it says that a file doesnt match the file required to install, what file am i missing? And how do i build it? 0 Quote
royk Posted October 13, 2023 Posted October 13, 2023 (edited) @ichigonitro The easiest way will be to install the kernel deb package on a working system. Here is the latest build which work still perfectly for months with LinuxCNC. With this build I made a patch from the difference of the RT branch and rk3588 branch till the date of the latest change on the rt branch. Applied that patch to the kernel source of Xunlong (didn't work with the more updated kernels). https://mega.nz/folder/znBVHJ4Z#69huCvInrf3tqc8I4QR-lQ I don't know for what you'll use it for, but LinuxCNC seems to run best with the kernel arg: isolcpus=5,7 And had to move the ethernet irqs with the use of an ethernet controller. cat /proc/interrupts to see the irqs, then add to /etc/rc.local before 'exit 0' : sleep 10 && echo 20 | tee /proc/irq/82/smp_affinity && echo 20 | tee /proc/irq/81/smp_affinity 20= cpu5. cpu number binary: 00100000 (first number=cpu7 and last number= cpu0) to hex. 81 and 82 are the irq numbers of the device moved to the isolated core. You can build it yourself too if you want to with the config/patch in the zip, but you'll need to change some of the (folder) names. rk35xx armbian-build-rt (2).zip Edited October 14, 2023 by royk 0 Quote
johnwoo1999 Posted October 30, 2023 Posted October 30, 2023 @royk Excuse me, I noticed that you've successfully created a RT image, which is something I'm very interested in. Would you be willing to guide me through the process? I would like to learn how to do it myself and would really appreciate your expertise. 0 Quote
royk Posted October 30, 2023 Posted October 30, 2023 @johnwoo1999 I'm not an expert, and I don't know what you've already tried. But I've just been experimenting a lot until the results were good. On the GitHub of Rockchip there is a 5.10-rt53 branch which is the one with the RT patches included and a working rt config: https://github.com/rockchip-linux/kernel/tree/develop-5.10-rt53 But because that branch hasn't been updated since august 2022, I made a patch out of the diff of the rt branch and develop-5.10 branch till the same date. This resulted in a RT patch set. The patch is applicable to the 5.10.110 kernel, so I used the kernel source of Xunlong for it. So to build it with Armbian you'll need to edit the source and place the config and patch in the right directory. In the Armbian build system a few folder/file names have been changed in the meantime so you'll need to edit these accordingly. 0 Quote
Mr.Tree Posted October 14 Posted October 14 @royk I want to compile an RT version for another rockchip kernel. I would like to ask what steps you have completed before it works. 0 Quote
royk Posted October 14 Posted October 14 (edited) @Mr.Tree Depending on the kernel version. For 5.10.160 there is a rt patched source on the GitHub of Orange Pi, for 6.1.75 you could patch the source of the GitHub of Armbian but the rejected needs to be done manual or 6.11 you could patch as usual but misses some features on the rk3588. From 6.12 rt is mainline so only the right configuration will be necessary. Some of I've compiled you can find here with config, the 6.1.75 is with the rt patched source https://drive.google.com/drive/folders/1JglCIPKvyFwviAEmfyAsL1SmroZcjOvr?usp=drive_link So adding the drivers for your board should be sufficient. The only thing I found out was when I was making a Deb package, somehow the kernel image was compressed and gave an missing arm64 magic error. Simply decompressing solves it. For which board? Edited October 14 by royk 0 Quote
pines Posted October 23 Posted October 23 (edited) @royk thank your information. I download 5.10.160 branch with PREEMPT_RT feature. when compiling kernel, it throw a error for certs fold Make error. No future information even i set KBUILD_VERBOSE=1. and only few file under kernel/certs/* been compiled into *.o. Have you experience this issue. thanks for your time. I think i figure it out. wrong settings in .config relate to certs Edited October 23 by Pine Li 1 Quote
pines Posted October 24 Posted October 24 @royk Hello, me again. would you share the .config with me. for build 5.10.160 preempt kernel. 0 Quote
royk Posted October 24 Posted October 24 @Pine Li You can find the config in the deb file in the boot folder. 1 Quote
pines Posted October 30 Posted October 30 @royk Hi royk, one more question. have you ever experience kernel crash. with 5.10.160 rt-patched. I have seen crash when booting, or running cyclictest. not very offten, but it happened when you testing a lot. 0 Quote
royk Posted October 30 Posted October 30 @Pine Li No I didn't, perhaps it's without thermal limit and it overheats? I had it running continuously for months without issues. Isolating core 5 and 7 and the realtime task on core 7 gave the best result with LinuxCNC. With the 6.1.75 kernel only isolating core 7 is sufficient. I think that the 6.1.75 kernel is better either way. For USB audio the 5.10 kernel gives a lot of (known) problems too. In case you had problems with booting from nvme with the 6.1.75 kernel, Igor pointed to a (revert) commit that created that problem, removing that solves it. 0 Quote
pines Posted October 31 Posted October 31 @royk I made some changes by disabling certain drivers in the DTSI (audio, Ethernet, etc.). After testing, the kernel is no longer crashing. Now, I am re-enabling the drivers one by one to see if I can identify which one is causing the issue. Your reply has helped me narrow down the problem. Thank you. 1 Quote
going Posted October 31 Posted October 31 2 часа назад, Pine Li сказал: I made some changes by disabling certain drivers in the DTSI (audio, Ethernet, etc.). After testing, the kernel is no longer crashing. Now, I am re-enabling the drivers one by one to see if I can identify which one is causing the issue. Your reply has helped me narrow down the problem. Will you be able to post here, under spoiler, a list of files that are being modified by your RT PREEMPT patch? I mean the output of the "lsdiff" command. 0 Quote
pines Posted October 31 Posted October 31 (edited) sorry, didn't descript it clear in previous post. I did not make much change on RT PREEMPT path. mostly modification done with DTSI. I got some custom driver. something standard orangepi 5b don't have. turn out the extra-driver causing problem. I just disabling all drivers add by me. Edited October 31 by pines 0 Quote
going Posted October 31 Posted October 31 1 час назад, pines сказал: sorry, didn't descript it clear in previous post. I did not make much change on RT PREEMPT path. mostly modification done with DTSI. I got some custom driver. something standard orangepi 5b don't have. turn out the extra-driver causing problem. I just disabling all drivers add by me. Good. I think I got it. You have already taken a ready-made rt core. Using the headers to this kernel, you compiled several drivers and got a kernel panic when running the test. Did I understand correctly? If this is the case, then it will be quite difficult for me to give any advice. I usually use full control. Build the kernel yourself. Preliminary application of patches. If there are problems with the kernel, then add a trace function. With respect. 0 Quote
Mr.Tree Posted Monday at 08:39 AM Posted Monday at 08:39 AM (edited) On 10/14/2024 at 2:18 PM, royk said: @Mr.Tree Depending on the kernel version. For 5.10.160 there is a rt patched source on the GitHub of Orange Pi, for 6.1.75 you could patch the source of the GitHub of Armbian but the rejected needs to be done manual or 6.11 you could patch as usual but misses some features on the rk3588. From 6.12 rt is mainline so only the right configuration will be necessary. Some of I've compiled you can find here with config, the 6.1.75 is with the rt patched source https://drive.google.com/drive/folders/1JglCIPKvyFwviAEmfyAsL1SmroZcjOvr?usp=drive_link So adding the drivers for your board should be sufficient. The only thing I found out was when I was making a Deb package, somehow the kernel image was compressed and gave an missing arm64 magic error. Simply decompressing solves it. For which board? @royk I'm sorry I missed your reply, thank you very much for your reply, I haven't continued to study the RT kernel recently. The 6.12 kernel mainline began to support the RT kernel, which is great for us! Edited Monday at 08:40 AM by Mr.Tree 0 Quote
royk Posted Tuesday at 07:50 AM Posted Tuesday at 07:50 AM @Mr.Tree Yes you can find the compiled one also on the OneDrive. If your application checks /sys/kernel/realtime you'll need a small patch from 6.12 which you can also find on the OneDrive. But it needs the following config: - CRASH_DUMP [=y] && ARCH_SUPPORTS_CRASH_DUMP [=y] && KEXEC_CORE [=y] - PROC_KCORE [=y] && PROC_FS [=y] && MMU [=y] 0 Quote
Mr.Tree Posted Thursday at 03:23 AM Posted Thursday at 03:23 AM @royk OK, I'll try this, Thank you very much! 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.