NI Linux Real-Time Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Step-by-step: Install/Configure a Package using opkg on Linux RTOS (myRIO and cRIO-9068)

Here are some notes taken while installing a package and configuring it to run in LabVIEW with a Call Library Function Node, both on a cRIO-9068 and a myRIO 1900.

All shell commands below are run from Terminal on OS X 10.9.2 and connected to the RIO target via WiFi on the local area network.

For the formatting below, both the shell commands and outputs use a monospace font, where the commands are bolded.

Let's establish a baseline: can we ping the RIO at its expected address?

Jacks-27-iMac:~ jackdunaway$ ping 192.168.0.20

PING 192.168.0.20 (192.168.0.20): 56 data bytes

64 bytes from 192.168.0.20: icmp_seq=0 ttl=64 time=62.983 ms

64 bytes from 192.168.0.20: icmp_seq=1 ttl=64 time=5.556 ms

64 bytes from 192.168.0.20: icmp_seq=2 ttl=64 time=25.158 ms

^C

Yes! Now, to establish a Secure Shell connection at this address, using the name "admin"

Jacks-27-iMac:~ jackdunaway$ ssh admin@192.168.0.20

The authenticity of host '192.168.0.20 (192.168.0.20)' can't be established.

RSA key fingerprint is 99:97:...redacted...:94:fa.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.0.20' (RSA) to the list of known hosts.

NI Linux Real-Time (run mode)

Log in with your NI-Auth credentials.

Password: (password, intially set when installing RIO software through NI-MAX)

admin@Wirebird-Labs-myRIO:~#

Now that we're logged in with root access, let's see what architectures our system supports:

admin@Wirebird-Labs-myRIO:~# opkg print-architecture

arch all 1

arch any 6

arch noarch 11

arch arm 16

arch armv4 21

arch armv5 26

arch armv5-vfp 31

arch armv5e 36

arch armv5e-vfp 41

arch armv6-vfp 46

arch armv7a 51

arch armv7a-vfp 56

arch armv7a-vfp-neon 61

arch xilinx_zynq 66

Those architectures appear to be editable from the following file, but I'm not sure what would happen if this was changed haphazardly. If you know, feel free to edit this document or comment below!

/etc/opkg/arch.conf

So after sifting around a while through all the available package repositories online, and comparing them against the default package listing specified inside the file /etc/opkg/angstrom-base-feed.conf -- I decided to update the base feed in that file to what appears to be the newest package repo listing for the armv7a-vfp-neon architecture (at the time of writing). The original package listing appeared to have packages from the 2010-2011 time frame, 3-4 years old or so. More importantly, that list was too old to even have the package I was looking for.

http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base

With the latest package listing selected, we can command opkg to update its local cache listing with that of the newly specified feed:

admin@Wirebird-Labs-myRIO:~# opkg update

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base/Packages.gz.

Inflating http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base/Packages.gz.

Updated list of available packages in /var/lib/opkg/lists/angstrom-base.

My goal is to install a specific library, but the following command yielded a roadblock:

admin@Wirebird-Labs-myRIO:~# opkg install http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base/libjson-static...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base/libjson-static....

Installing libjson-staticdev (0.9-r0.7) to root...

libc6-dev: unsatisfied recommendation for eglibc-thread-db-dev

libc6-dev: unsatisfied recommendation for perl-dev

libc6-dev: unsatisfied recommendation for libsegfault-dev

bash-dev: unsatisfied recommendation for ncurses-libtinfo-dev

ncurses-dev: unsatisfied recommendation for ncurses-libmenu-dev

ncurses-dev: unsatisfied recommendation for ncurses-libpanel-dev

ncurses-dev: unsatisfied recommendation for ncurses-libtinfo-dev

ncurses-dev: unsatisfied recommendation for ncurses-libform-dev

ncurses-dev: unsatisfied recommendation for ncurses-libncursesw-dev

ncurses-dev: unsatisfied recommendation for ncurses-libtic-dev

ncurses-dev: unsatisfied recommendation for ncurses-libncurses-dev

ncurses-dev: unsatisfied recommendation for ncurses-libmenuw-dev

ncurses-dev: unsatisfied recommendation for ncurses-terminfo-base-dev

ncurses-dev: unsatisfied recommendation for ncurses-libpanelw-dev

ncurses-dev: unsatisfied recommendation for ncurses-libformw-dev

ncurses-dev: unsatisfied recommendation for ncurses-libticw-dev

