Yocto, cURL and SFTP

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

2 Likes