Difference between revisions of "IoTGateway/BSP/Linux/AM335x/System Service and Usage"

From ESS-WIKI
Jump to: navigation, search
 
(15 intermediate revisions by the same user not shown)
Line 34: Line 34:
  
 
== <span style="color:#0070c0">Ssh server</span> ==
 
== <span style="color:#0070c0">Ssh server</span> ==
 +
When boot up the target board, the ssh service is already started by default. You can run the
 +
following command on your host PC to login the target system:
 +
<pre>
 +
hostPC$ sudo ssh -l root TARGET_SYSTEM_IP
 +
</pre>
  
== <span style="color:#0070c0">Telnet Server</span> ==
+
== <span style="color:#0070c0">telnet Server</span> ==
 +
When boot up the target board, the telnet service is already started by default. You can run the
 +
following command on your host PC to login the target system:
 +
<pre>
 +
hostPC$ sudo telnet TARGET_SYSTEM_IP
 +
</pre>
  
 
== <span style="color:#0070c0">http Server</span> ==
 
== <span style="color:#0070c0">http Server</span> ==
 +
We support an embedded web server name lighttpd and the matrix gui is based on it.
  
=Other Application=
+
= Other Application =
 +
== <span style="color:#0070c0">Network configuration</span> ==
 +
 
 +
=== Configuration via UI ===
 +
 
 +
You can get an IP address via dhcp, also you can configure a static IP address for AM335x advantech platform. Click on the "Network Cfg" icon on the screen. Then Advantech NIC Configuration utility will be started. You can do some configuration of NIC. [[File:Time1.png|RTENOTITLE]]
 +
 
 +
As a choice, you can also do the network configuration by console using telnet. Run the following command on target system: Get IP by DHCP:
 +
<pre>advantech# /etc/init.d/dhcpc eth0 start
 +
advantech# /etc/init.d/dhcpc eth1 start
 +
</pre>
 +
 
 +
If you want to reserve the setting after rebooting the device, set as below
 +
<pre>advantech# echo "/etc/init.d/dhcpc eth0 start" > /etc/adv.d/netcfg.eth0
 +
advantech# echo "/etc/init.d/dhcpc eth1 start" > /etc/adv.d/netcfg.eth1
 +
</pre>
 +
 
 +
Set static IP: Stop the DHCP process
 +
<pre>advantech# /etc/init.d/dhcpc eth0 stop
 +
advantech# /etc/init.d/dhcpc eth1 stop
 +
</pre>
 +
 
 +
Set the static IP as below.
 +
<pre>advantech# /sbin/ifconfig eth0 172.21.73.191 netmask 255.255.255.0
 +
advantech# /sbin/route add default gw 172.21.73.253 eth0
 +
advantech# echo 'nameserver 172.21.128.251' >> /etc/resolv.conf
 +
advantech# /sbin/ifconfig eth1 192.168.3.102 netmask 255.255.255.0
 +
advantech# /sbin/route add default gw ... eth1
 +
advantech# echo 'nameserver 172.21.128.251' >> /etc/resolv.conf
 +
</pre>
 +
 
 +
If you want to reserve the setting after rebooting the device, set as below
 +
<pre>advantech# echo "/sbin/ifconfig eth0 172.21.73.191 netmask 255.255.255.0; /sbin/route add
 +
default gw 172.21.73.253 eth0;echo 'nameserver 172.21.128.251' > /etc/resolv.conf;" >
 +
/etc/adv.d/netcfg.eth0
 +
advantech# echo "/sbin/ifconfig eth1 192.168.3.102 netmask 255.255.255.0; /sbin/route add
 +
default gw ... eth1;echo 'nameserver 172.21.128.251' > /etc/resolv.conf;" >
 +
/etc/adv.d/netcfg.eth1
 +
</pre>
 +
 
 +
<font color="#FF0000">Note: The IP address in above should be replaced according to user’s the requirement. For examples: IP 172.21.128.251 in above is the DNS server’s IP, user should replace it with the correct DNS IP address.</font>
 +
 
 +
== <span style="color:#0070c0">Date/Time Configuration</span> ==
 +
 
 +
