Difference between revisions of "AIMLinux/AddOn/DeviceOn"

From ESS-WIKI
Jump to: navigation, search
Line 44: Line 44:
  
 
== <span style="color:#0070c0">Bundle Mechanism</span> ==
 
== <span style="color:#0070c0">Bundle Mechanism</span> ==
 +
 +
To generate an eMMC hex binary which is a specific official release with DeviceOn enabled, you can refer to the steps below.
 +
 +
=== <span style="color:#0070c0">DeviceOn Installation</span> ===
 +
 +
1. Install RMM EI Agent
 +
 +
You can get the latest official release of RMM EI agent here.
 +
 +
<code>\\eossfs\WISE-PaaS\WISE-PaaS2.0\Release</code>
 +
 +
During the installation, do not configure at this moment.
 +
 +
* Setup Agent [y/n](default:n): '''<span style="color:#DD0000">y</span>'''
 +
* Do you want to configure RMM Agent now? [y/n](default: y) '''<span style="color:#DD0000">n</span>'''
 +
* Do you want to start RMM Agent now? [y/n](default: y) '''<span style="color:#DD0000">n</span>'''
 +
 +
2. Install CreateAccount
 +
 +
Get CreateAccount program and install with npm.
 +
 +
export GIT_SSL_NO_VERIFY=1
 +
git clone [https://eiot-gitlab.eastasia.cloudapp.azure.com/ei-paas-rmm/createaccount.git https://eiot-gitlab.eastasia.cloudapp.azure.com/ei-paas-rmm/createaccount.git]
 +
cd createaccount/
 +
npm install
 +
 +
After installation, copy all files into '''/usr/local/AgentService/''' folder except ''agent_config.xml''.
 +
 +
rm agent_config.xml
 +
cp -a * /usr/local/AgentService/
 +
 +
3. Set up Zero-Config service
 +
 +
'''[SysV]'''
 +
 +
cp ./zero-config /etc/init.d
 +
chown root:root /etc/init.d/zero-config
 +
chmod 0750 /etc/init.d/zero-config
 +
update-rc.d -f zero-config remove
 +
update-rc.d zero-config defaults 99 20
 +
 +
The content of zero-config:
 +
 +
#!/bin/sh
 +
 +
SERVICE_PATH="/usr/local/AgentService/"
 +
SERVICE_PROGRAM="node index.js"
 +
 +
# Source function library.
 +
. /etc/init.d/functions
 +
 +
case "$1" in
 +
    start)
 +
        echo -n "Starting CreateAccount: "
 +
        cd $SERVICE_PATH
 +
        $SERVICE_PROGRAM > /dev/null 2>&1
 +
        RETVAL=$?
 +
        if [ $RETVAL -eq 0 ]; then
 +
            echo "OK"
 +
        else
 +
            echo "Failure"
 +
        fi
 +
        &nbsp;;;
 +
    *)
 +
        echo "Usage: $0 {start}"
 +
        exit 1
 +
        &nbsp;;;
 +
esac
 +
 +
exit 0
 +
 +
=== <span style="color:#0070c0">Configuration</span> ===
 +
 +
=== <span style="color:#0070c0">First Boot</span> ===
  
 
== <span style="color:#0070c0">Connect to Server</span> ==
 
== <span style="color:#0070c0">Connect to Server</span> ==
  
