This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| app-notes:cumulocity-agent-in-lxc-container [2017/02/08 10:19] – shasha | app-notes:cumulocity-agent-in-lxc-container [2017/02/10 12:03] (current) – [Build the agent] shasha | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| [[http:// | [[http:// | ||
| + | ====Generate a new SSH public key==== | ||
| + | We need for the agent SSH. We create the key in the lxc container. | ||
| + | <code bash> | ||
| + | ssh-keygen | ||
| + | #The new key | ||
| + | cat / | ||
| + | #cp the key and go to the router and copy the key in this file | ||
| + | vi / | ||
| + | </ | ||
| ====Build the agent==== | ====Build the agent==== | ||
| Now we need to make some installation. | Now we need to make some installation. | ||
| Line 19: | Line 28: | ||
| cd m2m-cumulocity-sdk-c-d627781f3afa | cd m2m-cumulocity-sdk-c-d627781f3afa | ||
| </ | </ | ||
| - | Create an init.mk file, and define specific macros CPPFLAGS, CXXFLAGS and LDFLAGS, LDLIBS and CXX for cross-compiling. | + | Create an init.mk file, and define specific macros CPPFLAGS, CXXFLAGS and LDFLAGS, LDLIBS and CXX for compiling. |
| <code bash> | <code bash> | ||
| - | CXX:=/opt/ | + | CXX:=/usr/bin/g++ |
| - | CPPFLAGS:= -I/usr/local/include | + | CPPFLAGS: |
| CXXFLAGS: | CXXFLAGS: | ||
| - | LDFLAGS:= -L/usr/local/lib | + | LDFLAGS: |
| - | LDLIBS: | + | LDLIBS: |
| </ | </ | ||
| If you have defined init.mk now you have to create the makefile. | If you have defined init.mk now you have to create the makefile. | ||
| <code bash> | <code bash> | ||
| cp Makefile.template Makefile | cp Makefile.template Makefile | ||
| + | </ | ||
| + | Add the Cumulocity agent to the SDK: | ||
| + | <code bash> | ||
| + | tar -xvzf netmodulecumulocityagentlxc.tar.gz | ||
| + | cd netmoduleCumulocityAgentLXC | ||
| + | </ | ||
| + | Move the content of **src** folder to the **src** folders of the SDK. | ||
| + | <code bash> | ||
| + | cp src/* sdk_folder/ | ||
| + | #Copy also the srtemplate.txt | ||
| + | cp srtemplate.txt sdk_folder/ | ||
| + | </ | ||
| + | Edit the configfile (c8yAgent.conf) and move it. | ||
| + | <code bash> | ||
| + | cp c8yAgent.conf /etc/ | ||
| + | </ | ||
| + | Now we can build the agent. | ||
| + | <code bash> | ||
| + | make | ||
| + | |||
| + | #If you want, you can delete all and rebuild again: | ||
| + | make clean | ||
| + | make | ||
| + | </ | ||
| + | Now go to the **src** folder. | ||
| + | <code bash> | ||
| + | make | ||
| + | chmod 775 -R main | ||
| + | </ | ||
| + | <code bash> | ||
| + | ./main | ||
| </ | </ | ||