You can use the tool we provide to modify the system time. Click on the "Time Settings" icon on the screen. Then Advantech Date/Time Settings utility will be started.<br/>[[File:Time2.png|RTENOTITLE]]<br/>After the time is adjusted, please click “OK” button, and the date will be saved. Meanwhile, the RTC time will be synchronized to the time you just set.
 +
 
 +
== <span style="color:#0070c0">About System</span> ==
 +
 
 +
If you want to know the version information of this system, you can see it with the utility on App Launcher. Click on the “About System” icon on the screen, and you will see the version information of this system. [[File:Time4.png|RTENOTITLE]]<br/><font color="#FF0000">Note. This is a optional way to get version info under console. You can use “version” command to achieve this as flowing:</font>
 +
<pre>root@am335x-adv:~# version
 +
Bsp version: RSB-4220 V1.000
 +
Device name: RSB-4220
 +
Release date: 2014-10-09
 +
Kernel version: 3.2.0
 +
</pre>
 +
 
 +
== <span style="color:#0070c0">Brightness Control</span> ==
 +
 
 +
We provide a gui application to control the brightness. So, you can conveniently adjust the screen brightness.<br/>[[File:Time5.png|RTENOTITLE]]
 +
 
 +
== <span style="color:#0070c0">Serial Tools</span> ==
 +
 
 +
We have five serial ports, named ttyO1~ttyO5. And we provide a serial test tool to let it easily to validate the serial ports.<br/>[[File:Time6.png|RTENOTITLE]]
 +
 
 +
== <span style="color:#0070c0">Matrix GUI User‘s Guide</span> ==
 +
 
 +
=== Overview ===
 +
 
 +