libc6-dev: unsatisfied recommendation for eglibc-extra-nss-dev

libc6-dev: unsatisfied recommendation for libcidn-dev

Collected errors:

* satisfy_dependencies_for: Cannot satisfy the following dependencies for libjson-staticdev:

*           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (= 2.16-r15+svnr20393.5) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *           libc6 (>= 2.16) *

Looks like this package requires a later version of libc6 than what ships with the stock installation, so let's see what version we currently have installed:

admin@Wirebird-Labs-myRIO:~# opkg list | grep libc6

libc6 - 2.16-r15+svnr20393.5 - Embedded GLIBC (GNU C Library)

libc6 - 2.11.1-r7

libc6-dev - 2.16-r15+svnr20393.5 - Embedded GLIBC (GNU C Library) - Development files

So looks like we have the option to upgrade from 2.11 to 2.16, which would satisfy the constraint (tip from BradM from the comments below: Be careful with this, we've seen this clear out the /etc/ld.so.conf file, meaning NI software will fail to load on next boot. There's a reason we flagged it to not get updated accidentally.):

admin@Wirebird-Labs-myRIO:~# opkg upgrade libc6

Not upgrading package libc6 which is marked hold (flags=0x2).

At this point, we're feeling much like a Reverse Polish Notation calculator, pushing all this work onto the stack... but whatev, let's lift the flag to allow the upgrade:

admin@Wirebird-Labs-myRIO:~# opkg flag ok libc6

Setting flags for package libc6 to ok.

Attempting the upgrade once more yields success:

admin@Wirebird-Labs-myRIO:~# opkg upgrade libc6

Upgrading libc6 on root from 2.11.1-r7 to 2.16-r15+svnr20393.5...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libc6_2.16-r1....

Removing obsolete file /lib/libutil-2.11.1.so.

Removing obsolete file /lib/libnsl-2.11.1.so.

Removing obsolete file /usr/libexec/getconf/XBS5_ILP32_OFFBIG.

Removing obsolete file /usr/libexec/getconf/XBS5_ILP32_OFF32.

Removing obsolete file /lib/libnss_dns-2.11.1.so.

Removing obsolete file /usr/libexec/getconf/POSIX_V7_ILP32_OFFBIG.

Removing obsolete file /lib/libc-2.11.1.so.

Removing obsolete file /usr/libexec/getconf/POSIX_V7_ILP32_OFF32.

Removing obsolete file /lib/libm-2.11.1.so.

Removing obsolete file /lib/librt-2.11.1.so.

Removing obsolete file /lib/libnss_compat-2.11.1.so.

Removing obsolete file /lib/libresolv-2.11.1.so.

Removing obsolete file /lib/libanl-2.11.1.so.

Removing obsolete file /lib/libcrypt-2.11.1.so.

Removing obsolete file /lib/libpthread-2.11.1.so.

Removing obsolete file /usr/libexec/getconf/POSIX_V6_ILP32_OFFBIG.

Removing obsolete file /lib/libnss_files-2.11.1.so.

Removing obsolete file /lib/ld-2.11.1.so.

Removing obsolete file /usr/libexec/getconf/POSIX_V6_ILP32_OFF32.

Removing obsolete file /lib/libBrokenLocale-2.11.1.so.

Removing obsolete file /lib/libdl-2.11.1.so.

Configuring libc6.

Alright, now let's make sure that original package we're wanting is still in the local cache...

admin@Wirebird-Labs-myRIO:~# opkg list | grep json

libjson-dev - 0.9-r0.7 - libjson version 0.9-r0 - Development files

libjson-staticdev - 0.9-r0.7 - libjson version 0.9-r0 - Development files (Static Libraries)

libjson0 - 0.9-r0.7 - libjson version 0.9-r0

And let's have a go at installing it, this time, from its local package name, rather than specifying it's fully-qualified hosted URI:

admin@Wirebird-Labs-myRIO:~# opkg install libjson-dev

Installing libjson-dev (0.9-r0.7) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libjson-dev_0....

libc6-dev: unsatisfied recommendation for eglibc-thread-db-dev

libc6-dev: unsatisfied recommendation for perl-dev

libc6-dev: unsatisfied recommendation for libsegfault-dev

bash-dev: unsatisfied recommendation for ncurses-libtinfo-dev

ncurses-dev: unsatisfied recommendation for ncurses-libmenu-dev

ncurses-dev: unsatisfied recommendation for ncurses-libpanel-dev

