Page tree
Skip to end of metadata
Go to start of metadata


RR - presentation

Most of the boards have custom network interfaces, sometimes not open source which means that the driver isn't published with the kernel (Rock PI, Atomic PI). In that case, the driver has to be compiled after the complete installation.

In this case, to install the software we need to use a USB-Ethernet adapter like this one: https://www.distrelec.ch/en/usb-ethernet-adapter-trendnet-tu2-et100/p/12511929?q=USB+Ethernet+Adapter&pos=1&origPos=1&origPageSize=10&track=true

The best are the cheapest solutions (probably using open-source solutions)


A. Procedure:

  1. Get the NI linux image on your usb stick:

  2. Install NI Linux RT

    Sometimes you can get some errors due to the unrecognized memory devices, like micro sd cards

    Some boards give you possiblity to access Wi-Fi devices which are integrated (AtomicPI)
    NI blocks Wi-Fi card on safe mode
    To unlock Wi-Fi:

    rfkill unblock wifi

    ifconfig wlan0 up

    (you can have multiple wlan devices - please follow the logic)

    If your wifi is password protected with WPA run:


    wpa_passphrase ${SSID} ${PASSWORD} >> /etc/wpa_supplicant.conf
    wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf
  3. Use NI max to install normal Linux, this point is required.

    This instruction covers only recompilation of the kernel to enable GPIO not building the whole image! The best would be to have the same version of the kernel that we are going to rebuild and you are going to install.


  4. At this point you should be able to control device with LabVIEW

  5. Ethernet cards will be covered per device, please look in the child pages.



B. At this point we could stop, but pure image has GPIO ports blocked. There are two ways of solving the issue.


1 → Preconfigure image

Please install 21.0 instance of the NI Linux and use kernel files generated and stored on EOS → /eos/project/n/natinst/software/linux rt/intelx86_boards_gpio_kernel

Move to the next step

2 → Kernel modification.

This instruction doesn't cover preparing the machine please look into: NILRT

The machine with tools is created on openstack:

radeci-cc7-05

The tools to recompile kernel are in:

/home/dev/build_kernel/linux

The best would be to start from scratch please remove linux folder

sudo rm -rf /home/dev/build_kernel/linux
0. 
cd /home/dev/build_kernel

1.
sudo git clone https://github.com/ni/linux.git

2. checkout to proper branch
cd linux
sudo git checkout nilrt/21.0/4.14

3. Export envs - to use cross compilation tools
export ARCH=x86_64
export CROSS_COMPILE=/usr/local/oecore-x86_64/sysroots/x86_64-nilrtsdk-linux/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux-
export TGT_EXTRACFLAGS="--sysroot=/usr/local/oecore-x86_64/sysroots/x86_64-nilrt-linux"

4.
sudo make nati_x86_64_defconfig
sudo make menuconfig

At this point we should have a menu of the modules that will be compiled with the kernel


Please go to device drivers

select:
GPIO support

and create modules (M) for the GPIOs corresponding to your needs

At this point you can create/compile the modules with the kernel by executing:

sudo make ni-pkg

It takes 30-40mins to compile it.

Remove symbolic links in

./ni-install/x86/lib/modules/

If you won't remove them you will have libs used for building the kernel, they are quite heavy

C. Copying the kernel to the device

NI linux RT has two kernels, if you will fail in this point device will boot to the safe-mode.

/boot/safe-mode → safe mode kernel

/boot/runmode → normal mode

Go to kernel path

scp -r x86/lib/modules/${new_version} admin@${rt_target_hostname}:/lib/modules/
scp x86/boot/bzImage admin@${rt_target_hostname}:/boot/runmode/
scp x86/headers/module-versioning-image.squashfs admin@${rt_target_hostname}:/usr/local/natinst/tools/module-versioning-image.squashfs

Reboot device.

Since we have the same kernel we could copy build tools from the old modules:

ssh admin@${IPofTheDevice}
cp /lib/modules/4.14xxxxxxxxxxxx(original modules)/build /lib/modules/4.14xxxxxxxxxxx(new modules)
cp /lib/modules/4.14xxxxxxxxxxxx(original modules)/source /lib/modules/4.14xxxxxxxxxxx(new modules)


It should be ready to go.

D. How to interact with GPIOs

Look into the datasheet of the board to check the gpios.

Example

Example of controlling pin number 7 on odyssey board

cd /sys/class/gpio
echo 337 > export
cd gpio337
echo "out" > direction
echo 1 > value

Ensure that gpio works with multimeter.


  • No labels