Skip to content

Commit

Permalink
Merge pull request #7 from mayank-sirotiya-imgtec/master
Browse files Browse the repository at this point in the history
Merge dev to master
  • Loading branch information
Abhijit A. Mahajani committed May 16, 2016
2 parents 33920db + 29af7f7 commit a5c64b7
Show file tree
Hide file tree
Showing 20 changed files with 514 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# openwrt-img-feeds
# openwrt-ckt-feeds

Feeds for CreatorKit packages.

Package | Description
:---------------- | -----------------------------
awalwm2m | Awa LWM2M is an implementation of the OMA Lightweight M2M protocol.
button-gateway | Button gateway is an application running on Ci40 which acts as a gateway for MikroE boards.
device-manager | Device Manager is an application for provisioning devices with access details for FlowCloud.
libflow | Binary package for FlowLibraries.
libflow-ex | Examples for using FlowLibraries.
webscripts | Webscripts to provision Gateway and Constrained devices.

Command | Description
:---------------------------------------------- | :---------------------------------------
```$ ./scripts/feeds/install device-manager``` | Install only the package device-manager


45 changes: 45 additions & 0 deletions awalwm2m/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=awalwm2m
PKG_VERSION:=0.1.7
#PKG_VERSION:=master
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/FlowM2M/AwaLWM2M.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_VERSION:=$(PKG_VERSION)
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)

CMAKE_INSTALL:=1

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/awalwm2m
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Awa LWM2M development suite by Imagination Technologies
endef
define Package/awalwm2m/description
Awa LWM2M is an implementation of the OMA Lightweight M2M protocol.
endef

