keith-cullen / FreeCoAP

An implementation of a CoAP client, a CoAP server and a HTTP/CoAP proxy with full DTLS support.
134 stars 38 forks source link

GnuTLS for DTLS on Intel Galileo #15

Closed smnd90 closed 7 years ago

smnd90 commented 7 years ago

I don't understand how to install gnutls on Intel Galileo. I understand that cross-compilation should be used but I haven't been able to compile gnutls and all the other dependences needed to compile FreeeCoAP. Can you help me? Sorry for my many question but I use your client (simple version) for send requests to authorization server written in Golang. On my PC that works. But now I won't test this on Galileo (only client side)

keith-cullen commented 7 years ago

(These instructions worked for me on the Quark 1.0.1 BSP.)

Cross Compile GnuTLS

  1. Download libraries gmp-6.0.0 nettle-2.7 gnutls-3.2.0
  2. Setup the path to the toolchain $ export PATH=/opt/clanton-tiny/1.4.2/sysroots/i686-pokysdk-linux/usr/bin:/opt/clanton-tiny/1.4.2/sysroots/i686-pokysdk-linux/usr/bin/i586-poky-linux-uclibc:$PATH
  3. Cross compile gmp $ cd gmp-6.0.0 $ ./configure CFLAGS=--sysroot=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc \ --prefix=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr \ --host=i586-poky-linux-uclibc \ --build=i686-linux $ make $ make install
  4. Cross compile nettle $ cd nettle-2.7 $ ./configure CFLAGS=--sysroot=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc \ CXXFLAGS=--sysroot=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc \ --prefix=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr \ --host=i586-poky-linux-uclibc \ --build=i686-linux $ make $ make install
  5. Configure gnutls $ cd gnutls-3.2.0 $ ./configure CFLAGS=--sysroot=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc \ --prefix=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr \ --host=i586-poky-linux-uclibc \ --build=i686-linux \ --with-libnettle-prefix=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr \ --disable-doc \ --without-libregex
  6. Cross compile gnutls $ make $ make install
smnd90 commented 7 years ago

Thanks a lot. i will try soon. Which OS you used for compile? Ubuntu? Which distro? And the last question. When I compile test_coap_client in FreeCoaP, what changes should I make to the Makefile? Or I do simply "make"?

keith-cullen commented 7 years ago

Copy the files eMakefile and build_quark.sh into the test_coap_client directory and run build_quark.sh

build_quark.zip

smnd90 commented 7 years ago

Thanks. When I try to compile (sudo make) gmp it do error: obprntffuns.c:67:21: error: ‘obstack_vprintf’ undeclared here (not in a function) make[2]: *** [obprntffuns.lo] Errore 1 make[2]: uscita dalla directory "/home/simo/Scaricati/gmp-6.1.2/printf" make[1]: *** [all-recursive] Errore 1 make[1]: uscita dalla directory "/home/simo/Scaricati/gmp-6.1.2" make: *** [all] Errore 2 I try with gmp6.0.0 and gmp-6.1.2

keith-cullen commented 7 years ago

Have you setup the Quark BSP?

smnd90 commented 7 years ago

I used this book, "Intel Galileo and Intel Galileo Gen 2: API Features and Arduino Projects for Linux Programmers" (available on google book: https://books.google.it/books?id=xVAnCgAAQBAJ&pg=PA44#v=onepage&q&f=false )

In particolar chapter "Creating your own intel galileo images" on page 44.

I want SD Card images, not SPI. So I use "bitbake image-full-galileo", not "bitbake image-spi-galileo"

I followed the steps up to page 57.

Have I setup the Quark BSP in this mode or there are another steps?

P.S. I used Ubuntu 12.04 32 bit on VirtualBox but I can use 64 bit also.