diff mbox

[v3,3/3] soletta: new package

Message ID 1482101300-9180-3-git-send-email-fabrice.fontaine@orange.com
State Changes Requested
Headers show

Commit Message

Fabrice Fontaine Dec. 18, 2016, 10:48 p.m. UTC
Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
---
Changes v2 -> v3 (after review of Thomas Petazzoni):
 - Remove Config.in from python-vcversioner as this is not needed for a
   host-package
 - Remove target variant of python-jsonschema (including Config.in) as
   this variant is not needed by soletta

Changes v1 -> v2 (after review of Thomas Petazzoni):
 - Add python-vcversioner in host-package version as
   host-python-jsonschema depends on it
 - Add python-jsonschema in host-package version
 - Retrieve first soletta patch from upstream
 - Add a soletta patch to remove multiple targets in the same rule as
   this is not supported by old versions of make

 package/Config.in                                  |   1 +
 ...Check-availability-of-nonstandard-locales.patch |  64 ++++++++++
 .../0002-Use-tinydtls-from-buildsystem.patch       | 102 +++++++++++++++
 .../0003-Use-tinycbor-from-buildsystem.patch       | 139 +++++++++++++++++++++
 package/soletta/0004-Fix-tinycbor-API-calls.patch  | 130 +++++++++++++++++++
 .../0005-Remove-warning-when-building-OIC.patch    |  32 +++++
 .../0006-Remove-multiple-targets-in-a-rule.patch   |  36 ++++++
 package/soletta/Config.in                          |  30 +++++
 package/soletta/soletta.hash                       |   4 +
 package/soletta/soletta.mk                         | 120 ++++++++++++++++++
 10 files changed, 658 insertions(+)
 create mode 100644 package/soletta/0001-Check-availability-of-nonstandard-locales.patch
 create mode 100644 package/soletta/0002-Use-tinydtls-from-buildsystem.patch
 create mode 100644 package/soletta/0003-Use-tinycbor-from-buildsystem.patch
 create mode 100644 package/soletta/0004-Fix-tinycbor-API-calls.patch
 create mode 100644 package/soletta/0005-Remove-warning-when-building-OIC.patch
 create mode 100644 package/soletta/0006-Remove-multiple-targets-in-a-rule.patch
 create mode 100644 package/soletta/Config.in
 create mode 100644 package/soletta/soletta.hash
 create mode 100644 package/soletta/soletta.mk

Comments

Thomas Petazzoni Dec. 19, 2016, 10:12 p.m. UTC | #1
Hello,

On Sun, 18 Dec 2016 23:48:20 +0100, Fabrice Fontaine wrote:
> Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>

I'm sorry, but this still doesn't work with old make versions. I get:

make[1]: Entering directory `/home/test/buildroot/output/build/soletta-v1'
Makefile.smallos:35: "LDFLAGS not set. This is probably an error"
Makefile.smallos:57: *** multiple target patterns.  Stop.
make[1]: Leaving directory `/home/test/buildroot/output/build/soletta-v1'

This is due to the := assignments in the target definitions. If I change:

$(soletta_target): private export BOARD_NAME:=$(BOARD_NAME)
$(soletta_config): private export BOARD_NAME:=$(BOARD_NAME)

to

$(soletta_target): private export BOARD_NAME=$(BOARD_NAME)
$(soletta_config): private export BOARD_NAME=$(BOARD_NAME)

then a different problem happens: the "private" keyword apparently
didn't exist in make 3.81, and therefore is interpreted as being a
target, and therefore:

