Compiling Z-Connector for OpenWRT, DD-WRT routers and their clones
Posted: 10 Sep 2011 23:55
This short post describes how to compile Z-Connector for OpenWRT family routers.We suppose you are familiar with Linux and with OpenWRT. The following description is not a final script - you will need to edit some variables!# Compiling ipkg package of Z-Connector for OpenWRT and DD-WRT routers and their clones
#
# Be sure to enable IPKG on your router. Some routers require JFFS or external storage to be enabled
#
# Download your personal Z-Connector from www.z-wave.me web site and decopress it on your Linux (we suppose it is Ubunu)
#
# Run this script from the directory of Z-Connector (where Unix and Windows folder are located)
# Install flex utility
sudo apt-get install flex
# Install SVN OpenWRT tree
svn co svn://svn.openwrt.org/openwrt/branches/backfire
cd backfire
# Install feeds
./scripts/feeds update -a
./scripts/feeds install argtable
# copy Z-Connector to the tree
mkdir packages/z-connector
cp -R ../Unix packages/z-connector/src
mv packages/z-connector/src/Makefile_OpenWRT packages/z-connector/Makefile
(cd package/z-connector/src; make clean)
make menuconfig
# select Target System
# save the config
make package/z-connector-compile
make package/openssl-compile
make package/feeds/packages/argtable-compile
# Specify correct ARCH
ARCH=[[Arch]]
OpenWRThost=[[IP]]
# Copy to the router
scp bin/$ARCH/packages/argtable*.ipk bin/$ARCH/packages/z-connector*.ipk bin/$ARCH/packages/libopenssl*.ipk bin/$ARCH/packages/zlib*.ipk root@$OpenWRThost:/tmp
# Install on the router
ssh root@$OpenWRThost ipkg install /tmp/argtable*.ipk /tmp/z-connector*.ipk /tmp/libopenssl*.ipk /tmp/zlib*.ipk
# Now you need to copy Certificates somewhere on the router
scp -r ../Certificates root@$OpenWRThost:[[cert directory]]
# And probably load modules for your stick
ssh root@$OpenWRThost ipkg install kmod-usb-serial-pl2303
insmod pl2303
# or
ssh root@$OpenWRThost ipkg install kmod-usb-core kmod-usb-acm
insmod acm
# Then you can try to start z-connector on your roter using:
root@OpenWRT:/ # CERT_DIR=[[cert directory]]
root@OpenWRT:/ # DEVICE=[[DEVICE]]
root@OpenWRT:/ # z-connector -d $DEVICE -s z-cloud.z-wave.me --cert=$CERT_DIR/cert.pem --key=$CERT_DIR/cert.key --cacert=$CERT_DIR/cacert.pem
# Final step is to make startup script, but this depends on your router! Something like:
#!/bin/bash
# replace [[XXX]] with appropriate value
BIN_PATH=[[path to z-connector]] # path to z-connector binary: /usr/bin/, /jffs/bin, /opt/bin or some other depending on your router
CERT_DIR=[[cert directiry]] # directory where you have stored certificates
DEVICE=[[Device]] # /dev/ttyUSB0, /dev/ttyACM0, /dev/usb/tty/0 or another depending on the Z-Wave hardware and kernel version you have
while [ 1 ] do
$BIN_PATH/z-connector -d $DEVICE -s z-cloud.z-wave.me --cert=$CERT_DIR/cert.pem --key=$CERT_DIR/cert.key --cacert=$CERT_DIR/cacert.pem
sleep 1 # spare the CPU
done
Sooner or later we will make a simple script and share binary for most popular routers. Here are binaries for Asus RT-N16. Don't forget, that you will still need to copy certificates as shown above and make startup script.
#
# Be sure to enable IPKG on your router. Some routers require JFFS or external storage to be enabled
#
# Download your personal Z-Connector from www.z-wave.me web site and decopress it on your Linux (we suppose it is Ubunu)
#
# Run this script from the directory of Z-Connector (where Unix and Windows folder are located)
# Install flex utility
sudo apt-get install flex
# Install SVN OpenWRT tree
svn co svn://svn.openwrt.org/openwrt/branches/backfire
cd backfire
# Install feeds
./scripts/feeds update -a
./scripts/feeds install argtable
# copy Z-Connector to the tree
mkdir packages/z-connector
cp -R ../Unix packages/z-connector/src
mv packages/z-connector/src/Makefile_OpenWRT packages/z-connector/Makefile
(cd package/z-connector/src; make clean)
make menuconfig
# select Target System
# save the config
make package/z-connector-compile
make package/openssl-compile
make package/feeds/packages/argtable-compile
# Specify correct ARCH
ARCH=[[Arch]]
OpenWRThost=[[IP]]
# Copy to the router
scp bin/$ARCH/packages/argtable*.ipk bin/$ARCH/packages/z-connector*.ipk bin/$ARCH/packages/libopenssl*.ipk bin/$ARCH/packages/zlib*.ipk root@$OpenWRThost:/tmp
# Install on the router
ssh root@$OpenWRThost ipkg install /tmp/argtable*.ipk /tmp/z-connector*.ipk /tmp/libopenssl*.ipk /tmp/zlib*.ipk
# Now you need to copy Certificates somewhere on the router
scp -r ../Certificates root@$OpenWRThost:[[cert directory]]
# And probably load modules for your stick
ssh root@$OpenWRThost ipkg install kmod-usb-serial-pl2303
insmod pl2303
# or
ssh root@$OpenWRThost ipkg install kmod-usb-core kmod-usb-acm
insmod acm
# Then you can try to start z-connector on your roter using:
root@OpenWRT:/ # CERT_DIR=[[cert directory]]
root@OpenWRT:/ # DEVICE=[[DEVICE]]
root@OpenWRT:/ # z-connector -d $DEVICE -s z-cloud.z-wave.me --cert=$CERT_DIR/cert.pem --key=$CERT_DIR/cert.key --cacert=$CERT_DIR/cacert.pem
# Final step is to make startup script, but this depends on your router! Something like:
#!/bin/bash
# replace [[XXX]] with appropriate value
BIN_PATH=[[path to z-connector]] # path to z-connector binary: /usr/bin/, /jffs/bin, /opt/bin or some other depending on your router
CERT_DIR=[[cert directiry]] # directory where you have stored certificates
DEVICE=[[Device]] # /dev/ttyUSB0, /dev/ttyACM0, /dev/usb/tty/0 or another depending on the Z-Wave hardware and kernel version you have
while [ 1 ] do
$BIN_PATH/z-connector -d $DEVICE -s z-cloud.z-wave.me --cert=$CERT_DIR/cert.pem --key=$CERT_DIR/cert.key --cacert=$CERT_DIR/cacert.pem
sleep 1 # spare the CPU
done
Sooner or later we will make a simple script and share binary for most popular routers. Here are binaries for Asus RT-N16. Don't forget, that you will still need to copy certificates as shown above and make startup script.