meta-digi-dey: add aws iot sdk embedded-c recipe
The AWS IoT device SDK for embedded C is a collection of C source files that
can be used in embedded applications to securely connect to the AWS IoT
platform.
The SDK code is available in GitHub and includes the library code and several
sample applications.
A user must provide from its 'local.conf':
* AWS_IOT_CERTS_DIR: Absolute path to the directories where the required
certifies are stored:
* Root CA.
* Device signed certificate.
* Device private key.
And optionally, values for the rest of variables defined in the 'awsiotsdk-c'
bbclass.
This recipe is building the library code and the binaries for the samples:
* shadow_sample
* shadow_sample_console_echo
* subscribe_publish_sample
See https://github.com/aws/aws-iot-device-sdk-embedded-C.
https://jira.digi.com/browse/DEL-4101
Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
This commit is contained in:
parent
9a296b79a3
commit
cd078339f7
|
|
@ -0,0 +1,41 @@
|
|||
# ***************************************************************************
|
||||
# Copyright (c) 2017 Digi International Inc.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
|
||||
#
|
||||
# ***************************************************************************
|
||||
|
||||
SAMPLES_SUBDIR := samples/linux
|
||||
|
||||
EXAMPLES := $(SAMPLES_SUBDIR)/shadow_sample \
|
||||
$(SAMPLES_SUBDIR)/shadow_sample_console_echo \
|
||||
$(SAMPLES_SUBDIR)/subscribe_publish_sample
|
||||
|
||||
SUBDIRS := src $(EXAMPLES)
|
||||
|
||||
all: $(SUBDIRS)
|
||||
|
||||
$(SAMPLES_SUBDIR)/shadow_sample: src
|
||||
$(SAMPLES_SUBDIR)/shadow_sample_console_echo: src
|
||||
$(SAMPLES_SUBDIR)/subscribe_publish_sample: src
|
||||
|
||||
.PHONY: $(SUBDIRS)
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
.PHONY: clean install
|
||||
clean install:
|
||||
for a in $(SUBDIRS); do $(MAKE) -C $$a $@; done
|
||||
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
# ***************************************************************************
|
||||
# Copyright (c) 2017 Digi International Inc.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
|
||||
#
|
||||
# ***************************************************************************
|
||||
# Use GNU C Compiler.
|
||||
CC ?= gcc
|
||||
|
||||
# Generated Executable Name.
|
||||
EXECUTABLE = $(notdir $(CURDIR))
|
||||
|
||||
# Location of Source Code.
|
||||
SRC = .
|
||||
|
||||
#IoT client directory.
|
||||
IOT_CLIENT_DIR = ../../..
|
||||
|
||||
PLATFORM_DIR = $(IOT_CLIENT_DIR)/platform/linux/mbedtls
|
||||
PLATFORM_COMMON_DIR = $(IOT_CLIENT_DIR)/platform/linux/common
|
||||
|
||||
CFLAGS += -I $(SRC)
|
||||
CFLAGS += -I $(IOT_CLIENT_DIR)/include
|
||||
CFLAGS += -I $(IOT_CLIENT_DIR)/external_libs/jsmn
|
||||
CFLAGS += -I $(PLATFORM_COMMON_DIR)
|
||||
CFLAGS += -I $(PLATFORM_DIR)
|
||||
CFLAGS += -Wall -g
|
||||
CFLAGS += $(LOG_FLAGS)
|
||||
|
||||
# Libraries to Link
|
||||
LIBS += $(shell PKG_CONFIG_PATH=../../..:$${PKG_CONFIG_PATH} pkg-config --libs --static awsiotsdk)
|
||||
|
||||
# Linking Flags.
|
||||
LDFLAGS += -L$(IOT_CLIENT_DIR)/src $(DFLAGS)
|
||||
|
||||
# Target output to generate.
|
||||
SRCS = $(wildcard $(SRC)/*.c)
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
.PHONY: all
|
||||
all: $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJS)
|
||||
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
|
||||
|
||||
.PHONY: install
|
||||
install: $(EXECUTABLE)
|
||||
install -d $(DESTDIR)/usr/bin
|
||||
install -m 0755 $< $(DESTDIR)/usr/bin/
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(EXECUTABLE) $(OBJS)
|
||||
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
# ***************************************************************************
|
||||
# Copyright (c) 2017 Digi International Inc.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
|
||||
#
|
||||
# ***************************************************************************
|
||||
# Use GNU C Compiler.
|
||||
CC ?= gcc
|
||||
|
||||
# Generated Library name.
|
||||
NAME := awsiotsdk
|
||||
|
||||
# Location of Source Code.
|
||||
SRC = .
|
||||
|
||||
#IoT client directory.
|
||||
IOT_CLIENT_DIR = $(SRC)/..
|
||||
|
||||
PLATFORM_DIR = $(IOT_CLIENT_DIR)/platform/linux/mbedtls
|
||||
PLATFORM_COMMON_DIR = $(IOT_CLIENT_DIR)/platform/linux/common
|
||||
INSTALL_HEADERS_DIR = /usr/include/awsiotsdk
|
||||
|
||||
CFLAGS += -I $(IOT_CLIENT_DIR)/include
|
||||
CFLAGS += -I $(IOT_CLIENT_DIR)/external_libs/jsmn
|
||||
CFLAGS += -I $(PLATFORM_COMMON_DIR)
|
||||
CFLAGS += -I $(PLATFORM_DIR)
|
||||
CFLAGS += -Wall -g
|
||||
CFLAGS += $(LOG_FLAGS)
|
||||
CFLAGS += $(shell pkg-config --cflags mbedtls)
|
||||
|
||||
# Libraries to Link.
|
||||
LIBS += $(shell pkg-config --libs --static mbedtls)
|
||||
|
||||
# Linking Flags.
|
||||
LDFLAGS += $(DFLAGS)
|
||||
|
||||
# Target output to generate.
|
||||
SRCS += $(wildcard $(SRC)/*.c)
|
||||
SRCS += $(wildcard $(IOT_CLIENT_DIR)/external_libs/jsmn/*.c)
|
||||
SRCS += $(wildcard $(PLATFORM_DIR)/*.c)
|
||||
SRCS += $(wildcard $(PLATFORM_COMMON_DIR)/*.c)
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
.PHONY: all
|
||||
all: lib$(NAME).a
|
||||
|
||||
lib$(NAME).a: $(OBJS)
|
||||
$(AR) -rcs $@ $^
|
||||
|
||||
.PHONY: install
|
||||
install: lib$(NAME).a
|
||||
# Install library and pkg-config file.
|
||||
install -d $(DESTDIR)/usr/lib/pkgconfig
|
||||
install -m 0644 lib$(NAME).a $(DESTDIR)/usr/lib/
|
||||
install -m 0644 ../awsiotsdk.pc $(DESTDIR)/usr/lib/pkgconfig/
|
||||
# Install header files.
|
||||
install -d $(DESTDIR)$(INSTALL_HEADERS_DIR)
|
||||
install -m 0644 $(IOT_CLIENT_DIR)/include/*.h $(DESTDIR)$(INSTALL_HEADERS_DIR)/
|
||||
install -m 0644 $(IOT_CLIENT_DIR)/external_libs/jsmn/*.h $(DESTDIR)$(INSTALL_HEADERS_DIR)/
|
||||
install -m 0644 $(PLATFORM_COMMON_DIR)/*.h $(DESTDIR)$(INSTALL_HEADERS_DIR)/
|
||||
install -m 0644 $(PLATFORM_DIR)/*.h $(DESTDIR)$(INSTALL_HEADERS_DIR)/
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-rm -f lib$(NAME).a $(OBJS)
|
||||
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file aws_iot_config.h
|
||||
* @brief AWS IoT specific configuration file
|
||||
*/
|
||||
|
||||
#ifndef SRC_SHADOW_IOT_SHADOW_CONFIG_H_
|
||||
#define SRC_SHADOW_IOT_SHADOW_CONFIG_H_
|
||||
|
||||
/* Get from console */
|
||||
/* ================================================= */
|
||||
/* Customer specific MQTT HOST. The same will be used for Thing Shadow */
|
||||
#define AWS_IOT_MQTT_HOST "##AWS_IOT_MQTT_HOST##"
|
||||
/* Default port for MQTT/S */
|
||||
#define AWS_IOT_MQTT_PORT ##AWS_IOT_MQTT_PORT##
|
||||
/* Thing Name of the Shadow this device is associated with */
|
||||
#define AWS_IOT_MY_THING_NAME "##AWS_IOT_MY_THING_NAME##"
|
||||
/* MQTT client ID should be unique for every device */
|
||||
#define AWS_IOT_MQTT_CLIENT_ID AWS_IOT_MY_THING_NAME
|
||||
/* Root CA file name */
|
||||
#define AWS_IOT_ROOT_CA_FILENAME "##AWS_IOT_ROOT_CA_FILENAME##"
|
||||
/* Device signed certificate file name */
|
||||
#define AWS_IOT_CERTIFICATE_FILENAME "##AWS_IOT_CERTIFICATE_FILENAME##"
|
||||
/* Device private key filename */
|
||||
#define AWS_IOT_PRIVATE_KEY_FILENAME "##AWS_IOT_PRIVATE_KEY_FILENAME##"
|
||||
/* ================================================= */
|
||||
|
||||
/* MQTT PubSub */
|
||||
/* ================================================= */
|
||||
/* Any time a message is sent out through the MQTT layer. The message is copied
|
||||
* into this buffer anytime a publish is done.
|
||||
* This will also be used in the case of Thing Shadow */
|
||||
#define AWS_IOT_MQTT_TX_BUF_LEN ##AWS_IOT_MQTT_TX_BUF_LEN##
|
||||
/* Any message that comes into the device should be less than this buffer size.
|
||||
* If a received message is bigger than this buffer size the message will be
|
||||
* dropped. */
|
||||
#define AWS_IOT_MQTT_RX_BUF_LEN ##AWS_IOT_MQTT_RX_BUF_LEN##
|
||||
/* Maximum number of topic filters the MQTT client can handle at any given time.
|
||||
* This should be increased appropriately when using Thing Shadow */
|
||||
#define AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS ##AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS##
|
||||
|
||||
/* Thing Shadow specific configs */
|
||||
/* Maximum size of the Shadow buffer to store the received Shadow message */
|
||||
#define SHADOW_MAX_SIZE_OF_RX_BUFFER AWS_IOT_MQTT_RX_BUF_LEN + 1
|
||||
/* Maximum size of the Unique Client Id.
|
||||
* For More info on the Client Id refer \ref response "Acknowledgments" */
|
||||
#define MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES 80
|
||||
/* This is size of the extra sequence number that will be appended to the
|
||||
* Unique client Id */
|
||||
#define MAX_SIZE_CLIENT_ID_WITH_SEQUENCE MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES + 10
|
||||
/* This is size of the the total clientToken key and value pair in the JSON */
|
||||
#define MAX_SIZE_CLIENT_TOKEN_CLIENT_SEQUENCE MAX_SIZE_CLIENT_ID_WITH_SEQUENCE + 20
|
||||
/* At any given time we will wait for this many responses.
|
||||
* This will correlate to the rate at which the shadow actions are requested */
|
||||
#define MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME ##MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME##
|
||||
/* We could perform shadow action on any thing Name and this is maximum Thing
|
||||
* Names we can act on at any given time */
|
||||
#define MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME ##MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME##
|
||||
/* These are the max tokens that is expected to be in the Shadow JSON document.
|
||||
* It includes the metadata that gets published */
|
||||
#define MAX_JSON_TOKEN_EXPECTED ##MAX_JSON_TOKEN_EXPECTED##
|
||||
/* All shadow actions have to be published or subscribed to a topic which is of
|
||||
* the format $aws/things/{thingName}/shadow/update/accepted.
|
||||
* This refers to the size of the topic without the Thing Name */
|
||||
#define MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME 60
|
||||
/* The Thing Name should not be bigger than this value. Modify this if the
|
||||
* Thing Name needs to be bigger */
|
||||
#define MAX_SIZE_OF_THING_NAME ##MAX_SIZE_OF_THING_NAME##
|
||||
/* This size includes the length of topic with Thing Name */
|
||||
#define MAX_SHADOW_TOPIC_LENGTH_BYTES MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME + MAX_SIZE_OF_THING_NAME
|
||||
/* ================================================= */
|
||||
|
||||
/* Auto Reconnect specific config */
|
||||
/* ================================================= */
|
||||
/* Minimum time before the First reconnect attempt is made as part of the
|
||||
* exponential back-off algorithm */
|
||||
#define AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL ##AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL##
|
||||
/* Maximum time interval after which exponential back-off will stop attempting
|
||||
* to reconnect */
|
||||
#define AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL ##AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL##
|
||||
/* ================================================= */
|
||||
|
||||
#endif /* SRC_SHADOW_IOT_SHADOW_CONFIG_H_ */
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: awsiotsdk
|
||||
Description: SDK for connecting to AWS IoT from a device using embedded C
|
||||
Version: 2.1.1
|
||||
|
||||
Requires.private: mbedtls
|
||||
Libs: -L${libdir} -lawsiotsdk
|
||||
Cflags: -I${includedir}/awsiotsdk -I${includedir}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
# Copyright (C) 2017 Digi International.
|
||||
|
||||
SUMMARY = "SDK for connecting to AWS IoT from a device using embedded C"
|
||||
HOMEPAGE = "https://github.com/aws/aws-iot-device-sdk-embedded-C"
|
||||
SECTION = "base"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=acc7a1bf87c055789657b148939e4b40"
|
||||
|
||||
DEPENDS = "mbedtls"
|
||||
|
||||
SRC_URI = " \
|
||||
https://github.com/aws/aws-iot-device-sdk-embedded-C/archive/v${PV}.tar.gz \
|
||||
file://aws_iot_config.h.template \
|
||||
file://awsiotsdk.pc \
|
||||
file://Makefile \
|
||||
file://Makefile.app \
|
||||
file://Makefile.lib \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "2c415af16bbd68440b62d71a7e9775c5"
|
||||
SRC_URI[sha256sum] = "74d434b3258654cea048b20eb52d4fc627f5c87e8727ce180a1d529e3285a97e"
|
||||
|
||||
S = "${WORKDIR}/aws-iot-device-sdk-embedded-C-${PV}"
|
||||
|
||||
inherit awsiotsdk-c pkgconfig
|
||||
|
||||
do_configure() {
|
||||
cp -f ${WORKDIR}/awsiotsdk.pc ${S}
|
||||
|
||||
# Copy and update the configuration header file.
|
||||
cp -f ${WORKDIR}/aws_iot_config.h.template ${S}/include/aws_iot_config.h
|
||||
sed -i -e "s,##AWS_IOT_MQTT_HOST##,${AWS_IOT_MQTT_HOST},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_MQTT_PORT##,${AWS_IOT_MQTT_PORT},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_MY_THING_NAME##,${AWS_IOT_MY_THING_NAME},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_ROOT_CA_FILENAME##,${AWS_IOT_ROOT_CA_FILENAME},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_CERTIFICATE_FILENAME##,${AWS_IOT_CERTIFICATE_FILENAME},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_PRIVATE_KEY_FILENAME##,${AWS_IOT_PRIVATE_KEY_FILENAME},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_MQTT_TX_BUF_LEN##,${AWS_IOT_MQTT_TX_BUF_LEN},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_MQTT_RX_BUF_LEN##,${AWS_IOT_MQTT_RX_BUF_LEN},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS##,${AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME##,${MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME##,${MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##MAX_JSON_TOKEN_EXPECTED##,${MAX_JSON_TOKEN_EXPECTED},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##MAX_SIZE_OF_THING_NAME##,${MAX_SIZE_OF_THING_NAME},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL##,${AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL},g" "${S}/include/aws_iot_config.h"
|
||||
sed -i -e "s,##AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL##,${AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL},g" "${S}/include/aws_iot_config.h"
|
||||
|
||||
# Remove the examples header files.
|
||||
rm -f ${S}/samples/linux/shadow_sample/aws_iot_config.h
|
||||
rm -f ${S}/samples/linux/shadow_sample_console_echo/aws_iot_config.h
|
||||
rm -f ${S}/samples/linux/subscribe_publish_sample/aws_iot_config.h
|
||||
|
||||
# Copy the Makefiles.
|
||||
cp -f ${WORKDIR}/Makefile ${S}
|
||||
cp -f ${WORKDIR}/Makefile.lib ${S}/src/Makefile
|
||||
cp -f ${WORKDIR}/Makefile.app ${S}/samples/linux/shadow_sample/Makefile
|
||||
cp -f ${WORKDIR}/Makefile.app ${S}/samples/linux/shadow_sample_console_echo/Makefile
|
||||
cp -f ${WORKDIR}/Makefile.app ${S}/samples/linux/subscribe_publish_sample/Makefile
|
||||
}
|
||||
|
||||
do_install() {
|
||||
oe_runmake DESTDIR=${D} install
|
||||
|
||||
# Check if certificate variables are defined and files exist.
|
||||
if [ -z "${AWS_IOT_CERTS_DIR}" ]; then
|
||||
bberror "Undefined variable AWS_IOT_CERTS_DIR. Define it in your project 'local.conf'."
|
||||
return -1
|
||||
elif [ ! -d "${AWS_IOT_CERTS_DIR}" ]; then
|
||||
bberror "Unable to find defined AWS_IOT_CERTS_DIR ('${AWS_IOT_CERTS_DIR}')."
|
||||
return -1
|
||||
elif [ ! -f "${AWS_IOT_CERTS_DIR}/${AWS_IOT_ROOT_CA_FILENAME}" ]; then
|
||||
bberror "Unable to find defined AWS_IOT_ROOT_CA_FILENAME ('${AWS_IOT_ROOT_CA_FILENAME}') in '${AWS_IOT_CERTS_DIR}'."
|
||||
return -1
|
||||
elif [ ! -f "${AWS_IOT_CERTS_DIR}/${AWS_IOT_CERTIFICATE_FILENAME}" ]; then
|
||||
bberror "Unable to find defined AWS_IOT_CERTIFICATE_FILENAME ('${AWS_IOT_CERTIFICATE_FILENAME}') in '${AWS_IOT_CERTS_DIR}'."
|
||||
return -1
|
||||
elif [ ! -f "${AWS_IOT_CERTS_DIR}/${AWS_IOT_PRIVATE_KEY_FILENAME}" ]; then
|
||||
bberror "Unable to find defined AWS_IOT_PRIVATE_KEY_FILENAME ('${AWS_IOT_PRIVATE_KEY_FILENAME}') in '${AWS_IOT_CERTS_DIR}'."
|
||||
return -1
|
||||
fi
|
||||
|
||||
# Install certificates.
|
||||
install -d ${D}${sysconfdir}/ssl/certs
|
||||
install -m 0644 ${AWS_IOT_CERTS_DIR}/${AWS_IOT_ROOT_CA_FILENAME} ${D}${sysconfdir}/ssl/certs/
|
||||
install -m 0644 ${AWS_IOT_CERTS_DIR}/${AWS_IOT_CERTIFICATE_FILENAME} ${D}${sysconfdir}/ssl/certs/
|
||||
install -m 0644 ${AWS_IOT_CERTS_DIR}/${AWS_IOT_PRIVATE_KEY_FILENAME} ${D}${sysconfdir}/ssl/certs/
|
||||
}
|
||||
|
||||
PACKAGES =+ "${PN}-cert ${PN}-examples"
|
||||
|
||||
FILES_${PN}-cert = "${sysconfdir}/ssl/certs/"
|
||||
FILES_${PN}-examples = "${bindir}"
|
||||
|
||||
RDEPENDS_${PN} = "${PN}-cert"
|
||||
RDEPENDS_${PN}-examples = "${PN}-cert"
|
||||
|
||||
ALLOW_EMPTY_${PN} = "1"
|
||||
|
||||
Loading…
Reference in New Issue