make[1]: Entering directory `/home/test/buildroot/output/build/soletta-v1'
Makefile.smallos:35: "LDFLAGS not set. This is probably an error"
make[1]: *** No rule to make target `private', needed by `/home/test/buildroot/output/build/soletta-v1/.config'.  Stop.
make[1]: Leaving directory `/home/test/buildroot/output/build/soletta-v1'

So, really, this package that requires a brand new version of make, and
python3, is a bit annoying in terms of build process... Maybe this is
something you can work out with upstream?

In the mean time, we cannot apply this, as it will badly fail on our
autobuilders, and for many of our users who run fairly old systems.

Thanks,

Thomas
Fabrice Fontaine Dec. 19, 2016, 10:25 p.m. UTC | #2
Hello

2016-12-19 23:12 GMT+01:00 Thomas Petazzoni <
thomas.petazzoni@free-electrons.com>:

> Hello,
>
> On Sun, 18 Dec 2016 23:48:20 +0100, Fabrice Fontaine wrote:
> > Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
>
> I'm sorry, but this still doesn't work with old make versions. I get:
>
> make[1]: Entering directory `/home/test/buildroot/output/build/soletta-v1'
> Makefile.smallos:35: "LDFLAGS not set. This is probably an error"
> Makefile.smallos:57: *** multiple target patterns.  Stop.
> make[1]: Leaving directory `/home/test/buildroot/output/build/soletta-v1'
>
> This is due to the := assignments in the target definitions. If I change:
>
> $(soletta_target): private export BOARD_NAME:=$(BOARD_NAME)
> $(soletta_config): private export BOARD_NAME:=$(BOARD_NAME)
>
> to
>
> $(soletta_target): private export BOARD_NAME=$(BOARD_NAME)
> $(soletta_config): private export BOARD_NAME=$(BOARD_NAME)
>
> then a different problem happens: the "private" keyword apparently
> didn't exist in make 3.81, and therefore is interpreted as being a
> target, and therefore:
>
> make[1]: Entering directory `/home/test/buildroot/output/build/soletta-v1'
> Makefile.smallos:35: "LDFLAGS not set. This is probably an error"
> make[1]: *** No rule to make target `private', needed by
> `/home/test/buildroot/output/build/soletta-v1/.config'.  Stop.
> make[1]: Leaving directory `/home/test/buildroot/output/build/soletta-v1'
>
> So, really, this package that requires a brand new version of make, and
> python3, is a bit annoying in terms of build process... Maybe this is
> something you can work out with upstream?
>
> In the mean time, we cannot apply this, as it will badly fail on our
> autobuilders, and for many of our users who run fairly old systems.
>
I perfectly understand your point, thanks a lot for the time you passed on
testing these patches.

>
> Thanks,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
>

Best Regards,

Fabrice
Thomas Petazzoni Dec. 19, 2016, 10:36 p.m. UTC | #3
Hello,

On Mon, 19 Dec 2016 23:25:41 +0100, Fabrice Fontaine wrote:

> I perfectly understand your point, thanks a lot for the time you passed on
> testing these patches.

Maybe you could set up an older Linux system to use as a build
environment to reproduce those failures. If you're using a Debian-based
system, it's really easy with debootstrap to create a chroot containing
an older Debian version.

Best regards,

Thomas
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index be0d150..b6b409c 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1366,6 +1366,7 @@  endif
 	source "package/qhull/Config.in"
 	source "package/qlibc/Config.in"
 	source "package/shapelib/Config.in"
+	source "package/soletta/Config.in"
 	source "package/sphinxbase/Config.in"
 	source "package/startup-notification/Config.in"
 	source "package/tinycbor/Config.in"
diff --git a/package/soletta/0001-Check-availability-of-nonstandard-locales.patch b/package/soletta/0001-Check-availability-of-nonstandard-locales.patch
new file mode 100644
index 0000000..7759f30
--- /dev/null
+++ b/package/soletta/0001-Check-availability-of-nonstandard-locales.patch
@@ -0,0 +1,64 @@ 
+From 63db25cc467f64356dd592c892cd64b10fbf6e19 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fabrice.fontaine@orange.com>
+Date: Mon, 24 Oct 2016 23:47:03 +0200
+Subject: [PATCH] Check availability of nonstandard locales
+
+Check that LC_ADDRESS, LC_IDENTIFICATION ... are defined before using them as
+these nonstandard locales are not always available (for example on uclibc)
+
+Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
+---
+ src/lib/common/sol-platform-linux-common.c | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/src/lib/common/sol-platform-linux-common.c b/src/lib/common/sol-platform-linux-common.c
+index 5a0d49b..0fbdd22 100644
+--- a/src/lib/common/sol-platform-linux-common.c
++++ b/src/lib/common/sol-platform-linux-common.c
+@@ -1017,19 +1017,43 @@ sol_platform_impl_locale_to_c_category(enum sol_platform_locale_category categor
+ {
+     switch (category) {
+     case SOL_PLATFORM_LOCALE_ADDRESS:
++#ifdef LC_ADDRESS
+         return LC_ADDRESS;
++#else
++	return -EINVAL;
++#endif
+     case SOL_PLATFORM_LOCALE_IDENTIFICATION:
++#ifdef LC_IDENTIFICATION
+         return LC_IDENTIFICATION;
++#else
++	return -EINVAL;
++#endif
+     case SOL_PLATFORM_LOCALE_MESSAGES:
+         return LC_MESSAGES;
+     case SOL_PLATFORM_LOCALE_PAPER:
++#ifdef LC_PAPER
+         return LC_PAPER;
++#else
++	return -EINVAL;
++#endif
+     case SOL_PLATFORM_LOCALE_NAME:
++#ifdef LC_NAME
+         return LC_NAME;
++#else
++	return -EINVAL;
++#endif
+     case SOL_PLATFORM_LOCALE_TELEPHONE:
++#ifdef LC_TELEPHONE
+         return LC_TELEPHONE;
++#else
++	return -EINVAL;
++#endif
+     case SOL_PLATFORM_LOCALE_MEASUREMENT:
++#ifdef LC_MEASUREMENT
+         return LC_MEASUREMENT;
++#else
++	return -EINVAL;
++#endif
+     default:
+         return -EINVAL;
+     }
+-- 
+2.5.0
+
diff --git a/package/soletta/0002-Use-tinydtls-from-buildsystem.patch b/package/soletta/0002-Use-tinydtls-from-buildsystem.patch
new file mode 100644
index 0000000..5ff8345
--- /dev/null
+++ b/package/soletta/0002-Use-tinydtls-from-buildsystem.patch
@@ -0,0 +1,102 @@ 
+From a8672315d68fba42ee87e83f77c341beacdef1d9 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fabrice.fontaine@orange.com>
+Date: Mon, 24 Oct 2016 23:57:15 +0200
+Subject: [PATCH] Use tinydtls from buildsystem
+
+Currently tinydtls is found in source tree, instead use the package from the
+buildsystem like the other ones (libcurl ...)
+
+Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
+---
+ data/jsons/dependencies.json                  | 13 ++++++-------
+ src/lib/comms/Kconfig                         |  2 +-
+ src/lib/comms/Makefile                        | 19 +++++--------------
+ src/lib/comms/sol-socket-dtls-impl-tinydtls.c |  2 +-
+ 4 files changed, 13 insertions(+), 23 deletions(-)
+
+diff --git a/data/jsons/dependencies.json b/data/jsons/dependencies.json
+index 2445407..11cd221 100644
+--- a/data/jsons/dependencies.json
++++ b/data/jsons/dependencies.json
+@@ -661,14 +661,13 @@
+       "pkgname": "openssl"
+     },
+     {
+-      "dependency": "tinydtls_src",
+-      "type": "filesystem",
+-      "files": [
+-        "dtls.h"
++      "dependency": "tinydtls",
++      "type": "ccode",
++      "headers": [
++        "<tinydtls/dtls.h>"
+       ],
+-      "path": {
+-        "in-tree": "{TOP_SRCDIR}/src/thirdparty/tinydtls",
+-        "out-of-tree": "{TINYDTLS_SRC}"
++      "ldflags": {
++        "value": "-ltinydtls"
+       }
+     },
+     {
+diff --git a/src/lib/comms/Kconfig b/src/lib/comms/Kconfig
+index 13d6ff9..b6324b0 100644
+--- a/src/lib/comms/Kconfig
++++ b/src/lib/comms/Kconfig
+@@ -9,7 +9,7 @@ config NETWORK
+ config DTLS
+ 	bool "Enable DTLS (Datagram Transport Layer Security) support"
+ 	default n
+-	depends on HAVE_TINYDTLS_SRC
++	depends on HAVE_TINYDTLS
+ 	help
+ 	    This enables support for DTLS (a derivation from the SSL protocol)
+ 	    support in the socket abstraction layer.
+diff --git a/src/lib/comms/Makefile b/src/lib/comms/Makefile
+index 83f5004..e7c2cbd 100644
+--- a/src/lib/comms/Makefile
++++ b/src/lib/comms/Makefile
+@@ -14,22 +14,13 @@ obj-networking-$(NETCTL)-extra-cflags += $(SYSTEMD_CFLAGS)
+ obj-networking-$(NETCTL)-extra-ldflags += $(SYSTEMD_LDFLAGS)
+ 
+ obj-dtls-$(DTLS) += \
+-    sol-socket-dtls-impl-tinydtls.o \
+-    $(TINYDTLS_SRC_PATH)/aes/rijndael.o \
+-    $(TINYDTLS_SRC_PATH)/ccm.o \
+-    $(TINYDTLS_SRC_PATH)/crypto.o \
+-    $(TINYDTLS_SRC_PATH)/dtls.o \
+-    $(TINYDTLS_SRC_PATH)/dtls_time.o \
+-    $(TINYDTLS_SRC_PATH)/ecc/ecc.o \
+-    $(TINYDTLS_SRC_PATH)/hmac.o \
+-    $(TINYDTLS_SRC_PATH)/netq.o \
+-    $(TINYDTLS_SRC_PATH)/peer.o \
+-    $(TINYDTLS_SRC_PATH)/session.o \
+-    $(TINYDTLS_SRC_PATH)/sha2/sha2.o
++    sol-socket-dtls-impl-tinydtls.o
+ 
+ obj-dtls-$(DTLS)-extra-cflags += \
+-    -I$(TINYDTLS_SRC_PATH) \
+-    -w
++    $(TINYDTLS_CFLAGS)
++
++obj-dtls-$(DTLS)-extra-ldflags += \
++    $(TINYDTLS_LDFLAGS)
+ 
+ obj-networking-$(PLATFORM_RIOTOS) += \
+     sol-network-impl-riot.o \
+diff --git a/src/lib/comms/sol-socket-dtls-impl-tinydtls.c b/src/lib/comms/sol-socket-dtls-impl-tinydtls.c
+index 485c2a5..84b01f2 100644
+--- a/src/lib/comms/sol-socket-dtls-impl-tinydtls.c
++++ b/src/lib/comms/sol-socket-dtls-impl-tinydtls.c
+@@ -31,7 +31,7 @@
+ #include "sol-socket-dtls.h"
+ #include "sol-socket-impl.h"
+ 
+-#include "dtls.h"
++#include <tinydtls/dtls.h>
+ 
+ static const uint32_t dtls_magic = 'D' << 24 | 't' << 16 | 'L' << 8 | 's';
+ 
+-- 
+2.5.0
+
diff --git a/package/soletta/0003-Use-tinycbor-from-buildsystem.patch b/package/soletta/0003-Use-tinycbor-from-buildsystem.patch
new file mode 100644
index 0000000..75eebfd
--- /dev/null
+++ b/package/soletta/0003-Use-tinycbor-from-buildsystem.patch
@@ -0,0 +1,139 @@ 
+From b11cc5e2bea5d9b25bb4ce397f8a5acda09442be Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fabrice.fontaine@orange.com>
+Date: Tue, 25 Oct 2016 00:32:47 +0200
+Subject: [PATCH] Use tinycbor from buildsystem
+
+Currently tinycbor is found in source tree, instead use the package from the
+buildsystem like the other ones (libcurl ...)
+
+Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
+---
+ data/jsons/dependencies.json   | 13 ++++++-------
+ src/lib/comms/Kconfig          |  2 +-
+ src/lib/comms/Makefile         | 23 +++++------------------
+ src/lib/comms/sol-oic-cbor.h   |  2 +-
+ src/lib/comms/sol-oic-client.c |  2 +-
+ src/lib/comms/sol-oic-server.c |  2 +-
+ 6 files changed, 15 insertions(+), 29 deletions(-)
+
+diff --git a/data/jsons/dependencies.json b/data/jsons/dependencies.json
+index 11cd221..0882f2f 100644
+--- a/data/jsons/dependencies.json
++++ b/data/jsons/dependencies.json
+@@ -645,14 +645,13 @@
+       "atleast-version": "0.9.47"
+     },
+     {
+-      "dependency": "tinycbor_src",
+-      "type": "filesystem",
+-      "files": [
+-        "cbor.h"
++      "dependency": "tinycbor",
++      "type": "ccode",
++      "headers": [
++        "<tinycbor/cbor.h>"
+       ],
+-      "path": {
+-        "in-tree": "{TOP_SRCDIR}/src/thirdparty/tinycbor/src",
+-        "out-of-tree": "{TINYCBOR_SRC}"
++      "ldflags": {
++        "value": "-ltinycbor"
+       }
+     },
+     {
+diff --git a/src/lib/comms/Kconfig b/src/lib/comms/Kconfig
+index b6324b0..bf0f8e2 100644
+--- a/src/lib/comms/Kconfig
++++ b/src/lib/comms/Kconfig
+@@ -95,7 +95,7 @@ config COAP
+ config OIC
+ 	bool "OIC"
+ 	default y
+-	depends on COAP && FEATURE_OIC && HAVE_TINYCBOR_SRC
++	depends on COAP && FEATURE_OIC && HAVE_TINYCBOR
+ 	help
+             Implementation of protocol defined by Open Interconnect Consortium
+             (OIC - http://openinterconnect.org/)
+diff --git a/src/lib/comms/Makefile b/src/lib/comms/Makefile
+index e7c2cbd..fbbb555 100644
+--- a/src/lib/comms/Makefile
++++ b/src/lib/comms/Makefile
+@@ -49,23 +49,6 @@ obj-networking-$(COAP) += \
+     coap.o \
+     sol-coap.o
+ 
+-obj-$(OIC) += tinycbor.mod
+-
+-obj-tinycbor-y = \
+-    $(TINYCBOR_SRC_PATH)/cborencoder.o \
+-    $(TINYCBOR_SRC_PATH)/cborerrorstrings.o \
+-    $(TINYCBOR_SRC_PATH)/cborparser.o \
+-    $(TINYCBOR_SRC_PATH)/cborpretty.o
+-
+-obj-tinycbor-private-headers += \
+-    $(TINYCBOR_SRC_PATH)/cbor.h
+-
+-obj-tinycbor-y-extra-cflags += \
+-    -Wno-cpp \
+-    -Wno-declaration-after-statement \
+-    -Wno-float-equal \
+-    -Wno-undef
+-
+ obj-networking-$(OIC) += \
+     sol-oic-cbor.o \
+     sol-oic-client.o \
+@@ -86,7 +69,11 @@ obj-networking-$(OIC)-extra-cflags += \
+     -DOIC_HARDWARE_VERSION=$(OIC_SERVER_HARDWARE_VERSION) \
+     -DOIC_FIRMWARE_VERSION=$(OIC_SERVER_FIRMWARE_VERSION) \
+     -DOIC_SUPPORT_URL=$(OIC_SERVER_SUPPORT_URL) \
+-    -DOIC_DEVICE_NAME=$(OIC_SERVER_DEVICE_NAME)
++    -DOIC_DEVICE_NAME=$(OIC_SERVER_DEVICE_NAME) \
++    $(TINYCBOR_CFLAGS)
++
++obj-networking-$(OIC)-extra-ldflags += \
++    $(TINYCBOR_LDFLAGS)
+ 
+ obj-networking-$(HTTP) += \
+     sol-http-common.o
+diff --git a/src/lib/comms/sol-oic-cbor.h b/src/lib/comms/sol-oic-cbor.h
+index 94a77de..1da14e6 100644
+--- a/src/lib/comms/sol-oic-cbor.h
++++ b/src/lib/comms/sol-oic-cbor.h
+@@ -18,7 +18,7 @@
+ 
+ #pragma once
+ 
+-#include "tinycbor/cbor.h"
++#include <tinycbor/cbor.h>
+ #include "sol-coap.h"
+ #include "sol-oic.h"
+ #include "sol-vector.h"
+diff --git a/src/lib/comms/sol-oic-client.c b/src/lib/comms/sol-oic-client.c
+index 89196ab..011b720 100644
+--- a/src/lib/comms/sol-oic-client.c
++++ b/src/lib/comms/sol-oic-client.c
+@@ -22,7 +22,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ 
+-#include "tinycbor/cbor.h"
++#include <tinycbor/cbor.h>
+ #include "sol-coap.h"
+ #include "sol-log-internal.h"
+ #include "sol-macros.h"
+diff --git a/src/lib/comms/sol-oic-server.c b/src/lib/comms/sol-oic-server.c
+index a6521b7..b2e4699 100644
+--- a/src/lib/comms/sol-oic-server.c
++++ b/src/lib/comms/sol-oic-server.c
+@@ -23,7 +23,7 @@
+ 
+ #define SOL_LOG_DOMAIN &_sol_oic_server_log_domain
+ 
+-#include "tinycbor/cbor.h"
++#include <tinycbor/cbor.h>
+ #include "sol-coap.h"
+ #include "sol-json.h"
+ #include "sol-log-internal.h"
+-- 
+2.5.0
+
diff --git a/package/soletta/0004-Fix-tinycbor-API-calls.patch b/package/soletta/0004-Fix-tinycbor-API-calls.patch
new file mode 100644
index 0000000..8bf08cb
--- /dev/null
+++ b/package/soletta/0004-Fix-tinycbor-API-calls.patch
@@ -0,0 +1,130 @@ 
+From 9bcdc25f433f80d6a5e9c08a335780a7a056b00a Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fabrice.fontaine@orange.com>
+Date: Tue, 25 Oct 2016 10:15:29 +0200
+Subject: [PATCH] Fix tinycbor API calls
+
+Since tinycbor 0.3.2, ptr and bytes_needed of CborEncoder structure are not
+accessible through an unnamed union so add the data structure when needed
+
+Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
+---
+ src/lib/comms/sol-oic-cbor.c   | 16 ++++++++--------
+ src/lib/comms/sol-oic-server.c | 10 +++++-----
+ 2 files changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/src/lib/comms/sol-oic-cbor.c b/src/lib/comms/sol-oic-cbor.c
+index b4715e2..3820797 100644
+--- a/src/lib/comms/sol-oic-cbor.c
++++ b/src/lib/comms/sol-oic-cbor.c
+@@ -63,7 +63,7 @@ initialize_cbor_payload(struct sol_oic_map_writer *encoder)
+ 
+     cbor_encoder_init(&encoder->encoder, encoder->payload,
+         buf->capacity - offset, 0);
+-    old_ptr = encoder->encoder.ptr;
++    old_ptr = encoder->encoder.data.ptr;
+ 
+     encoder->type = SOL_OIC_MAP_CONTENT;
+ 
+@@ -72,7 +72,7 @@ initialize_cbor_payload(struct sol_oic_map_writer *encoder)
+     err = cbor_encoder_create_map(&encoder->encoder, &encoder->rep_map,
+         CborIndefiniteLength);
+     if (err == CborNoError) {
+-        new_ptr = encoder->rep_map.ptr;
++        new_ptr = encoder->rep_map.data.ptr;
+         r = buffer_used_bump(encoder, new_ptr - old_ptr);
+         if (r < 0)
+             err = CborErrorUnknownType;
+@@ -113,12 +113,12 @@ enlarge_buffer(struct sol_oic_map_writer *writer,
+     writer->rep_map = orig_map;
+ 
+     /* update all encoder states */
+-    writer->payload = writer->encoder.ptr = sol_buffer_at(buf, offset);
++    writer->payload = writer->encoder.data.ptr = sol_buffer_at(buf, offset);
+     /* sol_buffer_at() directly to somewhere past the used portion fails*/
+     writer->encoder.end = (uint8_t *)sol_buffer_at(buf, 0) + buf->capacity;
+ 
+     /* new offset + how much it had progressed so far */
+-    writer->rep_map.ptr = writer->payload + (orig_map.ptr - old_payload);
++    writer->rep_map.data.ptr = writer->payload + (orig_map.data.ptr - old_payload);
+     writer->rep_map.end = writer->encoder.end;
+ 
+     return 0;
+@@ -146,13 +146,13 @@ sol_oic_packet_cbor_close(struct sol_coap_packet *pkt,
+         /* When you close an encoder, it will get its ptr set to the
+          * topmost container's. Also, this would append one byte to the
+          * payload, thus '1' below */
+-        old_ptr = writer->rep_map.ptr;
++        old_ptr = writer->rep_map.data.ptr;
+         err = cbor_encoder_close_container(&writer->encoder, &writer->rep_map);
+         if (err & CborErrorOutOfMemory) {
+             r = enlarge_buffer(writer, orig_encoder, orig_map, 1);
+             SOL_INT_CHECK_GOTO(r, < 0, end);
+         } else if (err == CborNoError) {
+-            r = buffer_used_bump(writer, writer->encoder.ptr - old_ptr);
++            r = buffer_used_bump(writer, writer->encoder.data.ptr - old_ptr);
+             if (r < 0) {
+                 err = CborErrorUnknownType;
+                 goto end;
+@@ -195,7 +195,7 @@ sol_oic_packet_cbor_append(struct sol_oic_map_writer *writer,
+             r = enlarge_buffer(writer, orig_encoder, orig_map, next_buf_sz);
+             SOL_INT_CHECK_GOTO(r, < 0, end);
+         } else if (err == CborNoError) {
+-            r = buffer_used_bump(writer, writer->rep_map.ptr - orig_map.ptr);
++            r = buffer_used_bump(writer, writer->rep_map.data.ptr - orig_map.data.ptr);
+             if (r < 0) {
+                 err = CborErrorUnknownType;
+                 goto end;
+@@ -262,7 +262,7 @@ sol_oic_packet_cbor_append(struct sol_oic_map_writer *writer,
+             r = enlarge_buffer(writer, orig_encoder, orig_map, next_buf_sz);
+             SOL_INT_CHECK_GOTO(r, < 0, end);
+         } else if (err == CborNoError) {
+-            r = buffer_used_bump(writer, writer->rep_map.ptr - orig_map.ptr);
++            r = buffer_used_bump(writer, writer->rep_map.data.ptr - orig_map.data.ptr);
+             if (r < 0) {
+                 err = CborErrorUnknownType;
+                 goto end;
+diff --git a/src/lib/comms/sol-oic-server.c b/src/lib/comms/sol-oic-server.c
+index b2e4699..bdd93d4 100644
+--- a/src/lib/comms/sol-oic-server.c
++++ b/src/lib/comms/sol-oic-server.c
+@@ -309,7 +309,7 @@ res_payload_do(CborEncoder *encoder,
+     uint16_t idx;
+ 
+     cbor_encoder_init(encoder, buf, buflen, 0);
+-    *encoder_start = encoder->ptr;
++    *encoder_start = encoder->data.ptr;
+ 
+     err = cbor_encoder_create_array(encoder, &array, 1);
+     err |= cbor_encoder_create_map(&array, &device_map, 2);
+@@ -471,8 +471,8 @@ _sol_oic_server_res(void *data, struct sol_coap_server *server,
+     if (err != CborErrorOutOfMemory)
+         goto err;
+ 
+-    SOL_DBG("Ensuring OIC (cbor) payload of size %td", encoder.bytes_needed);
+-    r = sol_buffer_ensure(buf, encoder.bytes_needed + offset);
++    SOL_DBG("Ensuring OIC (cbor) payload of size %td", encoder.data.bytes_needed);
++    r = sol_buffer_ensure(buf, encoder.data.bytes_needed + offset);
+     if (r < 0) {
+         sol_coap_packet_unref(resp);
+         return r;
+@@ -480,7 +480,7 @@ _sol_oic_server_res(void *data, struct sol_coap_server *server,
+ 
+     /* now encode for sure */
+     err = res_payload_do(&encoder, sol_buffer_at(buf, offset),
+-        encoder.bytes_needed, query_rt, query_if, &dev_id, &encoder_start);
++        encoder.data.bytes_needed, query_rt, query_if, &dev_id, &encoder_start);
+ 
+ err:
+     if (err != CborNoError) {
+@@ -496,7 +496,7 @@ err:
+         sol_coap_header_set_code(resp, SOL_COAP_RESPONSE_CODE_CONTENT);
+         /* Ugly, but since tinycbor operates on memory slices
+          * directly, we have to resort to that */
+-        buf->used += encoder.ptr - encoder_start;
++        buf->used += encoder.data.ptr - encoder_start;
+     }
+ 
+     return sol_coap_send_packet(get_server_for_response(server), resp, cliaddr);
+-- 
+2.5.0
+
diff --git a/package/soletta/0005-Remove-warning-when-building-OIC.patch b/package/soletta/0005-Remove-warning-when-building-OIC.patch
new file mode 100644
index 0000000..ca7ae76
--- /dev/null
+++ b/package/soletta/0005-Remove-warning-when-building-OIC.patch
@@ -0,0 +1,32 @@ 
+From a0df0c1486811e30d90a624503e99c09964b00dc Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fabrice.fontaine@orange.com>
+Date: Tue, 25 Oct 2016 12:51:24 +0200
+Subject: [PATCH] Remove warning when building OIC
+
+If tinydtls and tinycbor are retrieved from buildsystem, a warning is raised
+as we continue to include build/stage/include which is not created anymore so
+remove this inclusion
+
+Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
+---
+ tools/build/Makefile.vars | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/tools/build/Makefile.vars b/tools/build/Makefile.vars
+index 7a963f9..bafd222 100644
+--- a/tools/build/Makefile.vars
++++ b/tools/build/Makefile.vars
+@@ -198,10 +198,6 @@ HEADERDIRS += $(addprefix $(top_srcdir),$(KCONFIG_INCLUDE)generated/)
+ HEADERDIRS += $(addprefix $(build_stagedir),lib/common lib/flow)
+ HEADERDIRS += $(build_includedir)
+ 
+-ifeq (y,$(OIC))
+-HEADERDIRS += $(addprefix $(build_stagedir),include/)
+-endif
+-
+ LIB_OUTPUTDIR := $(build_libdir)
+ 
+ SOL_LIB_AR := $(LIB_OUTPUTDIR)libsoletta.a
+-- 
+2.5.0
+
diff --git a/package/soletta/0006-Remove-multiple-targets-in-a-rule.patch b/package/soletta/0006-Remove-multiple-targets-in-a-rule.patch
new file mode 100644
index 0000000..067bf24
--- /dev/null
+++ b/package/soletta/0006-Remove-multiple-targets-in-a-rule.patch
@@ -0,0 +1,36 @@ 
+From be54c738c8c7a7f95308ca2be49a17566e2ea539 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fabrice.fontaine@orange.com>
+Date: Sun, 18 Dec 2016 12:15:45 +0100
+Subject: [PATCH] Remove multiple targets in a rule
+
+Multiple targets in a single makefile rule is not supported by old
+versions of make so split them in multiple targets
+
+Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
+---
+ Makefile.smallos | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.smallos b/Makefile.smallos
+index 379af73..3093041 100644
+--- a/Makefile.smallos
++++ b/Makefile.smallos
+@@ -50,9 +50,12 @@ soletta_config := $(thisdir)/.config
+ 
+ # Target local variables, so we are able to re-define them for Soletta without
+ # touching the OS build system
+-$(soletta_target) $(soletta_config): private override MAKEFLAGS=""
+-$(soletta_target) $(soletta_config): private export PYTHON=python3
+-$(soletta_target) $(soletta_config): private export BOARD_NAME:=$(BOARD_NAME)
++$(soletta_target): private override MAKEFLAGS=""
++$(soletta_config): private override MAKEFLAGS=""
++$(soletta_target): private export PYTHON=python3
++$(soletta_config): private export PYTHON=python3
++$(soletta_target): private export BOARD_NAME:=$(BOARD_NAME)
++$(soletta_config): private export BOARD_NAME:=$(BOARD_NAME)
+ 
+ $(soletta_target): $(soletta_config)
+ 	@echo "Building Soletta..."
+-- 
+2.5.0
+
diff --git a/package/soletta/Config.in b/package/soletta/Config.in
new file mode 100644
index 0000000..a9891c0
--- /dev/null
+++ b/package/soletta/Config.in
@@ -0,0 +1,30 @@ 
+config BR2_PACKAGE_SOLETTA
+	bool "soletta"
+	depends on BR2_USE_MMU # fork
+	# python3 is not really needed except for 4 development scripts, however
+	# if we don't enable it, host-python-jsonschema will be installed for
+	# the default python interpreter which is host-python2. As a result
+	# host-python3 will not find the module in its site-packages directory.
+	depends on !BR2_PACKAGE_PYTHON # python3
+	depends on BR2_USE_WCHAR # python3
+	depends on BR2_TOOLCHAIN_HAS_THREADS # python3
+	depends on !BR2_STATIC_LIBS # python3
+	select BR2_PACKAGE_PYTHON3
+	help
+	  Soletta Project is a framework for making IoT devices. With Soletta
+	  Project's libraries developers can easily write software for devices
+	  that control actuators/sensors and communicate using standard
+	  technologies. It enables adding smartness even on the smallest edge
+	  devices.
+
+	  http://solettaproject.org
+
+comment "soletta needs a toolchain w/ wchar, threads, dynamic library"
+	depends on BR2_USE_MMU
+	depends on !BR2_PACKAGE_PYTHON
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
+		BR2_STATIC_LIBS
+
+comment "soletta is not compatible with python"
+	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_PYTHON
diff --git a/package/soletta/soletta.hash b/package/soletta/soletta.hash
new file mode 100644
index 0000000..53552b3
--- /dev/null
+++ b/package/soletta/soletta.hash
@@ -0,0 +1,4 @@ 
+# Locally computed:
+sha256	4080d12fde3006216316e954b5e4a001d783f93c5b4d554da5f58c98182270fd	soletta-v1.tar.gz
+sha256	c4d3018933980634333fca5c997736abb207dce76ad1f4cc16a4fdb3e7acb5a6	9af119285a521423646195f04fa4f6f51d0ab644.patch
+sha256	5c9866933428b2c8f7f294d7edec6b41c516b4bbac98e41ce49f13608f87ace1	10a1cadff4bfa82edb7561245786b841310e63b1.patch
diff --git a/package/soletta/soletta.mk b/package/soletta/soletta.mk
new file mode 100644
index 0000000..c757adb
--- /dev/null
+++ b/package/soletta/soletta.mk
@@ -0,0 +1,120 @@ 
+################################################################################
+#
+# soletta
+#
+################################################################################
+
+SOLETTA_VERSION = v1
+SOLETTA_SITE = $(call github,solettaproject,soletta,$(SOLETTA_VERSION))
+SOLETTA_LICENSE = Apache-2.0
+SOLETTA_LICENSE_FILES = LICENSE
+
+SOLETTA_DEPENDENCIES = \
+	host-pkgconf \
+	host-python3 \
+	host-python-jsonschema
+
+SOLETTA_INSTALL_STAGING = YES
+
+# This patch only enables TinyDTLS extra features if needed
+SOLETTA_PATCH = \
+	https://github.com/solettaproject/soletta/commit/9af119285a521423646195f04fa4f6f51d0ab644.patch
+
+# This patch checks availability of RB_SW_SUSPEND
+SOLETTA_PATCH += \
+	https://github.com/solettaproject/soletta/commit/10a1cadff4bfa82edb7561245786b841310e63b1.patch
+
+SOLETTA_CONF_FILE = $(@D)/soletta_conf
+
+SOLETTA_MAKE_OPTS = \
+	TARGETAR="$(TARGET_AR)" \
+	TARGETCC="$(TARGET_CC)" \
+	CFLAGS="$(TARGET_CFLAGS)" \
+	LDFLAGS="$(TARGET_LDFLAGS)" \
+	SOLETTA_CONF="$(SOLETTA_CONF_FILE)"
+
+ifeq ($(BR2_PACKAGE_FILE),y)
+SOLETTA_DEPENDENCIES += file # libmagic
+endif
+
+ifeq ($(BR2_PACKAGE_ICU),y)
+SOLETTA_DEPENDENCIES += icu
+endif
+
+ifeq ($(BR2_PACKAGE_KMOD),y)
+SOLETTA_DEPENDENCIES += kmod
+endif
+
+ifeq ($(BR2_PACKAGE_LIBCURL),y)
+SOLETTA_DEPENDENCIES += libcurl
+endif
+
+ifeq ($(BR2_PACKAGE_LIBGLIB2),y)
+SOLETTA_DEPENDENCIES += libglib2
+endif
+
+ifeq ($(BR2_PACKAGE_LIBGTK3),y)
+SOLETTA_DEPENDENCIES += libgtk3
+endif
+
+ifeq ($(BR2_PACKAGE_LIBMICROHTTPD),y)
+SOLETTA_DEPENDENCIES += libmicrohttpd
+endif
+
+ifeq ($(BR2_PACKAGE_MOSQUITTO),y)
+SOLETTA_DEPENDENCIES += mosquitto
+endif
+
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+SOLETTA_DEPENDENCIES += openssl
+endif
+
+ifeq ($(BR2_PACKAGE_PCRE),y)
+SOLETTA_DEPENDENCIES += pcre
+endif
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+SOLETTA_DEPENDENCIES += systemd
+endif
+
+ifeq ($(BR2_PACKAGE_TINYCBOR),y)
+SOLETTA_DEPENDENCIES += tinycbor
+endif
+
+ifeq ($(BR2_PACKAGE_TINYDTLS),y)
+SOLETTA_DEPENDENCIES += tinydtls
+
+# Enable DTLS as it is disable in default soletta configuration
+define SOLETTA_ENABLE_DTLS
+	echo "DTLS=y" > $(SOLETTA_CONF_FILE)
+endef
+
+SOLETTA_POST_CONFIGURE_HOOKS = SOLETTA_ENABLE_DTLS
+endif
+
+ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
+SOLETTA_DEPENDENCIES += udev
+endif
+
+SOLETTA_BUILD_DIR = $(@D)/build/soletta_sysroot/usr
+
+define SOLETTA_CONFIGURE_CMDS
+	touch $(SOLETTA_CONF_FILE)
+endef
+
+define SOLETTA_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(SOLETTA_MAKE_OPTS) -C $(@D) \
+		-f Makefile.smallos
+endef
+
+define SOLETTA_INSTALL_STAGING_CMDS
+	cp -a $(SOLETTA_BUILD_DIR)/include/* $(STAGING_DIR)/usr/include/
+	cp -a $(SOLETTA_BUILD_DIR)/lib/* $(STAGING_DIR)/usr/lib/
+endef
+
+define SOLETTA_INSTALL_TARGET_CMDS
+	cp -a $(SOLETTA_BUILD_DIR)/bin/* $(TARGET_DIR)/usr/bin/
+	cp -a $(SOLETTA_BUILD_DIR)/lib/* $(TARGET_DIR)/usr/lib/
+endef
+
+$(eval $(generic-package))