Once you are ready to boot devices with DeviceOn, connect to [https://deviceonapp.wise-paas.com/#/deviceon/DeviceQRCode DeviceQRCode] website and input the MAC address of your device.
+
Once you are ready to boot devices with DeviceOn, connect to '''[https://deviceonapp.wise-paas.com/#/deviceon/DeviceQRCode DeviceQRCode]''' website and input the MAC address of your device.
  
If your devices have multiple Ethernet interfaces, use the following commands to confirm the associated MAC address.
+
If your device has multiple Ethernet interfaces, use the following command to confirm the associated MAC.
  
 
  $ cat /usr/local/AgentService/agent_config.xml | grep SN
 
  $ cat /usr/local/AgentService/agent_config.xml | grep SN
Line 63: Line 137:
  
 
[[File:Deviceon home.png|800px|deviceon_home]]
 
[[File:Deviceon home.png|800px|deviceon_home]]
 
 
  
  
Line 73: Line 145:
  
 
== <span style="color:#0070c0">OTA Handler</span> ==
 
== <span style="color:#0070c0">OTA Handler</span> ==
 +
 +
== <span style="color:#0070c0">SUSI 4.0 & SUSI-IoT</span> ==
  
 
== <span style="color:#0070c0">Service-SDK</span> ==
 
== <span style="color:#0070c0">Service-SDK</span> ==
 
== <span style="color:#0070c0">SUSI 4.0 & SUSI-IoT</span> ==
 
  
 
== <span style="color:#0070c0">OPC-UA</span> ==
 
== <span style="color:#0070c0">OPC-UA</span> ==

Revision as of 07:29, 25 September 2019

DeviceOn

This section describes the information about DeviceOn on RISC platform.

Requirements for Build Environment

To cross-compile DeviceOn agent, you have to install dependencies into SDK toolchain.

Please refer to packagegroup-wise-paas.bb and sdk.inc for details. These two files are used on Yocto to generate suitable image & toolchain for DeviceOn.

For Debian/Ubuntu, you can refer to mk-adv.sh which we use to build rootfs for RK platform.

Build Instruction

Make sure you have set up SDK toolchain environment, before start building RMM EI agent.

For RK platforms, you have to set up chroot environment instead of SDK toolchain.

# Get source
git clone http://advgitlab.eastasia.cloudapp.azure.com/EI-PaaS-RMM/RMM-EI-Agent.git
cd RMM-EI-Agent

# Choose one for your platform
source risc-env fsl imx6 yocto 2.1
source risc-env fsl imx8 yocto
source risc-env qualcomm dragon yocto
source risc-env ti am335x yocto 2.4
source risc-env rk 3399 debian
source risc-env rk 3288 debian

# Build
make clean
cd build/Standard
./autobuild.sh

After build process is complete, you can get the installer (.run) and tarball files in Wrapped/ folder.

$ ls Wrapped/
wise-agent-Poky_2.1.1 imx6-1.2.14.0-binary.tar.gz
wise-agent-Poky_2.1.1 imx6-1.2.14.0.run
wise-agent-Poky_2.1.1 imx6-1.2.14.0.run.tar.gz

In addition, you can check the output binaries in Release/AgentService/ folder as well.

Bundle Mechanism

To generate an eMMC hex binary which is a specific official release with DeviceOn enabled, you can refer to the steps below.

DeviceOn Installation

1. Install RMM EI Agent

You can get the latest official release of RMM EI agent here.

\\eossfs\WISE-PaaS\WISE-PaaS2.0\Release

During the installation, do not configure at this moment.

* Setup Agent [y/n](default:n): y
* Do you want to configure RMM Agent now? [y/n](default: y) n
* Do you want to start RMM Agent now? [y/n](default: y) n

2. Install CreateAccount

Get CreateAccount program and install with npm.

export GIT_SSL_NO_VERIFY=1
git clone https://eiot-gitlab.eastasia.cloudapp.azure.com/ei-paas-rmm/createaccount.git
cd createaccount/
npm install

After installation, copy all files into /usr/local/AgentService/ folder except agent_config.xml.

rm agent_config.xml
cp -a * /usr/local/AgentService/

3. Set up Zero-Config service

[SysV]

cp ./zero-config /etc/init.d
chown root:root /etc/init.d/zero-config
chmod 0750 /etc/init.d/zero-config
update-rc.d -f zero-config remove
update-rc.d zero-config defaults 99 20

The content of zero-config:

#!/bin/sh

SERVICE_PATH="/usr/local/AgentService/"
SERVICE_PROGRAM="node index.js"

# Source function library.
. /etc/init.d/functions 

case "$1" in
    start)
        echo -n "Starting CreateAccount: "
        cd $SERVICE_PATH
        $SERVICE_PROGRAM > /dev/null 2>&1
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
            echo "OK"
        else
            echo "Failure"
        fi
        ;;
    *)
        echo "Usage: $0 {start}"
        exit 1
        ;;
esac

exit 0

Configuration

First Boot

Connect to Server

Once you are ready to boot devices with DeviceOn, connect to DeviceQRCode website and input the MAC address of your device.

If your device has multiple Ethernet interfaces, use the following command to confirm the associated MAC.

$ cat /usr/local/AgentService/agent_config.xml | grep SN
   <SN>00049F0130E0</SN>

1. Click the button to generate QR code

2. Click the QR code or scan it with camera

deviceon_qrcode

The QR code will re-direct to DeviceOn home page. Then, enjoy it!

deviceon_home


Additional Modules

This section describes how to build & deploy additional plug-in for DeviceOn.

OTA Handler

SUSI 4.0 & SUSI-IoT

Service-SDK

OPC-UA

Modbus Handler