define Package/awalwm2m/install
$(INSTALL_DIR) $(1)/bin/
$(CP) $(PKG_INSTALL_DIR)/bin/* $(1)/bin/
$(INSTALL_DIR) $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/include/
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
$(INSTALL_DIR) $(1)/etc/lwm2m
$(CP) $(PKG_BUILD_DIR)/core/bootstrap*config $(1)/etc/lwm2m

$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/rc.d
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/usr/bin
$(CP) files/etc/* $(1)/etc/
$(CP) files/usr/bin/* $(1)/usr/bin/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
4 changes: 4 additions & 0 deletions awalwm2m/files/etc/config/awalwm2m
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BOOTSTRAP=coap://ws-uat.flowworld.com:15683
INTERFACE=lowpan0
ADDRESS_FAMILY=6
VERBOSE=--verbose
25 changes: 25 additions & 0 deletions awalwm2m/files/etc/init.d/awa_bootstrapd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh /etc/rc.common

START=98

SERVICE_PID_FILE=/var/run/awa_bootstrapd.pid
BINARY=/bin/awa_bootstrapd
LOGFILE=/var/log/awa_bootstrapd
LOCAL_CONFIG=/etc/lwm2m/bootstrap-contiki.config
FLOW_CONFIG=/etc/lwm2m/bootstrap-contiki-flow-NAT64.config
PORT=15683

apply_global_settings() {
. /etc/config/awalwm2m
}

start() {
sleep 5
apply_global_settings
start-stop-daemon -m -S -p $SERVICE_PID_FILE -b -x $BINARY -- -l $LOGFILE --interface $INTERFACE --addressFamily $ADDRESS_FAMILY --port $PORT --config $LOCAL_CONFIG --config $FLOW_CONFIG $VERBOSE
}

stop() {
start-stop-daemon -K -p $SERVICE_PID_FILE -s 15
rm -f $SERVICE_PID_FILE
}
21 changes: 21 additions & 0 deletions awalwm2m/files/etc/init.d/awa_clientd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh /etc/rc.common

START=98

SERVICE_PID_FILE=/var/run/awa_clientd.pid
BINARY=/bin/awa_clientd
LOGFILE=/var/log/awa_clientd

apply_global_settings() {
. /etc/config/awalwm2m
}

start() {
apply_global_settings
start-stop-daemon -m -S -p $SERVICE_PID_FILE -b -x $BINARY -- -l $LOGFILE --bootstrap $BOOTSTRAP $VERBOSE
}

stop() {
start-stop-daemon -K -p $SERVICE_PID_FILE -s 15
rm -f $SERVICE_PID_FILE
}
23 changes: 23 additions & 0 deletions awalwm2m/files/etc/init.d/awa_serverd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh /etc/rc.common

START=98

SERVICE_PID_FILE=/var/run/awa_serverd.pid
BINARY=/bin/awa_serverd
LOGFILE=/var/log/awa_serverd
PORT=5683

apply_global_settings() {
. /etc/config/awalwm2m
}

start() {
sleep 5
apply_global_settings
start-stop-daemon -m -S -p $SERVICE_PID_FILE -b -x $BINARY -- -l $LOGFILE --interface $INTERFACE --addressFamily $ADDRESS_FAMILY --port $PORT $VERBOSE
}

stop() {
start-stop-daemon -K -p $SERVICE_PID_FILE -s 15
rm -f $SERVICE_PID_FILE
}
1 change: 1 addition & 0 deletions awalwm2m/files/etc/rc.d/K10awa_bootstrapd
1 change: 1 addition & 0 deletions awalwm2m/files/etc/rc.d/K10awa_clientd
1 change: 1 addition & 0 deletions awalwm2m/files/etc/rc.d/K10awa_serverd
1 change: 1 addition & 0 deletions awalwm2m/files/etc/rc.d/S98awa_bootstrapd
1 change: 1 addition & 0 deletions awalwm2m/files/etc/rc.d/S98awa_clientd
1 change: 1 addition & 0 deletions awalwm2m/files/etc/rc.d/S98awa_serverd
100 changes: 100 additions & 0 deletions awalwm2m/files/usr/bin/setup_demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/sh

LWM2M_CONFIG=/etc/config/lwm2m
FLOW_CONFIG=/etc/lwm2m/bootstrap-contiki-flow-NAT64.config

# hack to update the address of the flowcloud server in the bootstrap configuration
# send to the constrained device, as this cannot look up the address itself
# this requires an operational network interface.
update_bootstrap_config() {

remove_entry_from_hosts_file $1

echo "Resolving $1"
ip4=`nslookup $1 | grep -v localhost | grep Addr | cut -f 3 -d " "`
if [ x"$ip4" == x ]; then
echo "ERROR: could not resolve address, make sure the cable is connected"
exit 1
fi
first=`echo ${ip4//./ } | cut -f 1-2 -d " "`
last=`echo ${ip4//./ } | cut -f 3-4 -d " "`
firsthex=`printf '%02x' $first ; echo`
lasthex=`printf '%02x' $last; echo`
NAT64_IP=`echo "2001:1418:200::$firsthex:$lasthex"`
echo "IPv6 address for $1 is $NAT64_IP"
echo "Updating $FLOW_CONFIG"

echo "ServerURI=coap://[$NAT64_IP]:5683/" > $FLOW_CONFIG
echo "SecurityMode=3" >> $FLOW_CONFIG
echo "PublicKey=[PublicKey]" >> $FLOW_CONFIG
echo "SecretKey=[SecretKey]" >> $FLOW_CONFIG
echo "ServerID=2" >> $FLOW_CONFIG
echo "HoldOffTime=30" >> $FLOW_CONFIG
echo "ShortServerID=2" >> $FLOW_CONFIG
echo "Binding=U" >> $FLOW_CONFIG
echo "LifeTime=60" >> $FLOW_CONFIG

update_hosts_file $ip4 $1
}

update_client_config()
{
echo "Updating $LWM2M_CONFIG"
echo "BOOTSTRAP=coap://$1:15683" > $LWM2M_CONFIG
echo "INTERFACE=lowpan0" >> $LWM2M_CONFIG
echo "ADDRESS_FAMILY=6" >> $LWM2M_CONFIG
echo "VERBOSE=--verbose" >> $LWM2M_CONFIG
}

remove_entry_from_hosts_file()
{
sed -ri "/^ *[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[[:space:]]$1/d" /etc/hosts
}

# the DNS server on the NUC tells the dnsmasq service on the Ci40 not
# to cache, this causes very very long DNS resolution times
# as a work around we will write the server address into the /etc/hosts file
update_hosts_file()
{
if grep -q "$2" /etc/hosts; then
sed -ri "s/^ *[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+( +$2)/$1\1/" /etc/hosts
else
echo "$1 $2" >> /etc/hosts
fi
}

restart_daemons()
{
echo "Restarting daemons"
/etc/init.d/lwm2m_clientd stop
/etc/init.d/lwm2m_clientd stop
/etc/init.d/lwm2m_clientd start
/etc/init.d/lwm2m_serverd stop
/etc/init.d/lwm2m_serverd start
/etc/init.d/lwm2m_bootstrapd stop
/etc/init.d/lwm2m_bootstrapd start

}

echo "--------------------------------------------------------------"
echo " CES demo setup script "
echo "--------------------------------------------------------------"
echo "This script will setup the Ci40 configuration for the CES demo"
echo "This will replace the values in $LWM2M_CONFIG and $FLOW_CONFIG"
echo -n "If you don't want to do this, press ctrl^C now or press [ENTER] to continue:"
read

echo -n "Make sure the network cable is connected and press [ENTER]:"
read

echo -n "Enter the flowcloud lwm2m server domain name [dm-ondemand.flowcloud.systems]:"
read FLOW_ADDR
if [ x"$FLOW_ADDR" == x ]; then
FLOW_ADDR=dm-ondemand.flowcloud.systems
fi

update_bootstrap_config $FLOW_ADDR
update_client_config $FLOW_ADDR
restart_daemons
echo "Done."

51 changes: 51 additions & 0 deletions button-gateway/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=button-gateway
PKG_VERSION:=HEAD
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=$(TOPDIR)/../../packages/button-gateway

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_VERSION:=$(PKG_VERSION)
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)

CMAKE_INSTALL:=1

CMAKE_OPTIONS += -DSTAGING_DIR=$(STAGING_DIR)

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/button-gateway
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:= +awalwm2m +libflow +libconfig
TITLE:=Button gateway app
endef

define Package/button-gateway/description
Imagination Technologies button gateway app
endef

define Build/Compile
$(call Build/Compile/Default,all)
endef

define Build/Clean
$(call Build/Compile/Default,clean)
endef

define Package/button-gateway/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/set_led.sh $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/button_gateway_continuous.sh $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/button_gateway_appd $(1)/etc/init.d/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/button_gateway_continuousd $(1)/etc/init.d/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
53 changes: 53 additions & 0 deletions device-manager/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=device-manager
PKG_VERSION:=HEAD
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=$(TOPDIR)/../../packages/device-manager
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_VERSION:=$(PKG_VERSION)
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)

CMAKE_INSTALL:=1

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk


define Package/device-manager
SECTION:=utils
CATEGORY:=Utilities
DEFAULT:=n
DEPENDS:=+awalwm2m +ubus +ubox +tayga
TITLE:=Device manager
MENU:=1
endef

define Package/device-manager/description
Device manager is an application for provisioning devices with access details for flow cloud
endef

CMAKE_OPTIONS += -DSTAGING_DIR=$(STAGING_DIR)

define Build/Compile
$(call Build/Compile/Default,all)
endef

define Build/Clean
$(call Build/Compile/Default,clean)
endef

define Package/device-manager/install
$(INSTALL_DIR) $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/* $(STAGING_DIR)/usr/lib/
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/* $(1)/etc/init.d/
endef

$(eval $(call BuildPackage,device-manager))
26 changes: 26 additions & 0 deletions device-manager/files/device_manager_ubusd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh /etc/rc.common

START=99
STOP=10

SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1

APP=device_manager_ubusd
LOGFILE=/var/log/$APP
DEBUG_LEVEL=5

EXTRA_COMMANDS="debug"
EXTRA_HELP=" debug Start the service in debug mode"

start() {
service_start /usr/bin/$APP -l $LOGFILE
}

stop() {
service_stop /usr/bin/$APP
}

debug() {
service_start /usr/bin/$APP -l $LOGFILE -v $DEBUG_LEVEL
}
Loading

0 comments on commit a5c64b7

Please sign in to comment.