Can the OPI5 be Configured to Run LCNC?

More
28 Mar 2023 20:37 #267728 by royka
That's correct, you can't dd write that image, that's why I wrote that there is a tool with the image to write it to the sd.
Now I understand a bit more how the system works I'll look for an easier way to create a system with that rt kernel when I've time for it. I hope in a few day.

Please Log in or Create an account to join the conversation.

More
28 Mar 2023 22:43 #267736 by Guglielmi
Hi royka, it seems you did a great work with Orange PI 5. I'm struggling to make it working.. I'm not sure to understand the instruction you posted.
The image here drive.google.com/drive/folders/1tlyMGSqB...yWGSXBo6CVWPw7jkJ0sy
seems corrupted to me, I mean creating SD cart it doesn't boot and even opening the image with 7zip it fails.
Can you share a image where the RT patch is already installed? I did several tentatives with version 5.10.176, 5.10.109, no one was working. Thanks for help.
Bye
Andrea

Please Log in or Create an account to join the conversation.

More
28 Mar 2023 23:22 - 28 Mar 2023 23:27 #267740 by royka
I see they've now added another tool than before. You could extract the image rkdevtool. In the folder "Output/Android/image/" you'll see the images rootfs.img and boot.img.
If you're not able to make this work, I'll see if I could make a working image for the opi-5, but it could maybe take a few days because I'm busy at the moment.

To explain some things to hopefully make some things a bit clear:
Opi-5 has a spi-flash (/dev/mtdblock0) for the u-boot, the default u-boot from opi and armbian could only load the bootloader from an ext2 or fat16 partition.
The bootloader needs to be on the first partition. Balbes150 on the armbian forum however has just made some images with an u-boot that could also boot from usb and ext4 partitions.
The u-boot could also be written on the first "free" 16mb of a sd-card, when you've inserted a sd-card with u-boot it will load that u-boot.

I think at the moment the easiest way to install this, is to use the u-boot created by balbes150 for the opi-5. You could install this by dd this u-boot image from /usr/lib/linux-u-boot-current-orangepi5_23.02.3_arm64/rkspi_loader.img to mtdblock0. Or you could write his armbian image to a sd-card and boot from it, then type sudo armbian-install and choose to install the bootloader to MTD flash.
Then you could write the rootfs image to a sd/usb/nvme and mount and copy the files from boot.img to /boot. Then you'll need to copy the Opi-5 dtb. In extlinux.conf edit the locations to /boot and change the name for the dtb.
Edit the UUID in extlinux.conf and /etc/fstab.
The UUID you'll see with "blkid"
Last edit: 28 Mar 2023 23:27 by royka.
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
29 Mar 2023 20:53 - 29 Mar 2023 20:55 #267860 by Guglielmi
Thanks, I have now more input on what I have to investigate.

What still not fully clear to me is:

1) the above procedure basically is important to install OS on internal memory if I'm not wrong
2) I'm successfully working with all OS available (armbian, ubuntu, debian..) booting from SD card, as I use to do in Rpi.. so I can imagine is more fast with internal memory etc.. but as first step I simply would like to have LinuxCNC working on my Orange PI5 as my RPI4 today does, so my issue is to patch with RT the OS
3) why is so important follow steps you suggested when I'm not able to patch the OS or even find a IMG where RT is already installed? For example I have now running a SD RebornOS but I don't have any image patched RT.. I don't feel installing ubuntu or debian helps.. What I have lost?