ncurses-dev: unsatisfied recommendation for ncurses-libtinfo-dev

ncurses-dev: unsatisfied recommendation for ncurses-libform-dev

ncurses-dev: unsatisfied recommendation for ncurses-libncursesw-dev

ncurses-dev: unsatisfied recommendation for ncurses-libtic-dev

ncurses-dev: unsatisfied recommendation for ncurses-libncurses-dev

ncurses-dev: unsatisfied recommendation for ncurses-libmenuw-dev

ncurses-dev: unsatisfied recommendation for ncurses-terminfo-base-dev

ncurses-dev: unsatisfied recommendation for ncurses-libpanelw-dev

ncurses-dev: unsatisfied recommendation for ncurses-libformw-dev

ncurses-dev: unsatisfied recommendation for ncurses-libticw-dev

libc6-dev: unsatisfied recommendation for eglibc-extra-nss-dev

libc6-dev: unsatisfied recommendation for libcidn-dev

Installing libjson0 (0.9-r0.7) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libjson0_0.9-....

Installing libc6-dev (2.16-r15+svnr20393.5) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libc6-dev_2.1....

Installing libthread-db1 (2.16-r15+svnr20393.5) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libthread-db1....

Installing eglibc-extra-nss (2.16-r15+svnr20393.5) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//eglibc-extra-....

Installing libcidn1 (2.16-r15+svnr20393.5) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libcidn1_2.16....

Installing bash-dev (4.2-r6.4) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//bash-dev_4.2-....

Upgrading bash on root from 4.2-r2 to 4.2-r6.4...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//bash_4.2-r6.4....

Removing obsolete file /bin/bashbug.

Upgrading libgcc1 on root from 4.4.1-r7 to linaro-4.7-r9.1...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libgcc1_linar....

