
NPort 5000 Series User Manual
151
The “make” command would be similar to the following example:
# make -C KDIR=/moxa/kernel M=/home/user/moxa/source ARCH=arm CROSS_COMPILE=arm-
linux-gnueabihf- KVER_MAJOR=4 KVER_MINOR=4 modules
After using the "make" command to cross-compile the drivers, the driver file "npreal2.ko" can be found in
the source code directory.
To cross-compile the daemons and tools, please find "Makefile" in the driver
source folder, then run it.
# make <TARGET> CROSS_COMPILE=<CROSS_COMPILE> CC=<C_COMPILE> CFLAGS=<C_FLAGS>
<TARGET>: Set one of npreal2d, preal2d_redund, and tools.
<CROSS_COMPILE>: The cross-compile toolchain path. If the toolchain is “arm-linux-gnueabihf”, and the
path of toolchain exists in your PATH environment variable, please enter "arm-linux-gnueabihf-" here.
<C_COMPILE>: The C compiler offered by the cross-compiler toolchain. It is "gcc" if the toolchain is "arm-
linux-gnueabihf-".
<C_FLAGS>: Please specify the preprocessor definitions of Real TTY driver here.
NOTE
"-DNO_INIT" must be included or else the cross-compiler may return error messages.
Please see the definitions:
•
"-DNO_INIT": Disable the startup service.
•
"-DOFFLINE_POLLING": Allow tty not to be blocked if the NPort is offline.
e.g.: To build TARGET=npreal2d with a polling feature, please use the following command:
# make npreal2d CROSS_COMPILE="arm-linux-gnueabihf-" CC=gcc CFLAGS="-DNO_INIT -
DOFFLINE_POLLING"
After using the "make" command to cross compile the daemons and tools, the binaries can be found in the
source code directory.
(Optional) Build a secure mode connection to the NPort 6000 Series
When it is required to use a secure mode connection to the NPort 6000 Series, the npreal2d daemon should
be built manually because it needs extra OpenSSL library. This section introduces the secure mode npreal2d
building in addition to the OpenSSL library demonstration. OpenSSL is maintained by
www.openssl.org
.
Most of the Linux distributions have package management tools, such as apt-get or yum, which help you to
install OpenSSL library and development tools. In an Arm platform, it has to be built from the source code.
You may refer to OpenSSL's user guide to generate the library first. The instructions may vary amongst
different OpenSSL versions, cross-compilers, or building hosts.
The demonstration here illustrates the process that Moxa has built for the library for Real TTY driver and for
the Moxa's lab testing.
1.
Create the folders below for OpenSSL products:
$ cd ~
$ mkdir openssl-lib
$ cd openssl-lib
$ mkdir openssl-arm
$ mkdir ssl-arm
2.
Check out the OpenSSL source code. We used a stable branch named OpenSSL-fips-2_0_9. The
command below will download the OpenSSL-fips-2_0_9 source code in the openssl folder.
$ git clone https://github.com/openssl/openssl.git -b OpenSSL-fips-2_0_9