Sorry but I'm not so confident with Linux..
:-(

Thanks
Last edit: 29 Mar 2023 20:55 by Guglielmi.

Please Log in or Create an account to join the conversation.

More
30 Mar 2023 08:17 - 30 Mar 2023 08:22 #267893 by rodw
Its meant to be possible to build a preempt_rt system with the Armbian build environment but it is broken. One of the Armbian developers has been helping me with the Odorid N2+ and has forked and possibly fixed the environment.

I can’t guarantee that this will work but you guys with the OPI might be able to join in here as my friend Leo is working on the sunxi chip but the OPI 5 is on a Rockchip

But try this on a host PC running a VM or linux debian or ubuntu.
git clone https://github.com/The-going/armbian-build -b pbs-master
Build the userpatches folder and set up the build environment. The settings here are not important, we just need to set up the environment, don’t try and build an image or add a GUI as it will take forever.
cd armbian-build
./compile.sh EXPERT=”yes”
Select EDGE, Debian Bookworm, build the kernel. It should show up in /output/debs
Now copy the attached .config file into the userpatches folder which has been created. (remove the .txt suffix)
Now lets try and build a minimal cli image. This is a 3 step process. Only proceed to the next step if things don’t fail
./compile.sh NAME BUILD_ONLY="default"
./compile.sh NAME BUILD_ONLY="kernel"
./compile.sh NAME BUILD_ONLY="bootstrap"
There is a high probability that you will need to add patches etc to build PREEMPT_RT.
If this works by some fluke, you will have an .img file under /output/images
Use Balena etcher to burn it to an SD card. Don’t use a HDD or eMMC.
Boot the SD card on your OPI5 and cross your fingers.
After a few questions, you should end up with a system with a text only cli as root.
Check that you have preempt_rt
uname -v
If you do get this far, we need to check that we truly have a RT kernel as sometimes I had this but RT was not there. Install the Real Time tests.
apt install rt-tests
cyclictest -t -p80 -i10000 (must run as root or sudo)
The numbers should be bouncing around, not static. This is another latency test and should give similar results to the linuxcnc tools

Ok if you got this far, we need a graphical environment and linuxcnc!
apt install task-xfce-desktop firefox-esr linuxcnc-uspace linuxcnc-uspace-dev mesaflash geany
Reboot and you should be able to login to Debian Bookworm.
So if this worked, time to play with isolcpus. This is done by adding an extra line to boot/armbianEnv.txt
sudo geany /boot/armbianEnv.txt
You might need to experiment here. On my 6 core device, I added isolcpus=2,3,4,5 to get best results.
You have 8 cores
At the end add:
extraargs=isolcpus=2,3,4,5,6,7
If the system hangs, you can place the SD card back into your host device, open as root and edit the file. If you have altered your isolcpus, you need to reflect that in cyclictest parameters. Eg
sudo cyclictest -a 2-5 -t -p80 -i10000

Now if you get this far I will be seriously amazed…. And you will need to roll up your sleeves to debug the process.
Attachments:
Last edit: 30 Mar 2023 08:22 by rodw.

Please Log in or Create an account to join the conversation.

More
30 Mar 2023 11:23 #267903 by Guglielmi
Thanks a lot rodw.
I understand to overall flow but honestly it's hard to follow due to lack of knowledge my side.
I never give up.. I have patient, so.. let's go!
I don't wat to stress you too much but I need your help to reach the goal.. do you have time&patient?
In case, I'm open to share the final result, maybe a image for Orange PI 5 with LinuxCNC installed. The board is really promising by specs.
Just for your info, I have a working RPI4 on my cnc, I'm happy, so I don't have really pressure on close this project.
Now.. some basic questions:
1) "the going armbian build" means the main branch of armbian? I found this documentations, can I follow this?  Buinding Armbian
I will mix your suggestions with these instructions..
2) RT Patch: I did many tenetatives already following this instruction:  Patch RT
should I do the same? I tried with version 5.10.176, 5.10.109.. the orginal version of Orange PI 5 is 5.10.110. In this case, with patch should I apply for armbian main branch?

In meanwhile, I will start the first tentative..
Thanks
Andrea
 

Please Log in or Create an account to join the conversation.

More
31 Mar 2023 01:11 - 31 Mar 2023 01:12 #267946 by royka
The Rockchip kernel is there own creation, it's a mess, so impossible to patch with the rt patches without manually edit most of them.
The mainline kernel does not have the opi-5 dtb yet and a lot still doesn't work.
gitlab.collabora.com/hardware-enablement...n/mainline-status.md