Installing libgcc-s-dev (linaro-4.7-r9.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libgcc-s-dev_....

Installing ncurses-dev (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//ncurses-dev_5....

Installing ncurses (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//ncurses_5.9-r....

Installing libpanelw5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libpanelw5_5.....

Installing libncursesw5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libncursesw5_....

Installing libform5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libform5_5.9-....

Installing libncurses5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libncurses5_5....

Installing libtic5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libtic5_5.9-r....

Installing libmenuw5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libmenuw5_5.9....

Installing libformw5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libformw5_5.9....

Installing libpanel5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libpanel5_5.9....

Installing libmenu5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libmenu5_5.9-....

Installing libticw5 (5.9-r13.1.1) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//libticw5_5.9-....

Installing linux-libc-headers-dev (3.4.3-r0.2) to root...

Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base//linux-libc-he....

Configuring libgcc1.

Configuring eglibc-extra-nss.

Configuring bash.

update-alternatives: Linking //bin/sh to bash

Configuring libticw5.

Configuring libjson0.

Configuring libthread-db1.

Configuring libcidn1.

Configuring libgcc-s-dev.

Configuring ncurses.

Configuring libncursesw5.

Configuring libpanelw5.

Configuring libncurses5.

Configuring libform5.

Configuring libtic5.

Configuring libmenuw5.

Configuring libformw5.

Configuring libpanel5.

Configuring libmenu5.

Configuring ncurses-dev.

Configuring bash-dev.

Configuring linux-libc-headers-dev.

Configuring libc6-dev.

Configuring libjson-dev.

admin@Wirebird-Labs-myRIO:~#

Right on! Looks like we're in business. So where was it installed anyway?

admin@Wirebird-Labs-myRIO:~# opkg files libjson-dev

Package libjson-dev (0.9-r0.7) is installed on root and has the following files:

/usr/include/json/json_util.h

/usr/include/

/usr/include/json/linkhash.h

/usr/lib/libjson.la

/usr/include/json/json_tokener.h

/usr/include/json/debug.h

/usr/lib/libjson.so

/usr/include/json/json_object.h

/usr/include/json/json.h

/usr/include/json/arraylist.h

/usr/include/json/

/usr/lib/pkgconfig/

/usr/include/json/json_object_private.h

/usr/include/json/bits.h

/usr/lib/pkgconfig/json.pc

/usr/include/json/printbuf.h

Sweet. Now let's take it into LabVIEW, and configure the Call Library Function Nodes based on checking out function prototypes in the header files that were installed into /usr/include/json. To view the configurations of these nodes, drop the snippet into LV2013 or higher:

Configuring-libjson-for-Linux-RT-snippet.png

Examining the result of executing this on the RIO target, we've got success!

Configuring-libjson-for-Linux-RT-output.png

Next step: that package is out of date (json-c 0.9 looks to have been released in the 2009 timeframe), and I'm keen to use some newer features of the 0.12 released this year available from: https://github.com/json-c/json-c

Having established baseline success with the existing binary, stay tuned for the next tutorial installment where we'll build a package from source code.

Comments
Active Participant BradM
Active Participant

A few notes.

Jacks-27-iMac:~ jackdunaway$ sudo ssh admin@192.168.0.20

You should not need to run the ssh command with sudo, ssh doesn't care if you are root or not, it's going to use the normal authentication methods as configured on the server.

admin@Wirebird-Labs-myRIO:~# opkg upgrade libc6

Be careful with this, we've seen this clear out the /etc/ld.so.conf file, meaning NI software will fail to load on next boot. There's a reason we flagged it to not get updated accidentally.

Member wirebirdlabs
Member

Good tip -- I'll watch for this, and have added the two edits to the document above.

As a sanity check, here's what the /etc/ld.so.conf file looks like on a fresh install of myRIO 13.1:

/lib

/usr/lib

/usr/local/lib

/usr/local/natinst/lib

Active Participant BradM
Active Participant

Yeah, that looks fine.

Member kwkengineer
Member

any tips for installing a package on a cRIO-9068 without Internet connectivity?

Zach J
NI Employee

@kwkengineer,

You would have to download the package you need as well as the dependencies required, transfer them over to the cRIO-9068, and then, if they are in the same folder you can issue the command:

opkg install *.ipk

If you are just installing a single file:

opkg install <filename.ipk>

should work just fine.

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
Active Participant BradM
Active Participant

In addition to this, and in order to prevent too many headaches, you can check the Packages file at the top-most level of the feed server (e.g. http://feeds.angstrom-distribution.org/feeds/next/ipk/eglibc/armv7a/base/Packages), check to see what the dependencies of the package that you care about are, and, on the target, check to see if that package is already installed with "opkg info package_name". If it tells you that the status is "install ok installed", you can skip this dependency.

Build up the list of dependent packages you need, copy them to the target (via USB, for example), and install.

Member fahad80
Member

I was trying to install the OpenNI files in myRIO. At one point it said "Permission Denied" to register a module. How can I avoid this? Any idea?

Active Participant BradM
Active Participant

fahad80, welcome!

We need a bit more information concerning what you are doing when you say "at some point" and "register a module". The commands on the terminal or interaction with the target leading up to the error would be a great start. How are you installing OpenNI? I assume you're referring to Open Natural Interaction, if not, what are you referring to?

Member fahad80
Member

Sorry for being vague. Yes I was referring to Open Natural Interaction. It was actually a permission problem. I was trying to change the permission by "chmod", but still it wasn't working. Then I used filezilla to get access the file into myRIO and manually changed the permission. That works!

But that brings lots of other problem, and as I am not a Linux user, those are beyond my reach I guess. I wondered why nobody tried to interface kinect directly with myRIO.

Active Participant BradM
Active Participant

Re: Type of Kinect sensor , ,

There have been many people playing around with the kinect on myRIO.

Member fahad80
Member

I actually wanted to interface Kinect directly with myRIO, not through Labview. I wanted to connect Kinect into myRIO's USB port, and get rid of laptop/pc. one guy did something with libfreenect, but that works with specific kinect model and it dont have skeletal tracking. im not that much of a linux user let alone developer. it seems who knows deep in cross compiling and library dependencies can make this thing work. im  just a researcher and this is right now out of my league :-(

Active Participant BradM
Active Participant

The labview programs in these listings get compiled, sent to the RT target, and interact with the kinect directly. If you'd like to interact with the camera/sensors from outside of LabVIEW, I would receommend looking at the Open-Kinect/Freenect project for details on how to interact with the kinect (that's what the support from within LabVIEW RT uses in the listed projects)

Member F9Alejandro
Member

In linux even if you are an administrator account you still in most cases need to use sudo in order for an operation to occur as root. chmod would be one example of needing to use root/sudo to change something. Just like in windows there is a tier higher than what you currently are, Windows case is SYSTEM, while linux is root.

Also from my experiences with linux be very careful with what you change as it could be the last thing you change before a reimage is required. (Linux is a very fickle thing)

Member mukilan
Member

I am a newbie to both Linux rtos and myrio. I'm working on a project that requires me to run python on myRio. Can anyone guide me to install python on myRio?

Contributors