# 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:** 6\
**Page:** 1

<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 22, 2017, 11:19pm UTC](https://forum.legato.io/t/yocto-curl-and-sftp/2734/1 "2017-10-22T23:19:50Z")

</div>

I am new to Linux development, and am trying to get SFTP working using cURL.  
I was following some instructions under various forum posts about rebuilding Legato with updated cURL libraries with SFTP enabled.

> **[SFTP using libcurl](https://forum.mangoh.io/t/sftp-using-libcurl/631)**
>
> Hi I want to update the curl version to the latest 7.54.1. Firmware Packages - Release 14 have curl version 7.37.1 which do not support SFTP. If anyone done already please share the steps here. below is the curl version details for Release14 ...

> **[Compile 3rd library (libcurl, etc ...) for Legato sur MangOH](https://forum.mangoh.io/t/compile-3rd-library-libcurl-etc-for-legato-sur-mangoh/153)**
>
> Hi all, I’m new to Legato. I have been working on some embedded Linux device before. I have an C application which linked to libcurl library on my current device and I want to make it run on Legato platform. So is it possible to compile libcurl...

> **[Rebuilding Legato Kernel](https://forum.mangoh.io/t/rebuilding-legato-kernel/65)**
>
> We would like to rebuild/reconfigure a custom kernel for the wp85 using instructions from this link: http://legato.io/legato-docs/latest/yocto\_legato.html#getstartedYoctoLinux\_rebuildYoctoImages There does not appear to be a stdbuild.sh file If...

I noticed that over the weekend, a lot of the documentation related to Yocto has disappeared.  
[http://legato.io/legato-docs/latest/yoctoLegatoOverview.html](http://legato.io/legato-docs/latest/yoctoLegatoOverview.html)  
[http://legato.io/legato-docs/latest/yocto\_build.html](http://legato.io/legato-docs/latest/yocto_build.html)

Am I going the right way about this? Is there an easier way to get SFTP working under Legato?  
And why has the documentation related to this been taken down?

Yes I am using a MangOH, but I felt this question was more appropriate here. Yes it needs to be SFTP, yes I have tried (and succeeded) using FTPS.

---

<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 23, 2017, 3:39am UTC](https://forum.legato.io/t/yocto-curl-and-sftp/2734/2 "2017-10-23T03:39:16Z")

</div>

I have since learned that I should have been looking in: [Docs - Legato Docs](http://legato.io/legato-docs/16_10_3/)  
for my legato docs (because it matches my legato version).

Every version that I checked with the exception of 17.09 includes the yocto documentation: [GitHub - legatoproject/legato-docs: Pre-built doxygen documentation for the legato-af project](https://github.com/legatoproject/legato-docs/)

---

<div class="post-metadata">

**Author:** ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)\
**Post date:** [October 25, 2017, 1:16am UTC](https://forum.legato.io/t/yocto-curl-and-sftp/2734/3 "2017-10-25T01:16:40Z")

</div>

As of 17.09 the Yocto documentation has moved to The Source, cf [http://legato.io/legato-docs/latest/releaseNotes17090.html](http://legato.io/legato-docs/latest/releaseNotes17090.html)

The Yocto doc is now here: [https://source.sierrawireless.com/resources/legato/linuxoverview/](https://source.sierrawireless.com/resources/legato/linuxoverview/)

---

<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.

---

<div class="post-metadata">

**Author:** ![likhi](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@likhi](https://forum.legato.io/u/likhi)\
**Post date:** [February 24, 2020, 10:42am UTC](https://forum.legato.io/t/yocto-curl-and-sftp/2734/5 "2020-02-24T10:42:58Z")

</div>

Hi  
Please share the libssh2\_1.8.0.bb file

---

<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:** [February 24, 2020, 10:44pm UTC](https://forum.legato.io/t/yocto-curl-and-sftp/2734/6 "2020-02-24T22:44:12Z")

</div>

If you read through the previous post you will find it there.  
If all you are trying to do is get sftp working then upgrading libssh2 is not important.

I should note that the above is tested and works for the WP8548, but does not work on the WP77XX.  
When you try to use sftp under the WP77XX libssh2 will return an error.

Sierra wireless will also not help you out at all in any of this, so you are on your own if you want it working on one of these modules.
