# How to Compile or install OpenCN

**URL:** <http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377>\
**Category:** OpenCN Framework\
**Created:** [February 13, 2023, 6:53am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377 "2023-02-13T06:53:00Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivaraj](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@sivaraj](http://discourse.heig-vd.ch/u/sivaraj)\
**Post date:** [February 13, 2023, 6:53am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/1 "2023-02-13T06:53:00Z")

</div>

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](https://mecatronyx.gitlab.io/opencnc/opencn/user_guide.html) .

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

~/opencn/agency  
./build.sh -t x86

./build.sh -a

It failed to locate the package \>\>\> glpk 4.65  
So edited the file ~/opencn/buildroot/package/glpk.mk  
GLPK\_SITE = [FTP archive directory /pub/gnu/glpk/](https://ftp.nluug.nl/pub/gnu/glpk)

After this it compiled everything completed without error.

Then tried deploying to USB  
~/opencn/agency/  
./deploy.sh -f sdb  
./deploy.sh -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 \> 8.1.3.1. 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

 ![opencn](http://discourse.heig-vd.ch/uploads/default/original/1X/f090fe30275991eb52bf0f324a9e605ea8084249.jpeg)

---

<div class="post-metadata">

**Author:** ![Xavier](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/xavier/32/91_2.png) [@Xavier](http://discourse.heig-vd.ch/u/Xavier)\
**Post date:** [February 13, 2023, 11:51am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/2 "2023-02-13T11:51:00Z")

</div>

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/build-host.sh. 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](https://mecatronyx.gitlab.io/opencnc/opencn/host/user-gui.html)
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](https://mecatronyx.gitlab.io/opencnc/opencn/components/lcec/lcec.html#supported-slaves)  
It is possible to implement a new driver if you wish to had support for a new slave 🙂

**For installation :**  
It’s been a long time I haven’t done it, but once in the console of OpenCN you can run “./install.sh /dev/sda10” for example. Then follow the step of 8.1.3.1. 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 : [https://forum.linuxcnc.org/media/kunena/attachments/28121/CTBGHseriesv1manual-EtherCATcommunitation-2020.pdf](https://forum.linuxcnc.org/media/kunena/attachments/28121/CTBGHseriesv1manual-EtherCATcommunitation-2020.pdf)

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 🙂 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.

---

<div class="post-metadata">

**Author:** ![sivaraj](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@sivaraj](http://discourse.heig-vd.ch/u/sivaraj)\
**Post date:** [February 13, 2023, 3:58pm UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/3 "2023-02-13T15:58:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rossierd](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/rossierd/32/4_2.png) [@rossierd](http://discourse.heig-vd.ch/u/rossierd)\
**Post date:** [February 14, 2023, 11:21am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/4 "2023-02-14T11:21:36Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Xavier](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/xavier/32/91_2.png) [@Xavier](http://discourse.heig-vd.ch/u/Xavier)\
**Post date:** [February 14, 2023, 12:52pm UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/5 "2023-02-14T12:52:24Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![sivaraj](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@sivaraj](http://discourse.heig-vd.ch/u/sivaraj)\
**Post date:** [February 15, 2023, 6:18am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/6 "2023-02-15T06:18:05Z")

</div>

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](https://discourse.heig-vd.ch/t/upgrading-the-framework-to-5-10/279)  
that agency has been upgraded with the Linux kernel 5.10  
Or it is not relevant to X86 platform

---

<div class="post-metadata">

**Author:** ![sivaraj](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@sivaraj](http://discourse.heig-vd.ch/u/sivaraj)\
**Post date:** [February 15, 2023, 6:19am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/7 "2023-02-15T06:19:49Z")

</div>

Xavier

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

Does it need another PC to run GUI standalone .

---

<div class="post-metadata">

**Author:** ![Xavier](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/xavier/32/91_2.png) [@Xavier](http://discourse.heig-vd.ch/u/Xavier)\
**Post date:** [February 15, 2023, 1:48pm UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/8 "2023-02-15T13:48:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [February 20, 2023, 10:36am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/9 "2023-02-20T10:36:51Z")

</div>

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  
J-P

---

<div class="post-metadata">

**Author:** ![sivaraj](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@sivaraj](http://discourse.heig-vd.ch/u/sivaraj)\
**Post date:** [February 23, 2023, 11:55am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/10 "2023-02-23T11:55:13Z")

</div>

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

 ![opencn0](http://discourse.heig-vd.ch/uploads/default/original/1X/abcb26331a966e3a1b22db5f0a20b64036166724.jpeg)  
 ![OpenCN1](http://discourse.heig-vd.ch/uploads/default/original/1X/edf50074b11b23869e5635466ae18ca88cd8e6a1.jpeg)

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.

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [February 24, 2023, 8:27am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/11 "2023-02-24T08:27:28Z")

</div>

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  
J-P

---

<div class="post-metadata">

**Author:** ![sivaraj](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@sivaraj](http://discourse.heig-vd.ch/u/sivaraj)\
**Post date:** [February 24, 2023, 10:33am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/12 "2023-02-24T10:33:54Z")

</div>

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

> **[Intel® Network Adapter Driver for PCIe\* Intel® Gigabit Ethernet Network...](https://www.intel.com/content/www/us/en/download/14611/intel-network-adapter-driver-for-pcie-intel-gigabit-ethernet-network-connections-under-linux-final-release.html)**
>
> This download installs version 3.8.4 of the e1000e Linux\* Intel® Network Adapter Driver for Intel® Gigabit Network Connections for PCI Express\*. - Final Release

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

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [February 27, 2023, 7:46am UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/13 "2023-02-27T07:46:53Z")

</div>

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  
J-P

---

<div class="post-metadata">

**Author:** ![sivaraj](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/s/c77e96/32.png) [@sivaraj](http://discourse.heig-vd.ch/u/sivaraj)\
**Post date:** [March 2, 2023, 12:29pm UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/14 "2023-03-02T12:29:47Z")

</div>

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

Then  
$ ./build.sh -t x86  
$ ./build.sh -kc  
$ ./build.sh -a

Deployed and Booted with USB .  
With “ifconfig” command  
It detects igb (i210) as eth0 and did not detect the e1000e(i217)  
 ![ifconfig](http://discourse.heig-vd.ch/uploads/default/original/1X/5db885f100c018d64e90f54f2f5f3f28b19a30fc.jpeg)

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

 ![ifconfig_eth0_eth1](http://discourse.heig-vd.ch/uploads/default/original/1X/55806fc303e1ab07943c93bbbf11ff758aed5247.png)

below is with only e1000e NIC enabled

 ![Only_i217_enabled](http://discourse.heig-vd.ch/uploads/default/original/1X/485862019e5b9c959abd03cf2398f50f77b37c02.png)

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

---

<div class="post-metadata">

**Author:** ![jmi](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/jmi/32/125_2.png) [@jmi](http://discourse.heig-vd.ch/u/jmi)\
**Post date:** [March 2, 2023, 3:14pm UTC](http://discourse.heig-vd.ch/t/how-to-compile-or-install-opencn/377/15 "2023-03-02T15:14:07Z")

</div>

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  
J-P
