How to Compile or install OpenCN

Is there step by step procedure to install OpenCN on X86 platform.

I tried installing the OpenCN on Debian 11 bullseye based system.
following this link 8. User guide — OpenCN 2021.2.0 documentation .

1.It does not create a real time system
2.Not clear how to install to internal disk
3.How GUI works and how to install
4.Will the system work with other brand Ethercat Servo

In Step 8.1.1
Required below packages are not available
E: Unable to locate package libcapstone3
E: Package ‘python3-crypto’ has no installation candidate

Appears to be these packages are available specific to Debian 10 .
So continued further

./ -t x86

./ -a

It failed to locate the package >>> glpk 4.65
So edited the file ~/opencn/buildroot/package/
GLPK_SITE = FTP archive directory /pub/gnu/glpk/

After this it compiled everything completed without error.

Then tried deploying to USB
./ -f sdb
./ -a sdb
It went ok .Created USB disk and boots

uname -a > shows linux buildroot 5.4.44
It looks not a realtime kernal.

lsblk command did not work
So not clear how to carry out step > Copy on internal disk (x86 only)
Say I want to install to partition sda10

I have CTB etherat servos to retrofit a 3axis mill.
Will it work ?
Just exploring OpenCN or Linuxcnc and learn

Hi sivaraj,

Thanks you for your interest in OpenCN, also thanks for your detailed answer.
I’m sorry to hear that you have trouble installing OpenCN on x86. We still do lake some documentation on that side and we do need to rearrange it someday …

To answer your different points :

  1. Yes it does not create a realtime system. The way it work is : Build on a debian based system → Format a SDcard or USB flashdrive → Deploy to SD/USB → Plug in on your x86 target PC → boot on device.
  2. Yes, again, we lake some explicit documentation…
  3. GUI is build using agency/usr/ You can then found the executable under agency/usr/build-host/host/user_gui/user-gui. The “tutorial” is located under 9.1. User-Gui — OpenCN 2021.2.0 documentation
  4. We only support some EtherCAT slaves for now, you can found the list under 5.12. LinuxCNC Ethercat Control — OpenCN 2021.2.0 documentation
    It is possible to implement a new driver if you wish to had support for a new slave :slight_smile:

For installation :
It’s been a long time I haven’t done it, but once in the console of OpenCN you can run “./ /dev/sda10” for example. Then follow the step of that you mentioned. The installation step is a bit woobly as we didn’t implement an extensive installation script that do everything for you. What is the part you have trouble with exactly ?

About glpk :
I had the same issue recently, we didn’t push the fix to master for now.

About CTB Ethercat servos :
We do not support them for now, but they seem to have CiA402 drive profile support so it shouldn’t be too hard to had a driver in LCEC to control them (component that control the ethercat in OpenCN).
Based on :

A first step would be to run “./ethercat slaves” once you connected the drive. If you see your slaves it’s already a good point :slight_smile: Then you can run “./ethercat pdo” and “./ethercat cstruct” to take a look at what the drive output.
Also if you wish to implement it yourself I would happily try to help you in the process.

Hi Xavior,
Thanks for your reply
Does it mean that OpenCN under X86 platform not requires Xenomai real-time system ?

Hi Sivarah,
No actually, the framework already contains a patched kernel with our custom Xenomai/Cobalt-based adaptations (mainly Cobalt-centric with no I-pipe overhead).

Also I’ve forgot to mention it but installation is not mandatory.

I was already able to run OpenCN on x86 with very cheap USB device, boot on USB, and perfectly run EtherCAT at 10kHz with 2 Triamec TSD80 drive.
The only trouble I had was the sampler (logging component of OpenCN) who would sometimes skip some data randomly. Using a good USB fixed it.
It’s very practical if you are developing new features and want faster iteration :slight_smile:

Hi Rossierd
Thanks for your reply.
I am able to build & deploy the OpenCN frmaework to USB .
PC can boot from USB.
But not sure of whether it is a realtime kenel.
After booting from the deployed USB
uname -a > shows linux buildroot 5.4.44 (as in the picture of first post)

Is there a way to confirm running kernel is Xenomai/Cobalt patched kernel

However I read from this post Upgrading the framework to 5.10
that agency has been upgraded with the Linux kernel 5.10
Or it is not relevant to X86 platform


