It is possible to build (compile and link) custom software for National Instruments (NI) embedded hardware running the NI Linux RT. There are two methods for building custom software: (1) Cross-compile using the freely available NI C/C++ Eclipse integrated development environment or (2) Use NI's embedded hardware to natively compile. The preferred method for building custom software is cross-compiling with NI Eclipse. Please attempt the cross-compiling option before using embedded hardware to natively compile custom code.
Every embedded hardware from NI that runs the NI Linux RT operating system comes with the opkg package manager. NI also hosts a repository (feed) or both processor architectures used in NI's embedded hardware, i.e. ARM and Intel. The opkg package manager and NI's repository of pre-built packages can be used to optionally install and extend the capabilities of their embedded hardware. This includes being able to install a compiler (gcc) and various build tools to turn any NI Linux RT-supported hardware into a build environment for custom software.
This document outlines the steps needed to create a properly configured build environment on a CompactRIO (cRIO) running the NI Linux RT operation system from NI, such as a cRIO-9068. The setup is focused on creating a build environment to natively compile the libssh2 client-side SSH library, so some of the packages and configuration may not be needed for other projects but the steps are similar.
- Host computer running either Windows, macOS, or (desktop) Linux
- NI embedded hardware running NI Linux RT, such as a cRIO
- Internet access for the Host computer
- SSH client installed on the Host computer, such as Putty or OpenSSH for Windows 10
For the remainder of this document, "NI embedded hardware running NI Linux RT" will be referred to as simply "cRIO".
The first step is enabling SSH access on the cRIO. This only has to be done once.
- Connect the CompactRIO (cRIO) to a computer via Ethernet.
- Power on the cRIO.
- Start National Instrument's (NI) Measurement & Automation Explorer (NI-MAX) application.
- Expand the Remote Systems tree item on the left-hand side of the main application window.
- Locate and select the cRIO in the list of devices under the Remote Systems tree item.
- You may need to log in to the cRIO as an adiministrator (the default username is
admin
and password is blank). - On the System Settings tab for the cRIO in NI-MAX, under the Startup Settings section, check the Enable Secure Shell Server (sshd) checkbox.
- Save the changes by clicking on the Save button at the top of the System Settings tab.
- Reboot the cRIO.
There are two methods for setting up a build environment for a cRIO: (1) Offline and (2) Online. Typically, a cRIO does not, and should not, have access to the Internet. They are usually deployed on a Local Area Network (LAN) and cannot access the NI opkg package repository directly. This means that all of the necessary packages must be downloaded using an Internet-accessible host computer and then transferred to the cRIO. However, sometimes a cRIO can be connected to the Internet (if the IT department allows it), either pernamently (not recommended) or temporarily. A lot of the dependency management and order of operations is handled automatically with the Online method, but the majority use case is the Offline method.
-
Download the following packages from NI's opkg feed for the architecture (
arm
orx64
) of the cRIO:- binutils
- cmake (Optional, but needed for the libssh2 build)
- cpp
- cpp-symlinks
- gcc
- gcc-symlinks
- libbfd
- libcurl4
- libc6
- libc6-dev
- libexpat1
- libgcc-s-dev
- libgcc1
- libgmp10
- libgnutls30
- liblzma5
- liblzo2
- libmpc3
- libmpfr4
- libstdc++6
- libunistring2
- libxml2
- libz1
- linux-libc-headers-dev
- make
- nettle
- openssl
- openssl-dev (Optional, but needed for the libssh2 build)
The packages are listed in alphabetical order. This is not the installation order. Many of these packages are dependencies for other packages and must be installed before the dependent package is installed. Also, the versions are intentionally left off. It is possible to use newer versions of various packages as long as the architecture matches the cRIO's processor and the dependencies are satified. The version of the NI CompactRIO Device Drivers determines the versions of the packages are already installed on the cRIO. Sometimes, it might be necessary to upgrade the NI CompactRIO Device Drivers to get correct versions for various package dependencies. The best practice, as always, is to always have the latest versions of the NI CompactRIO Device Drivers installed on the cRIO.
-
Connect the cRIO to the host computer via Ethernet.
-
Power up the cRIO.
-
Transfer each of the IPK files that were downloaded in Step 1 to the cRIO's
/tmp
directory. This can be accomplished using the scp command with a suitable SSH client, a WebDAV client, or FTP if the FTP server component is installed on the cRIO. For example, assuming all of the needed IPK files have been downloaded from the NI repository to the host computer and the IPK files are in the same directory, the following command can be used on the host computer:scp *.ipk [email protected]:/tmp/
where
XXX.XXX.XXX.XXX
is the IP address or hostname of the cRIO. You may be prompted for a username and password (the default username isadmin
and password is blank). -
Start a suitable SSH client on the host computer if not already started.
-
Log in via SSH to the cRIO using the host's SSH client.
-
Navigate to the cRIO's
/tmp
directory:cd /tmp
Note, the contents of the
/tmp
directory are removed every time the cRIO is restarted. -
Install each of the packages in the following order with the opkg application. Note, the asterisk,
*
, is a wildcard to mean "any". The IPK files will have the version number and architecture, which is dependent on which cRIO is available and the asterisk wildcard saves from having to type the entire file name along with avoiding confusion about version numbers.opkg install make*.ipk opkg install libgmp10*.ipk opkg install libunistring2*.ipk opkg install nettle*.ipk opkg install libgnutls30*.ipk opkg install libcurl4*.ipk opkg install cmake_3.4.3-r0.3*.ipk opkg install libmpfr4*.ipk opkg install libmpc3*.ipk opkg install cpp_*.ipk opkg install cpp-symlinks*.ipk opkg install gcc_*.ipk opkg install gcc-symlinks*.ipk opkg install libgcc-s-dev*.ipk opkg install libbfd*.ipk opkg install binutils*.ipk opkg install linux-libc-headers-dev*.ipk opkg install libc6-dev*.ipk opkg install openssl-dev*.ipk
-
Exit the SSH session with the cRIO.
exit
-
Reboot the cRIO.
Note, if using LabVIEW 2017 and RIO 17.0 drivers, please ensure the opkg feeds are fixed before executing the following steps. There is a known bug with the OS image that is shipped with LabVIEW 2017 and its device drivers (RIO 17.0) for the opkg feeds. Please follow the instructions for fixing the feeds in LabVIEW 2017/RIO 17.0. Only LabVIEW 2017 and RIO 17.0 are affected by this bug.
-
Power up the cRIO.
-
Start a suitable SSH client on the host computer.
-
Log in via SSH to the cRIO using the host's SSH client.
-
Install the following packages using the
opkg
command from the cRIO:opkg install binutils opkg install make opkg install cmake opkg install gcc opkg install gcc-symlinks opkg install libgcc-s-dev opkg install cpp opkg install cpp-symlinks opkg install linux-libc-headers-dev opkg install libc6-dev opkg install openssl-dev
Unlike the Offline method, all of the dependencies will be downloaded and managed automatically by the package manager. It may also be possible to use the
core-buildessential
package group as follows:opkg install packagegroup-core-buildessential opkg install cmake opkg install openssl-dev
Again, the
cmake
andopenssl-dev
packages are ultimately optional and only required for building the libssh2 source code. -
Exit the SSH session with the cRIO.
exit
-
Reboot the cRIO.