When you boot up the target system, Matrix GUI should be automatically started. Matrix is an HTML 5 based application launcher created to highlight available applications and demos provided. There are two forms of Matrix, local and remote Matrix. All of the example applications and demos are available using either the local or remote version. Matrix comes as a 6x4 matrix of icons or as a 4x3 matrix depending on the display resolution. The launcher for Matrix is just a simple QT application that displays a Webkit base browser that points to the URL [http://localhost:80 http://localhost:80]. [[File:Timer7.png|RTENOTITLE]]
 +
 
 +
=== Launching and Stopping Matrix ===
 +
 
 +
If the Matrix GUI does not start with the system, you can manually start the program by the following command:
 +
<pre>advantech# /etc/init.d/matrix-gui-2.0 start
 +
</pre>
 +
 
 +
If you want the Matrix to start with the system by default, please run the following command
 +
<pre>advantech# cp /etc/init.d/matrix-gui-2.0 /etc/rc5.d/S97matrix-gui-2.0
 +
</pre>
 +
 
 +
When you want to cancel the default startup, just remove the S97matrix-gui-2.0 file. For more information on the use of Matrix, please refer to the following website: [http://processors.wiki.ti.com/index.php/Matrix_Users_Guide http://processors.wiki.ti.com/index.php/Matrix_Users_Guide].
 +
 
 +
=== Adding a Matrix Application ===
 +
 
 +
Below are step-by-step instructions for Adding a New Application/Directory to Matrix.
 +
 
 +
*Create a new folder on your target file system at /usr/share/matrix-gui-2.0/apps/. The name should be a somewhat descriptive representation of the application or directory. The folder name must be different from any existing folders at that location.
 +
*Create a desktop file based on the parameters discussed below. It is recommended the name of the desktop file match the name of the newly created folder. No white spaces can be used for the desktop filename. The desktop file parameters should be set depending on if you want to add a new application or a new directory to Matrix. The Type field must be set according to
 +
 
 +
your decision. The desktop file must have the desktop suffix.
 +
 
 +
*Update the Icon field in the desktop to refer to any existing Icon in the /usr/share/matrix-gui-2.0 directory or subdirectories. You can also add a new 96x96 png image and place it into your newly created folder.
 +
*Optionally for applications you can add a HTML file that contains the application description in your newly created directory. If you add a description page then update the X-Matrix-Description field in the .desktop file.
 +
*Refresh Matrix using the application "Refresh Matrix" located in the Settings submenu. Blank template icons for Matrix can be found here:
 +
 
 +
http:// gforge.ti.com/gf/download/frsrelease/712/5167/blank_icons_1.1.tar.gz The .desktop file is based on standard specified at the URL: http:// standards.freedesktop.org/desktop-entry-spec/latest/ Additional fields were added that are unique for Matrix. Format for each parameter: &lt;Field&gt;=&lt;Value&gt; The fields and values are case sensitive.
 +
 
 +
== <span style="color:#0070c0">Screen rotation for Qt application</span> ==
 +
 
 +
Please export the Environments:
 +
<pre>export QWS_DISPLAY=Transformed:Rot90
 +
</pre>
 +
or run directly run&nbsp;:<pre>./exmaple -qws -display "Transformed:Rot270"
 +
</pre>
 +
 
 +
== <span style="color:#0070c0">Add a Startup items when boot</span> ==
 +
 
 +
*Remove a Startup items:
 +
<pre>update-rc.d [-n] [-f] [-r <root>] <basename> remove </pre>
 +
 
 +
basename is your service script name
 +
<pre> eg. update-rc.d -f matrix-gui-2.0 remove </pre>
 +
 
 +
*Add a Startup items:
 +
 
 +
Firstly,You must ensure that the service script is exists,then run the flowing command:
 +
<pre> update-rc.d [-n] [-r <root>] [-s] <basename> start|stop NN runlvl [runlvl] [...] . </pre>
 +
 
 +
start|stop&nbsp;: when system start /shutdown the basename wiil run automatically<br/>NN: 0~99<br/>runlvl: advantech AM335x platform runlevel is 5(default);
 +
<pre> eg. update-rc.d networking start 40 5 . </pre>
 +
 
 +
then you can find the S40networking in rc5.d directory;
 +
 
 +
== <span style="color:#0070c0">Package online install</span> ==
 +
 
 +
=== OPKG Package Manager ===
 +
 
 +
Opkg is a lightweight package management system. It is written in C and resembles apt/dpkg/yum in operation. It is intended for use on embedded Linux devices and is used in this capacity in the OpenEmbedded and OpenWrt projects. Advantech Embedded Linux for am335x advantech platfrom has built-in OPKG package manager, with this tool you can install most of the required software online, and manage them, such as uninstall, upgrades and so on.
 +
 
 +
=== Installation New Software package ===
 +
 
 +
If you want to install a software which is not exist in the current OS, you should follow the steps below:<br/>'''Step 1:''' Update the online software source:
 +
<pre>advantech# opkg update
 +
</pre>
 +
 
 +
'''Step 2:''' Search whether the software source server has the software you need.
 +
<pre>
 +
advantech# opkg list | grep package
 +
</pre>
 +
 
 +
<font color="#FF0000">Note. Package is the keywords of the software name, for example, you want to search an ftp server, and the package should be ‘ftp’. </font> <br>
 +
 
 +
'''Step 3:''' Find the full name of the software you need in the search result list. And install it by following command:
 +
<pre>
 +
advantech# opkg install packagename
 +
</pre>
 +
 
 +
=== More about OPKG ===
 +
 
 +
More about use and development of OPKG, Please refer to the project website of OPKG: [https://code.google.com/p/opkg/ https://code.google.com/p/opkg/]

Latest revision as of 03:01, 30 September 2016

Service

Advantech has built five common network services for am335x advantech platform: tftp service, ftp service, ssh service, telnet service and http service.

Tftp Server

When boot up the target board, the tftp service is already started by default(am335x advantech platform) and the tftp server’s working directory is /tftpboot. You need execute “chmod 777 /tftpboot” on target system to let the tftp server work. Then, user can tftp to target board by tftp client in host PC. Use command to get and put file like this:

hostPC$ tftp TARGET_SYSTEM_IP
tftp>get file1
tftp>put file2

Command “get file1” is to download file1 from tftp server. File “file1” must exist under the directory /tftpboot on your target filesystem; Command “put file2” is to upload file2 to tftp server. If put file2 success, file2 will be put to directory /tftpboot on your target filesystem;

Ftp server

The ftp server on target system is vsftpd and you should manually start it using flowing command:

root@am335x-adv:/ # /etc/init.d/vsftpd start

While, the stoping command is:

root@am335x-adv:/ # /etc/init.d/vsftpd stop

Note. After start the ftp server. You had to manually add user ftp:

root@am335x-adv:/ # adduser ftp
root@am335x-adv:/ # chown root:root /home/ftp/

Then you can ftp your target board using user ftp.

Ssh server

When boot up the target board, the ssh service is already started by default. You can run the following command on your host PC to login the target system:

hostPC$ sudo ssh -l root TARGET_SYSTEM_IP

telnet Server

When boot up the target board, the telnet service is already started by default. You can run the following command on your host PC to login the target system:

hostPC$ sudo telnet TARGET_SYSTEM_IP

http Server

We support an embedded web server name lighttpd and the matrix gui is based on it.

Other Application

Network configuration

Configuration via UI

You can get an IP address via dhcp, also you can configure a static IP address for AM335x advantech platform. Click on the "Network Cfg" icon on the screen. Then Advantech NIC Configuration utility will be started. You can do some configuration of NIC. RTENOTITLE

As a choice, you can also do the network configuration by console using telnet. Run the following command on target system: Get IP by DHCP:

advantech# /etc/init.d/dhcpc eth0 start
advantech# /etc/init.d/dhcpc eth1 start

If you want to reserve the setting after rebooting the device, set as below

advantech# echo "/etc/init.d/dhcpc eth0 start" > /etc/adv.d/netcfg.eth0
advantech# echo "/etc/init.d/dhcpc eth1 start" > /etc/adv.d/netcfg.eth1

Set static IP: Stop the DHCP process

advantech# /etc/init.d/dhcpc eth0 stop
advantech# /etc/init.d/dhcpc eth1 stop

Set the static IP as below.

advantech# /sbin/ifconfig eth0 172.21.73.191 netmask 255.255.255.0
advantech# /sbin/route add default gw 172.21.73.253 eth0
advantech# echo 'nameserver 172.21.128.251' >> /etc/resolv.conf
advantech# /sbin/ifconfig eth1 192.168.3.102 netmask 255.255.255.0
advantech# /sbin/route add default gw ... eth1
advantech# echo 'nameserver 172.21.128.251' >> /etc/resolv.conf

If you want to reserve the setting after rebooting the device, set as below

advantech# echo "/sbin/ifconfig eth0 172.21.73.191 netmask 255.255.255.0; /sbin/route add
default gw 172.21.73.253 eth0;echo 'nameserver 172.21.128.251' > /etc/resolv.conf;" >
/etc/adv.d/netcfg.eth0
advantech# echo "/sbin/ifconfig eth1 192.168.3.102 netmask 255.255.255.0; /sbin/route add
default gw ... eth1;echo 'nameserver 172.21.128.251' > /etc/resolv.conf;" >
/etc/adv.d/netcfg.eth1

Note: The IP address in above should be replaced according to user’s the requirement. For examples: IP 172.21.128.251 in above is the DNS server’s IP, user should replace it with the correct DNS IP address.

Date/Time Configuration

You can use the tool we provide to modify the system time. Click on the "Time Settings" icon on the screen. Then Advantech Date/Time Settings utility will be started.
RTENOTITLE
After the time is adjusted, please click “OK” button, and the date will be saved. Meanwhile, the RTC time will be synchronized to the time you just set.

About System

If you want to know the version information of this system, you can see it with the utility on App Launcher. Click on the “About System” icon on the screen, and you will see the version information of this system. RTENOTITLE
Note. This is a optional way to get version info under console. You can use “version” command to achieve this as flowing:

root@am335x-adv:~# version
Bsp version: RSB-4220 V1.000
Device name: RSB-4220
Release date: 2014-10-09
Kernel version: 3.2.0

Brightness Control

We provide a gui application to control the brightness. So, you can conveniently adjust the screen brightness.
RTENOTITLE

Serial Tools

We have five serial ports, named ttyO1~ttyO5. And we provide a serial test tool to let it easily to validate the serial ports.
RTENOTITLE

Matrix GUI User‘s Guide

Overview

When you boot up the target system, Matrix GUI should be automatically started. Matrix is an HTML 5 based application launcher created to highlight available applications and demos provided. There are two forms of Matrix, local and remote Matrix. All of the example applications and demos are available using either the local or remote version. Matrix comes as a 6x4 matrix of icons or as a 4x3 matrix depending on the display resolution. The launcher for Matrix is just a simple QT application that displays a Webkit base browser that points to the URL http://localhost:80. RTENOTITLE

Launching and Stopping Matrix

If the Matrix GUI does not start with the system, you can manually start the program by the following command:

advantech# /etc/init.d/matrix-gui-2.0 start

If you want the Matrix to start with the system by default, please run the following command

advantech# cp /etc/init.d/matrix-gui-2.0 /etc/rc5.d/S97matrix-gui-2.0

When you want to cancel the default startup, just remove the S97matrix-gui-2.0 file. For more information on the use of Matrix, please refer to the following website: http://processors.wiki.ti.com/index.php/Matrix_Users_Guide.

Adding a Matrix Application

Below are step-by-step instructions for Adding a New Application/Directory to Matrix.

  • Create a new folder on your target file system at /usr/share/matrix-gui-2.0/apps/. The name should be a somewhat descriptive representation of the application or directory. The folder name must be different from any existing folders at that location.
  • Create a desktop file based on the parameters discussed below. It is recommended the name of the desktop file match the name of the newly created folder. No white spaces can be used for the desktop filename. The desktop file parameters should be set depending on if you want to add a new application or a new directory to Matrix. The Type field must be set according to

your decision. The desktop file must have the desktop suffix.

  • Update the Icon field in the desktop to refer to any existing Icon in the /usr/share/matrix-gui-2.0 directory or subdirectories. You can also add a new 96x96 png image and place it into your newly created folder.
  • Optionally for applications you can add a HTML file that contains the application description in your newly created directory. If you add a description page then update the X-Matrix-Description field in the .desktop file.
  • Refresh Matrix using the application "Refresh Matrix" located in the Settings submenu. Blank template icons for Matrix can be found here:

http:// gforge.ti.com/gf/download/frsrelease/712/5167/blank_icons_1.1.tar.gz The .desktop file is based on standard specified at the URL: http:// standards.freedesktop.org/desktop-entry-spec/latest/ Additional fields were added that are unique for Matrix. Format for each parameter: <Field>=<Value> The fields and values are case sensitive.

Screen rotation for Qt application

Please export the Environments:

export QWS_DISPLAY=Transformed:Rot90
or run directly run :
./exmaple -qws -display "Transformed:Rot270"

Add a Startup items when boot

  • Remove a Startup items:
update-rc.d [-n] [-f] [-r <root>] <basename> remove 

basename is your service script name

 eg. update-rc.d -f matrix-gui-2.0 remove 
  • Add a Startup items:

Firstly,You must ensure that the service script is exists,then run the flowing command:

 update-rc.d [-n] [-r <root>] [-s] <basename> start|stop NN runlvl [runlvl] [...] . 

start|stop : when system start /shutdown the basename wiil run automatically
NN: 0~99
runlvl: advantech AM335x platform runlevel is 5(default);

 eg. update-rc.d networking start 40 5 . 

then you can find the S40networking in rc5.d directory;

Package online install

OPKG Package Manager

Opkg is a lightweight package management system. It is written in C and resembles apt/dpkg/yum in operation. It is intended for use on embedded Linux devices and is used in this capacity in the OpenEmbedded and OpenWrt projects. Advantech Embedded Linux for am335x advantech platfrom has built-in OPKG package manager, with this tool you can install most of the required software online, and manage them, such as uninstall, upgrades and so on.

Installation New Software package

If you want to install a software which is not exist in the current OS, you should follow the steps below:
Step 1: Update the online software source:

advantech# opkg update

Step 2: Search whether the software source server has the software you need.

advantech# opkg list | grep package

Note. Package is the keywords of the software name, for example, you want to search an ftp server, and the package should be ‘ftp’.

Step 3: Find the full name of the software you need in the search result list. And install it by following command:

advantech# opkg install packagename

More about OPKG

More about use and development of OPKG, Please refer to the project website of OPKG: https://code.google.com/p/opkg/