As lsblk command did not work , I did not attempt step > Copy on internal disk (x86 only).
I will buy another harddidk to setup and try

Does it need another PC to run GUI standalone .

Yes you need another PC to run the GUI as we decided to separate the calculation & render part.

If you already have a disk plugged in your PC you should see it by typing “ls /dev”
Since it’s a custom build it’s likely that we didn’t add some basic command & tool from linux. For example we have “vi”, “nano” and “fdisk”, but not vim and lsblk…
We could add it through the menuconfig of buildroot.

Hi Sivaraj,

Regarding our question about real-time: OpenCN kernel organization uses a Asymmetric Multi-Processing (AMP) approach. A dedicated CPU (CPU #1) is reserved for RT with Xenomai scheduling.

It is the reason why, with uname you see standard 5.4 kernel.

Hope this helps

Just got separate setup motherboard and tried booting with USB.
Its a BCM87QD motherboard with Intel i217/i210
If I connect Ethercat cable to LAN2 (i210) link is up.
I hope Ethercat link is alive
But ./ethercat slave command did not show any slaves
Attached are screenshots

I have Twincat installed and CTB servo can run with velocity command from Twincat.
I am not clear on procedure to add new slaves xml file.

Hi Sivaraj,

Ok, it seems you have an issue with you NIC (Ethernet card) used for EtherCAT.
Here is a list of possible actions:

  • This NIC should be an e1000e
  • The MAC address of it should be placed in the x86 kernel configuration to be used/configured as EtherCAT (NB: this step is only needed for X86 target).

Set Correct MAC address
0. Get the MAC address of the controller

  1. Open agency/linux/arch/x86/configs/x86_defconfig file
  2. Change the line starting with CONFIG_OPENCN_ETHERCAT_MASTER_MAC0
  3. Re-compile and re-deploy the kernel

Hope this helps

Dear J-P
Thanks for your reply.
In fact I compiled OpenCN on different motherboard
Just tried booting with deployed USB in different motherboard.
May be it might have auto picked a wrong MAC address with compiled setup ?
Booted with deployed USB I did not see any response while connecting Ethercat cable to NIC port i217 (LAN1) which is a e1000e.
Above screen shots are while Ethercat connected to NIC port i210(LAN2) . Obviously it is not a e1000e.
If I compile and deploy in same motherboard , still do I need to manually Set Correct MAC address ?

I read from below link that NIC i217 is a e1000e

So I hope this motherboard should work
should I look for another motherboard or RPI will be a better option ?

HI Sivaraj,

still do I need to manually Set Correct MAC address ?

Yes, you have to set the MAC address of the NIC in the kernel configuration file for x86.

  • Your motherboard seems OK - having one e1000e and one i210 is perfect (2 e1000e is not supported for now).

Hope this helps

Dear J-P
I am trying OpenCn whenever I get free time so delay in reply.
Today I tried recompiling with MAC address setting of CONFIG_OPENCN_ETHERCAT_MASTER_MAC0

$ ./ -t x86
$ ./ -kc
$ ./ -a

Deployed and Booted with USB .
With “ifconfig” command
It detects igb (i210) as eth0 and did not detect the e1000e(i217)

Then I tried disabling the igb (i210) in bios and booted with only the e1000e(i217) is enabled
It does not show any ethernet port at all and looks like driver failed to work.

Is there any other compile setting I can try ?

In linux desktop everything work

below is with only e1000e NIC enabled

In bios setting LAN1 is i217 (e1000e) and LAN2 is i210 . But in desktop network configuration it auto assigns i210 to eth0 and i217 to eth1 .
Booting from deployed usb failed to detect e1000e

Like to is there any other command I can try

Hi J-P,

Today I tried recompiling with MAC address setting of CONFIG_OPENCN_ETHERCAT_MASTER_MAC0

Great - just to be 100%, you did it on agency/linux/arch/x86/configs/x86_defconfig file, correct ?

With “ifconfig” command
It detects igb (i210) as eth0 and did not detect the e1000e(i217)

It is the expected behavior: the e1000e is no more seen by the Linux network stack. It is handled by the EtherCAT master.

From there, if you connect a EtherCAT slave, a message should be displayed displayed saying the interface is UP.

Hope this helps