Vous êtes sur la page 1sur 12

Cloud-Aided Yocto Build Speedup

- Author: Leonardo Veiga, FAE, Toradex Brazil


Introduction

Cloud services have been a reality for some years already. Right now, one of the biggest concepts in the field is the
Internet of Things, or IoT for short. When we electronics folk think of the cloud, the first thing that comes to our
minds is connecting several devices to it and uploading data to be visualized, stored and analyzed - among other
possibilities. Of course, other uses may come to mind, too: cloud services can also be used for storage and
processing power, particularly in software-as-a-service applications and personal usage; IT professionals and
sysadmins may take advantage of cloud-based VMs and databases.

One thing we don't always realize is that the cloud can be much more than simply an IoT tool, or
something only large corporations have access to. We can make use of the cloud for everyday tasks,
too. As a matter of fact, that's the motivation behind this article - taking a time-consuming task and
using the cloud to simplify our lives a little!
2
Since I'm familiar with Azure, which is Microsoft's cloud platform, I will show you how to provision an Ubuntu Server
16.04 LTS virtual machine (yes, a Linux machine on Microsoft's cloud!) in Azure, and use Yocto/OpenEmbedded to
generate an embedded Linux image, just like the standard image available for the Toradex Colibri iMX6 computer on
module.

Sign in to Azure

The first step is to go to portal.azure.com and sign in to Azure with your Microsoft account.
Creating the virtual machine

After doing that, simply follow the instructions on this page from Azure's documentation to quickly
create a virtual machine.

3
Tip #1: In your computer's terminal, after generating an authentication key using the following command:

you will need to copy the public authentication key. Just copy the contents of the id_rsa.pub file. Execute
the command below and copy its output:

Tip #2: After completing the Connect to Virtual Machine step, you may stop. You do not need to install
NGINX as described in the Azure article.

4
Building Yocto
By accessing the VM via ssh, you can prepare the build environment. To do so, follow the instructions in
this technical article on Toradex's developer site.

Tip #1: Despite the article's length, all you need are these sections: Prerequisites - Ubuntu 16.04,
Installation Setup/Configure, Installation local.conf - to select Colibri iMX6, and Building.

Tip #2: When the VM is initialized, it will have a 30 GB disk (SSD) on which the operating system is
installed. There is also a volatile disk in the /mnt folder, and its size varies according to the VM
configuration you choose.

Note: you can increase the size of the 30 GB disk (SSD) where the operating system is installed.

5
Is it fast?
For this test, we performed an initial build of the image 'angstrom-lxde-image', including downloading and
compiling all packages, as well as downloading the image from the cloud to the development computer.
I used a laptop computer from work for the test. It has an Intel Core i7-3740QM CPU @ 2.70GHz with 8 virtual
cores (the processor has 4 cores), 8 GB RAM, and an SSD for the builds, running Ubuntu 16.04 LTS natively.
Starting from scratch, the initial build took four hours in all.

Next, two VMs were provisioned in Azure, as follows: one with the simplest configuration available
(Standard DS1 v2), with 1 Intel Xeon core, CPU E5-2673 v3 @ 2.40GHz, 3.5 GB RAM and SSD disk;
the other one with the most powerful configuration available to my account (limited to 10 cores), with
8 Intel Xeon cores, CPU E5-2673 v3 @ 2.40GHz, 28 GB RAM and SSD disk. The total time for the
initial build was 12 hours for the simplest configuration, and 1 hour and 30 minutes for the most
powerful one.

6
A coworker of mine also ran some builds using Amazon AWS machines (c4.2xlarge, c4.4xlarge and m4.2xlarge
for more info, please check here) and other hardware configurations (4 core i7-6700K CPU @ 4.00GHz, 32 GB
DDR4, NVMe SSD and 8 core Xeon CPU E5-2667 v4 @ 3.20GHz, 64GB DDR4, RAM disk), for comparison purposes.
These results are also listed in the table below.

Note 1: There are more powerful VMs available to other account types.
Note 2: Compiled image download time from the cloud to the local computer is rather short (< 3 minutes) for an
average download speed of 1 MB/s.
Note 3: While some cloud platforms, such as Azure, round the VM costs to the nearest minute, other platforms
might round the costs to the nearest hour.
Note 4: Using a RAM disk is also likely to improve performance.

7
8
* Hourly values presented in this table do not include international transaction fees. Costs reflect a VM deployed on
the East US Azure server, and may vary depending on the region in which the VM is deployed. Other services, such
as data storage, were used alongside the VM service; these may also be relevant to the total cost of the build. Prices
may change without notice, per Microsoft's policyplease browse the Azure website or contact Microsoft for more
information regarding pricing.
Is it cost-effective?
The simplest Azure virtual machine used costs US$0.073/hour, whereas the most powerful one (available to my
account) costs US$0.585/hour. Therefore, the total first build cost is about US$0.878 for both machine
configurations. The table of costs for all configurations can be found on this Azure page.

Tip #1: After you finish a build, shut down the VM to avoid spending credits unnecessarily. The
idea is to pay per use, so remember not to leave a VM running over the weekend, for example.
Tip #2: You can configure automatic VM shutdown functions as a safeguard, in case you forget
to shut down a VM manually.
9
Conclusion
This experiment has revealed both pros and cons for cloud-based builds. Given the build times from the "Is it fast?"
section, a cloud-based build strategy can potentially speed up the build process significantly. However, you should also
take into account download speeds: with a good internet connection, a low-cost local build server can be as fast or even
faster than some cloud configurations. On the other hand, if you have a slow or unreliable connection, the cloud-based
approach may be a better option.

Additionally, consider that the cost of using a VM over time might be higher than the cost of running a
local build server. On the other hand, if your company does not have a dedicated local server for builds,
using the cloud might save time for some employees. This is cost-beneficial, since VM hours are
cheaper than employee working hours. This strategy also saves potential wear and tear on personal
machines from running builds.

10
The cloud may also work well as an intermittent solution, to be used when multiple builds need to be performed
simultaneously. This solution is easy and inexpensive to implement alongside a local server that is already handling
one or more builds concurrently.

In the end, it is important to understand what kinds of cloud solutions are available, and to be aware that these
solutions may or may not fit your needs. I hope you find the tips and case study presented in this article useful. Until
next time!

11
Thank you

Vous aimerez peut-être aussi