cross compile z-connector for ARM?

Discussions about Z-Way software and Z-Wave technology in general
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

"Why are you compiling on the

Post by pz1 »

"Why are you compiling on the Synology box and not on your PC (cross-compilation)?"

I really have no idea. I read somewhere on the Synology forum that I had to compile on the target machine. So that is what I did. This unix stuff is hard. It is to darn complicated and user-hostile. But I am determined to crack it now. It escapes me totally that one can have several files with the name ssl.h, but apparantly with different content depending on where it is located. At least that is what I infer from seeing my results.

I think I have to install openssl-dev with IPKG. That is available for my machine. It will take a bit of time, because I had to do a firmware upgrade on my Synobox. That ruined my settings.
I'll be back.
Since 29-12-2016 I am no longer a moderator for this forum
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Thanks. As you see in my next

Post by pz1 »

Thanks. As you see in my next post I had progressed in the meantime. Unfortunately there are not as many Linux experts around on the Synology forum as there used to be. Peoples interest are more with phones than with these little embedded systems. I do appreciate the close support you give. I hope it will help others. That is why I am verbose in my comments. I try to describe it so, mutatis mutandis, it can be applied to all Synology devices.
Since 29-12-2016 I am no longer a moderator for this forum
User avatar
PoltoS
Posts: 7624
Joined: 26 Jan 2011 19:36

The first error was caused by

Post by PoltoS »

The first error was caused by the way you run the script. Use./Run_Z_Agent.shto bypass this problem and come to next :)Second problem i caused by specific paths to libraries. UseLD_LIBRARY_PATH=path1:path2:path3 ./z-agentto run the binary. path1, path2 and path3 should point to paths where libssl.so, libargtable2.so, libz.so and libc.so are located. Once you do it correctly (it runs and gives you the legent about how to run it), add this LD_LIBRARY_PATH=path1:path2:path3 at the beginning of the corresponding line in Run_Z_Agent.sh.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

One more step further. I

Post by pz1 »

One more step further. I managed to build the argtable2. So the compilation of Z-agent completed with:

g++ ioutil.o main.o log.o serial.o ssl.o -lssl -largtable2 -lcrypto -o z-agent
# Trying to copy z-agent to ../Release folder
cp z-agent ../Release

Next I tried to run the script, which again gives an error that I do not understand:
DS212> sh Run_Z-Agent.sh
Run_Z-Agent.sh: line 9: Run_Z-Agent.sh/z-agent: not found

edit: Via a telnet session as root I had unzipped the Z-Connector to volume1public. I did compile in /volume1/public/zwave/Z-Connector/Unix. This resulted in executable:
-rwxr-xr-x 1 root root 22402 May 26 11:33 z-agent
I I try to start z-agent, it says:
DS212> ./z-agent
./z-agent: error while loading shared libraries: libssl.so.0.9.8: cannot open sh
ared object file: No such file or directory.
This libssl does exist in /opt/lib. So there is a path issue I must solve.
20120527-12:12. I found that also libargtable2 was missing. Found some clues in other threads here, so I added to file Run_Z-Agent.sh the following two lines:

#!/bin/bash

LD_LIBRARY_PATH=/opt/lib:/usr/local/lib
export LD_LIBRARY_PATH

Then I got the error Failed to open device which I suspect is due to the fact that my Z-Stick in not in the Linux machine, because I need it for some testing on Windows. To be continued...
Since 29-12-2016 I am no longer a moderator for this forum
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

The command ./Run_Z_Agent.sh

Post by pz1 »

The command ./Run_Z_Agent.sh did not work, because bash was not recognised. For my Synology I had to change the first line of the script in #!/bin/ash
Since 29-12-2016 I am no longer a moderator for this forum
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Found Z-stick Driver for DS212+

Post by pz1 »

I found on the Synology fora a product called SynoZwave, which is based on OpenZwave. The package included a driver for the Aeon stick, so Installed it. I stopped that program shortly after it appeared to work. (Actually you can uninstall it, because it leaves the Z-stick drivers. Be aware those drivers are deleted at a firmware upgrade. It is a nasty workaround in case you couldn't find proper drivers elsewhere)
I did a dmesg, where the last line read:
[ 296.790000] usb 1-1.3: cp210x converter now attached to ttyUSB0
So I guess it is installed correctly
The installation was not yet full proof at the time I got it, so I had to execute in a telnet session:
mknod /dev/ttyUSB0 c 188 0
May be that is fixed in a later version. You just issue that command if your installation does not work at the first instance. Note: SynoZwave is a french hobby project at the moment. Do not expect commercial class services)

Next I started as decribed in a response here above.
DS212> LD_LIBRARY_PATH=/opt/lib:/usr/local/lib ./z-agent -s z-cloud.z-wave.me --
cacert ../Certificates/cacert.pem --cert ../Certificates/cert.pem --key ../Certi
ficates/cert.key -d /dev/ttyUSB0
Opening device...
Connecting to server...
Establishing SSL connection...
Performing SSL handshake...
Establishing SSL connection...
Performing SSL handshake...
Loop started

Now I connect to the WEBsite and have access to my installation. That's progress
What remains to be done is
* to get the program in a proper space, so it won't be deleted by the next synology update
* to let z-agent automatically start at boot
* get to grips with compiling the Aeon driver myself, so I can get a shadow copy running on the DS207+ box
Since 29-12-2016 I am no longer a moderator for this forum
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

It is working now for me on Synology DS212+

Post by pz1 »

I have a step by step instruction on how I got this working on DS212+. It functions, but should be polished further. I intend to that, and report further only in that space, in order to avoid discrepancies between what I say here and there.
PoltoS, thanks for your patience and support
Since 29-12-2016 I am no longer a moderator for this forum
Post Reply