# Yocto, cURL and SFTP

**URL:** <https://forum.legato.io/t/yocto-curl-and-sftp/2734>\
**Category:** Legato Linux distribution (Yocto project)\
**Created:** [October 22, 2017, 11:19pm UTC](https://forum.legato.io/t/yocto-curl-and-sftp/2734 "2017-10-22T23:19:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![shib](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shib](https://forum.legato.io/u/shib)\
**Post date:** [October 30, 2017, 10:45pm UTC](https://forum.legato.io/t/yocto-curl-and-sftp/2734/4 "2017-10-30T22:45:01Z")

</div>

So I got this working last week, and thought I would post a reply for the benefit of anyone else trying to get the same (or similar) working with Legato.  
I did this using a Linux virtual machine.  
I am using a MangOH green.

**1. Download source.**  
The Linux source that I downloaded is located at: [https://source.sierrawireless.com/resources/legato/downloads/](https://source.sierrawireless.com/resources/legato/downloads/)  
I downloaded the source file SWI9X15Y\_07.12.09.00

**2. Modify curl recipe**  
Browse to ./yocto/poky/meta/recipes-support/curl/curl\_7.37.1.bb  
Add “libssh2” option to PACKAGECONFIG.  
e.g PACKAGECONFIG ??= “${@bb.utils.contains(“DISTRO\_FEATURES”, “ipv6”, “ipv6”, “”, d)} gnutls zlib libssh2”  
This can also be done with a .bbappend file, or by adding libssh2 to DISTRO\_FEATURES.

**3. Modify libssh recipe - optional**  
Browse to ./yocto/meta-openembedded/meta-oe/recipes-support/libssh2/  
Replace libssh2\_x.x.x.bb with libssh2\_1.8.0.bb from here:  
[https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/recipes-support/libssh2/libssh2\_1.8.0.bb](https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/recipes-support/libssh2/libssh2_1.8.0.bb)  
Also delete the libssh2 folder from the same directory (it contains patches that are no longer needed).

**4. Make the build**  
Browse to ./yocto and run the command “make image\_bin”  
This could take a few hours the first time you run it, so be prepared. Every time you make a small change after this, it will only take a minute or so.  
From inside my virtual machine this took about 2-3 hours.

**5. Apply the update**  
Applying the update doesn’t work well (it failed for me) from inside the virtual machine.  
Using winscp or similar, copy the file “boot-yocto\_wp85.cwe” off the virtual machine and on to your windows environment.  
Using Developer studio connect to the device and then go to device\>Flash Firmware from external file.  
Select the cwe file from earlier and apply the update.

**6. Verify the update**  
SSH in to the device and run “curl -V”  
You should see an output similar to:  
"curl 7.37.1 (arm-poky-linux-gnueabi) libcurl/7.37.1 GnuTLS/3.3.5 zlib/1.2.8 libssh2/1.8.0  
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp  
Features: IPv6 NTLM NTLM\_WB SSL libz TLS-SRP "  
Curl now supports sftp!

**Notes:**  
To use SFTP in the Httpget sample, I needed to modify the .adef file to include the following:  
/usr/lib/libssh2.so.1 /usr/lib/  
/usr/lib/libssl.so.1.0.0 /usr/lib/  
There may be a better way to get all this to work, I am new to developing for Linux/Legato/MangOH and this worked for me. Hopefully this can help someone in a similar situation.

---

_[View the full topic](https://forum.legato.io/t/yocto-curl-and-sftp/2734)._