I've tried quick to make rt kernel work with RebornOS but did not succeed. RebornOS couldn't read the initramfs, using the original one didn't work. It is possible to edit it but I found out that RebornOS has Panfork installed by default and this doesn't work with the rt kernel because of a config option and there is no source to recompile. So too much hassle to try.
I've installed the image with rt kernel and compiled LinuxCNC. Even without isolating CPU's the latency is under 25us while opening a browser watch YouTube and glxgears. From my previous experience isolating cpu 5 and 7 will bring it a lot further down, isolating more won't do a lot and makes the system as slow as the rpi4.

The only downside is there is no video hw acceleration, but it still does ok without. If you would like to try I could upload an image.
Last edit: 31 Mar 2023 01:12 by royka.
The following user(s) said Thank You: Guglielmi

Please Log in or Create an account to join the conversation.

More
31 Mar 2023 02:53 #267947 by rodw

Thanks a lot rodw.
I understand to overall flow but honestly it's hard to follow due to lack of knowledge my side.
I never give up.. I have patient, so.. let's go!
I don't wat to stress you too much but I need your help to reach the goal.. do you have time&patient?
In case, I'm open to share the final result, maybe a image for Orange PI 5 with LinuxCNC installed. The board is really promising by specs.
Just for your info, I have a working RPI4 on my cnc, I'm happy, so I don't have really pressure on close this project.
Now.. some basic questions:
1) "the going armbian build" means the main branch of armbian? I found this documentations, can I follow this?  Buinding Armbian 
I will mix your suggestions with these instructions..
2) RT Patch: I did many tenetatives already following this instruction: [/url] Patch RT
should I do the same? I tried with version 5.10.176, 5.10.109.. the orginal version of Orange PI 5 is 5.10.110. In this case, with patch should I apply for armbian main branch?

In meanwhile, I will start the first tentative..
Thanks
Andrea


I gave you instructions. Don't follow any other path.
You may follow the official Armbian build instructions to fill in the gaps on the first initial build only.
This build includes a flow in the config file I have provided to build the preempt-rt kernel so do not try anything else...

And yes Royka, the Armbian kernels ar flawed, this may be too but until somebody tries it we will not know...

Please Log in or Create an account to join the conversation.

More
31 Mar 2023 07:23 #267951 by Guglielmi
Yes royka, if you can, I will appreciate a lot.. maybe you are right I't enough without RT..

Please Log in or Create an account to join the conversation.

More
31 Mar 2023 07:48 - 31 Mar 2023 11:14 #267952 by Guglielmi
Thanks rodw,
yesterday I started to understand better trying.. so now I'm little bit less lost.
Even Royka will send me his work, I will continue to try. Using the repo you suggested, compiling it I get an error:
[ error ] ERROR in function compile_uboot [ cli/cli-entrypoint.sh:109 -> main/build-tasks.sh:196 -> main/build-tasks.sh:47 -> compilation/uboot.sh:132 -> logging/traps.sh:0 ] [ error ] U-boot compilation failed [ o.k. ] Process terminated 

I try again with main branch where I was able to build yesterday and also find Bookworm, not present in your repo.
I will keep you informed

Two specific question: 

There is a high probability that you will need to add patches etc to build PREEMPT_RT.


1. Should I download the last patch (e.g. 5.10.176) or the one more close to the version I have (5.0.109 I guess..)?
2. Do you confirm the patch should be placed after the compile process? I'm asking because I tried to place before and in the menu to define the configuration I can see FULLY PREEMPT, thing not visible when the patch is not there. Following your list, I will apply it later on in combination with your config file.. right?
Last edit: 31 Mar 2023 11:14 by Guglielmi.

Please Log in or Create an account to join the conversation.

Time to create page: 0.215 seconds
Powered by Kunena Forum