Kerlink provides the cross-toolchain, libraries and headers necessary to the compilation of an application.
The provided toolchain and development procedure are dedicated to Linux x86 computer (64 bits).
There is no embedded compiler in the Wirnet™ i-series gateways.
chmod +x ./keros-glibc*.sh
./keros-glibc*.sh
# Select your installation path
> ./keros-glibc*.sh
Keros SDK installer version 6.0.1
=================================
Enter target directory for SDK (default: /opt/keros/6.0.1): /opt/keros
You are about to install the SDK to "/opt/keros". Proceed [Y/n]? y
[sudo] password for *****:
Extracting SDK.....................................................................................................................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
$ . /opt/keros/environment-setup-cortexa9t2hf-neon-keros-linux-gnueabi
Once the toolchain has been installed, you need to call the environment setup script before you can use it:
. /opt/keros/environment-setup-cortexa9t2hf-neon-keros-linux-gnueabi
Note that the path to the environment setup script depends on the chosen installation path and the toolchain target.
As soon as the environment is initialized, standard variables such as CROSS_COMPILE
, CC
, CFLAGS
or LDFLAGS
are available in the environment.
The CC
variable can be use directly:
cat << EOF > hello_world.c
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
EOF
$CC hello_world.c -o hello_world
It is also possible to use make
(taking advantage of make
's implicit rules):
make hello_world
As in the basic C example, the CXX
variable can be use directly:
cat << EOF > hello_world.cc
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
return 0;
}
EOF
$CXX hello_world.cc -o hello_world
It is also possible to use make
(taking advantage of make
's implicit rules):
make hello_world
Projects using autotools can be used directly using the CONFIGURE_FLAGS
variable:
# Download the source archive
wget http://www.sqlite.org/2022/sqlite-autoconf-3380500.tar.gz
# Extract it and go to the source directory
tar xf sqlite-autoconf-3380500.tar.gz
cd sqlite-autoconf-3380500
# Create a build directory and go there
mkdir build
cd build
# Configure the build using the CONFIGURE_FLAGS variable provided
../configure $CONFIGURE_FLAGS
# Build the application
make
Since the OE_CMAKE_TOOLCHAIN_FILE
variable is already exported, projects using cmake
can be used directly:
# Download the source archive
wget https://s3.amazonaws.com/json-c_releases/releases/json-c-0.15.tar.gz
# Extract it and go to the source directory
tar xf json-c-0.15.tar.gz
cd json-c-0.15
# Create a build directory and go there
mkdir build
cd build
# Configure the build as usual
cmake ..
# Build the application
make
Once the environment had been initialized, the python3
application was replaced by the one supplied by the toolchain, which has the same version as that embedded in the gateways.
This python3
has a preconfigured sys.path
which uses only the python files supplied by the toolchain sysroot. Your host's python files are therefore not taken into account.
To go further with this SDK, please refer to Yocto documentation
The simpliest way to package, deploy and maintain your application is to create a debian package.
Here are few basics on this package format: https://www.debian.org/doc/manuals/debian-faq/pkg-basics.en.html.
There are various ways to create a debian package. Please adapt it to your application and read documentation of main tools (dpkg-deb
, dpkg-buildpackage
).
Here is a quick example to deploy a shell script named hello-world
:
# Create DEBIAN package working directory
mkdir -p hello-world/DEBIAN
# Create main CONTROL file
cat > hello-world/DEBIAN/control << EOF
Package: hello-world
Version: 1.0
Architecture: all
Maintainer: John Doe <john.doe@mail.com>
Depends: bash
Description: A simple hello-world program
EOF
# Installing hello-world program
mkdir -p hello-world/usr/bin
# Creating tool
cat > hello-world/usr/bin/hello_world << EOF
#!/bin/sh
echo "Hello world"
EOF
chmod 755 hello-world/usr/bin/hello_world
# Creating package
dpkg-deb -v -Zxz --build ./hello-world
After these commands, the resulting hello-world.deb
is created.
It has been built by dpkg-deb
command using ./hello-world
directory.
The content of this directory is:
> tree hello-world
hello-world
├── DEBIAN
│ └── control
└── usr
└── bin
└── hello_world
The resulting deb package can then be installed on target using local installation.
sudo apt install ./hello-world.deb