<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2026-02-02T12:47:46+00:00</updated><id>/feed.xml</id><title type="html">Embedded Linux and beyond</title><subtitle>Blog about open-source software, Internet of Things (IoT), embedded Linux development and more.</subtitle><author><name>Mirza Krak</name></author><entry><title type="html">Fosdem 2026</title><link href="/2026/02/01/FOSDEM-2026.html" rel="alternate" type="text/html" title="Fosdem 2026" /><published>2026-02-01T00:00:00+00:00</published><updated>2026-02-01T00:00:00+00:00</updated><id>/2026/02/01/FOSDEM-2026</id><content type="html" xml:base="/2026/02/01/FOSDEM-2026.html"><![CDATA[<p>FOSDEM 2026 is a wrap! Here are my highlights.</p>

<h1 id="day-0">Day 0</h1>

<p>Attended the “Friends of Mender.io” dinner. Great catching up with old friends,
and making new ones. After-party at Delirium, as is the FOSDEM tradition.</p>

<h1 id="day-1">Day 1</h1>

<p>Late start to the day as a consequence of ‘Day 0’.</p>

<p>Hoped to get in to the Python room, but others had the same idea and they
queued up in time and I was met with a sign saying “Sorry, this room is full”.
This is a very FOSDEM thing, and was expected due to my poor planning. Luckily
there are video records of all talks and I hope to catch up on:</p>

<ul>
  <li><a href="https://fosdem.org/2026/schedule/event/HAAABD-the_bakery_how_pep810_sped_up_my_bread_operations_business/">The Bakery: How PEP810 sped up my bread operations business</a></li>
  <li><a href="https://fosdem.org/2026/schedule/event/ABJMWD-the_gil_and_api_performance_past_present_and_free-threaded_future/">The GIL and API Performance: Past, Present, and Free-Threaded Future</a></li>
  <li><a href="https://fosdem.org/2026/schedule/event/WE7NHM-modern-python-monorepo-apache-airflow/">Modern Python monorepo with <code class="language-plaintext highlighter-rouge">uv</code>, <code class="language-plaintext highlighter-rouge">workspaces</code>, <code class="language-plaintext highlighter-rouge">prek</code> and shared libraries</a></li>
  <li><a href="https://fosdem.org/2026/schedule/event/S7RELZ-ducks_to_the_rescue_-_etl_using_python_and_duckdb/">Ducks to the rescue - ETL using Python and DuckDB</a></li>
</ul>

<p>With my hopes lost of joining the Python devroom, I roamed the hallways and
chatted with people instead. Which is also a very FOSDEM thing.</p>

<p>I do like well structured pull requests, and therefore joined
<a href="https://fosdem.org/2026/schedule/event/L7ERNP-prs-maintainers-will-love/">Pull requests maintainers will love to review</a>
on the ‘Main Track’. <a href="https://fosdem.org/2026/schedule/speaker/alya_abbott/">Alya Abbot</a>
did a great job distilling what makes up a good pull request and how they
communicate this at <a href="https://zulip.readthedocs.io/en/latest/contributing/index.html">Zulip</a>.</p>

<p>I have received several recommendations to watch <a href="https://fosdem.org/2026/schedule/event/DCAVDC-how_to_make_package_managers_scream/">How to Make Package Managers Scream</a>
(also Main Track), and I intend to! Having worked with Yocto Project and
packaging a large variety of software, I fear that I have already experienced
some of the horror stories.</p>

<h1 id="day-2">Day 2</h1>

<p>Day 2, I had three goals:</p>

<ol>
  <li>
    <p>Join the ‘Go’ devroom in the morning</p>

    <p>Right now involved in a ‘Go’ project, and wanted to hear about the latest
and greatest in the community. The trending features are
<a href="https://go.dev/blog/synctest">testing/synctest</a> &amp;
<a href="https://go.dev/blog/greenteagc">Green Tea GC</a>.</p>

    <p>Also enjoyed
<a href="https://fosdem.org/2026/schedule/event/MCH3DR-go-modular-monolith-refactoring/">Modularizing a 10-Year Monolith: The Architecture, the People, and the Pain</a>
which has some similarities with my current project with similar conclusions,
large architectural changes are about people more then tech.</p>

    <p><img src="/assets/images/fosdem-2026-gophers.jpg" alt="" /></p>
  </li>
  <li>
    <p>Join <a href="https://fosdem.org/2026/schedule/event/KPCRXF-the-year-of-embedded-security/">The Year in Embedded Security</a>
presentation in the ‘Embedded, Mobile and Automotive’ room</p>

    <p>Always enjoy talks by <a href="https://fosdem.org/2026/schedule/speaker/marta_rybczynska/">Marta Rybczynska</a>,
and the topic is close to heart.</p>
  </li>
  <li>
    <p>Watch Daniel Stenbergs (curl://) keynote</p>

    <p>More on this later.</p>
  </li>
</ol>

<p>Mission successful!</p>

<h2 id="lightning-lightning-talks">Lightning lightning talks</h2>

<p>Anticipating a packed Janson room for Daniels keynote, I joined earlier to make
sure I had a good spot. While waiting, there was a round of lightning talks and
noted down some links that stood out to me:</p>

<ul>
  <li><a href="https://tc54.org/contributing-yaml">https://tc54.org/contributing-yaml</a> - a machine readable <code class="language-plaintext highlighter-rouge">CONTRIBUTING.MD</code>
sounds like a great idea for AI agents and other tools</li>
  <li><a href="https://pgscorecard.com">https://pgscorecard.com</a> - many “PostgreSQL compatible” databases are using false marketing</li>
  <li><a href="https://rcl-lang.org">https://rcl-lang.org</a> - code once, generate config everywhere. You can also query JSON</li>
  <li><a href="https://body.build">https://body.build</a> - fitness and open source, two of my passions</li>
</ul>

<h2 id="open-source-security-in-spite-of-ai">Open Source Security in spite of AI</h2>

<p>One of the highlights each year at FOSDEM is the Daniel Stenberg (curl://)
keynote, and this year did not disappoint with insights on how AI is impacting
open source.</p>

<p>Conclusion, AI is a tool which can be used for good and for bad. Open source
projects are overrun by “slop” which is stealing valuable time from maintainers.
“Slop” security reports are more time consuming to handle then “slop” pull
requests.</p>

<h2 id="random-links">Random links</h2>

<ul>
  <li><a href="https://tus.io">https://tus.io</a> - Open Protocol for Resumable File Uploads</li>
  <li><a href="https://sli.dev">https://sli.dev</a> - Presentation Slides for Developers</li>
  <li><a href="https://internals-for-interns.com">https://internals-for-interns.com</a> - blog about how things work under the hood</li>
</ul>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[FOSDEM 2026 is a wrap! Here are my highlights.]]></summary></entry><entry><title type="html">Red Cybersecurity</title><link href="/2025/08/01/RED-Cybersecurity.html" rel="alternate" type="text/html" title="Red Cybersecurity" /><published>2025-08-01T00:00:00+00:00</published><updated>2025-08-01T00:00:00+00:00</updated><id>/2025/08/01/RED-Cybersecurity</id><content type="html" xml:base="/2025/08/01/RED-Cybersecurity.html"><![CDATA[<p>To enhance the cybersecurity of certain radio products in the European Union
(EU) market, the European Commission has adopted a Delegated Act (Regulation
(EU) 2022/30) under the RED, which takes effect on 1 August 2025.</p>

<p>This Delegated Act enforces the following essential requirements from Article 3
of the RED:</p>

<ul>
  <li>3.3(d): Ensure network protection – radio equipment must not harm the network
        or its functioning nor misuse network resources.</li>
  <li>3.3(e): Incorporate safeguards to ensure the personal data and privacy of the
        user and subscriber are protected.</li>
  <li>3.3(f): Include features to protect against fraud</li>
</ul>

<p>Harmonized standards:</p>

<ul>
  <li>UNE EN 18031-1:2025 Common security requirements for radio equipment - Part 1: Internet connected radio equipment</li>
  <li>UNE EN 18031-2:2025 Common security requirements for radio equipment - Part 2: radio equipment processing data, namely Internet connected radio equipment, childcare radio equipment, toys radio equipment and wearable radio equipment</li>
  <li>UNE EN 18031-3:2025 Common security requirements for radio equipment - Part 3: Internet connected radio equipment processing virtual money or monetary value</li>
</ul>

<p>See <a href="https://www.bsigroup.com/siteassets/pdf/en/products-and-services/gl-rs-pcert-lg-ict-dt-nsp-mp-digitaldomain-0025-red-guide-and-readiness.pdf">Radio Equipment Directive Cybersecurity Testing – EN 18031 from BSI</a>
for more details on how this might impact you.</p>

<p><a href="https://zealience.com/">ZEALIENCE</a> also has good resources on this topic. See:</p>

<ul>
  <li><a href="https://github.com/zealience/IoT-Cybersecurity-Compliance">https://github.com/zealience/IoT-Cybersecurity-Compliance</a></li>
</ul>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[To enhance the cybersecurity of certain radio products in the European Union (EU) market, the European Commission has adopted a Delegated Act (Regulation (EU) 2022/30) under the RED, which takes effect on 1 August 2025.]]></summary></entry><entry><title type="html">Work in progress</title><link href="/2021/11/11/Work-in-progress.html" rel="alternate" type="text/html" title="Work in progress" /><published>2021-11-11T00:00:00+00:00</published><updated>2021-11-11T00:00:00+00:00</updated><id>/2021/11/11/Work-in-progress</id><content type="html" xml:base="/2021/11/11/Work-in-progress.html"><![CDATA[<p>I am in the process of migrating my blog <a href="https://mkrak.org/">mkrak.org</a>
(Wordpress) to a Jekyll+Github based setup.</p>

<p>Come back again soon to see the final result!</p>

<p><img src="/assets/images/work-in-progress.jpg" alt="" /></p>

<p><em>Photo by <a href="https://unsplash.com/@akin?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Akin Cakiner</a> on <a href="https://unsplash.com/collections/2522082/work-in-progress?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></em></p>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[I am in the process of migrating my blog mkrak.org (Wordpress) to a Jekyll+Github based setup.]]></summary></entry><entry><title type="html">Down The Ethtool Rabbit Hole</title><link href="/2021/11/02/Down-the-ethtool-rabbit-hole.html" rel="alternate" type="text/html" title="Down The Ethtool Rabbit Hole" /><published>2021-11-02T00:00:00+00:00</published><updated>2021-11-02T00:00:00+00:00</updated><id>/2021/11/02/Down-the-ethtool-rabbit-hole</id><content type="html" xml:base="/2021/11/02/Down-the-ethtool-rabbit-hole.html"><![CDATA[<p>This is a short story of one of those problems where you scratch your head, but
curiosity does not allow you to leave questions unanswered so you dig deeper
and deeper until the revelation comes. In this case it was also an necessity
and not just curiosity.</p>

<p>I was working on Raspberry Pi Compute Module 4 (CM4) based hardware, and this
story is specifically about the Ethernet interface. CM4 supports up to 1000Mb
Ethernet speeds but due to a hardware issue we could not support the maximum
speeds on our carrier board.</p>

<p>My simple task (I thought) was to make sure that the Ethernet interface only
advertises supported link modes. This is related to Ethernet
<a href="https://en.wikipedia.org/wiki/Autonegotiation" target="_blank">autonegotiation</a>
and can be summed up as:</p>

<blockquote>
  <p>During autonegotiation, each device declares its technology abilities, that
is, its possible modes of operation. The best common mode is chosen, with
higher speed preferred over lower, and full duplex preferred over half duplex
at the same speed.</p>
</blockquote>

<p>The default supported and advertised modes are:</p>

<blockquote>
  <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>ethtool eth0
Settings <span class="k">for </span>eth0:
   Supported ports: <span class="o">[</span> TP MII <span class="o">]</span>
   Supported <span class="nb">link </span>modes:   10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Half 1000baseT/Full
   Supported pause frame use: Symmetric Receive-only
   Supports auto-negotiation: Yes
   Supported FEC modes: Not reported
   Advertised <span class="nb">link </span>modes:  10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Half 1000baseT/Full
   Advertised pause frame use: Symmetric Receive-only
   ...
</code></pre></div>  </div>
</blockquote>

<p>We can easily manipulate advertised link modes using
<a href="https://man7.org/linux/man-pages/man8/ethtool.8.html" target="_blank">ethtool advertise</a>:</p>

<blockquote>
  <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>ethtool <span class="nt">-s</span> eth0 advertise 0x00F
</code></pre></div>  </div>
</blockquote>

<p><code class="language-plaintext highlighter-rouge">0x0F</code> above means only advertise modes up to 100baseT Full
(see <a href="https://man7.org/linux/man-pages/man8/ethtool.8.html" target="_blank">ethtool man page for more info</a>:).</p>

<p>Inspecting the configuration we get:</p>

<blockquote>
  <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>ethtool eth0
Settings <span class="k">for </span>eth0:
   Supported ports: <span class="o">[</span> TP MII <span class="o">]</span>
   Supported <span class="nb">link </span>modes:   10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Half 1000baseT/Full
   Supported pause frame use: Symmetric Receive-only
   Supports auto-negotiation: Yes
   Supported FEC modes: Not reported
   Advertised <span class="nb">link </span>modes:  10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
   ....
</code></pre></div>  </div>
</blockquote>

<p>So far everything works as expected, and we can see above that we no longer
advertise the 1000baseT modes.</p>

<p>After initial testing with <code class="language-plaintext highlighter-rouge">ethtool</code>, I started looking in to a more permanent
solution, because this needs to be applied on boot and we had a larger fleet of
devices to apply this change to.</p>

<p>We are using a custom Linux distribution based on OE-core/Yocto Project and we
use
<a href="https://www.freedesktop.org/software/systemd/man/systemd.network.html" target="_blank">systemd-network</a>
as a network manager. There is a framework to apply network device configuration
in systemd-network called <a href="https://www.freedesktop.org/software/systemd/man/systemd.link.html" target="_blank">systemd.link</a>
which is exactly what we need right now.</p>

<p>The change is simple really (I thought), we just need to create a <code class="language-plaintext highlighter-rouge">.link</code> file
that matches our network interface with the correct configuration options.</p>

<p><strong>Example: /etc/systemd/network/10-internet.link</strong></p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code> <span class="o">[</span>Match]
 <span class="nv">OriginalName</span><span class="o">=</span>eth0

 <span class="o">[</span>Link]
 <span class="nv">Advertise</span><span class="o">=</span>10baset-half
 <span class="nv">Advertise</span><span class="o">=</span>10baset-full
 <span class="nv">Advertise</span><span class="o">=</span>100baset-half
 <span class="nv">Advertise</span><span class="o">=</span>100baset-full
</code></pre></div></div>

<p>This would be the equivalent configuration to the <code class="language-plaintext highlighter-rouge">ethtool</code> commands we ran
earlier.</p>

<p>I was very happy with these changes, until I tested them:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>systemd-udevd[175]: ethtool: Cannot get device settings <span class="k">for </span>eth0 : Invalid argument
systemd-udevd[175]: Could not <span class="nb">set </span>advertise mode: Invalid argument
</code></pre></div></div>

<p>What?! Probably my fault I thought, and I went back to reading the documentation
for <a href="https://www.freedesktop.org/software/systemd/man/systemd.link.html" target="_blank">systemd.link</a>
to check if I had missed something. I also tried to experiment with other
configuration options in my <code class="language-plaintext highlighter-rouge">.link</code> file, but whatever I put in there I always
got the same error message.</p>

<p>Still thinking that my understanding of systemd.link was not correct, I tried
a different approach. I created a simple udev rule:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">ACTION</span><span class="o">==</span><span class="s2">"add"</span>, <span class="nv">SUBSYSTEM</span><span class="o">==</span><span class="s2">"net"</span>, <span class="nv">KERNEL</span><span class="o">==</span><span class="s2">"eth*"</span>, RUN+<span class="o">=</span><span class="s2">"/usr/bin/ethtool -s </span><span class="nv">$name</span><span class="s2"> advertise 0x00F"</span>
</code></pre></div></div>

<p>Above did not give me a error message (or it was hidden somewhere by udevd),
but I could see that the configuration was not changed from the defaults with
<code class="language-plaintext highlighter-rouge">ethtool</code>.</p>

<p>This at least confirmed that my systemd.link file was probably OK, so I went
back to debug this. I only had the error messages from systemd-udevd to go on,
so I went to the systemd source code to look them up.</p>

<p>I focused on the first message:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>systemd-udevd[175]: ethtool: Cannot get device settings <span class="k">for </span>eth0 : Invalid argument
</code></pre></div></div>

<p>and found it in <a href="https://github.com/systemd/systemd/blob/f533135c6ce8de641ebf9cdf8deb53faa723479f/src/shared/ethtool-util.c#L974">src/shared/ethtool-util.c</a></p>

<pre><code class="language-C">r = get_glinksettings(*fd, &amp;ifr, &amp;u);
if (r &lt; 0) {
        r = get_gset(*fd, &amp;ifr, &amp;u);
        if (r &lt; 0)
                return log_debug_errno(r, "ethtool: Cannot get device settings for %s : %m", ifname);
}
</code></pre>

<p>Not sure which of these functions where failing but both of them rely on calling
<code class="language-plaintext highlighter-rouge">ioctl(SIOCETHTOOL)</code> and this was where the <code class="language-plaintext highlighter-rouge">EINVAL</code> was originating from. This
meant it was time to jump over to the Linux kernel code instead.</p>

<p>CM4 uses the
<a href="https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/broadcom/genet/bcmgenet.c">bcmgenet Ethernet driver</a>,
and I assumed that this code was involved to propagate link settings.</p>

<p>Indeed, there is a <code class="language-plaintext highlighter-rouge">ethtool_ops</code> struct that defines ethtool supported functions.
The ones that I was looking for are below since we got an error message when
trying to get link settings:</p>

<pre><code class="language-C">/* standard ethtool support functions. */
static const struct ethtool_ops bcmgenet_ethtool_ops = {
    ...
    .get_link_ksettings = bcmgenet_get_link_ksettings,
    .set_link_ksettings = bcmgenet_set_link_ksettings,
    ...
};
</code></pre>

<p>And looking at <code class="language-plaintext highlighter-rouge">bcmgenet_get_link_ksettings</code>, we see the reason of the <code class="language-plaintext highlighter-rouge">EINVAL</code>:</p>

<pre><code class="language-C">static int bcmgenet_get_link_ksettings(struct net_device *dev,
                       struct ethtool_link_ksettings *cmd)
{
    if (!netif_running(dev))
        return -EINVAL;

    if (!dev-&gt;phydev)
        return -ENODEV;

    phy_ethtool_ksettings_get(dev-&gt;phydev, cmd);

    return 0;
}
</code></pre>

<p>The <code class="language-plaintext highlighter-rouge">bcmgenet</code> driver requires the Ethernet interface to be up and running
before it will accept any ethtool commands, the same guard exists on all
ethtool_ops.</p>

<p>Looking at the source code for other Ethernet drivers, the behavior of
<code class="language-plaintext highlighter-rouge">bcmgenet</code> seems to be an exception rather then the rule. This probably relates
to some hardware limitation where Media Access Control (MAC) and PHY
(transceiver) are tightly coupled.</p>

<p>CM4 uses the BCM54210 PHY, but as I could not find a proper datasheet for this
component I stopped digging here.</p>

<h2 id="conclusion">Conclusion</h2>

<p>I think this post demonstrates the beauty of open source and the ability to
dig trough large software stacks to troubleshoot tricky problems.</p>

<p>It also demonstrates some of the usability challenges we are faced in the Linux
world. I make my living solving problems like these, but an average Linux user
would probably struggle and lets remind our self that user facing error was:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>systemd-udevd[175]: ethtool: Cannot get device settings <span class="k">for </span>eth0 : Invalid argument
</code></pre></div></div>

<p>But an average Linux user probably would not mess with advertised link modes of
the Eternet PHY, so I guess it is all good in the end.</p>

<p>Hopefully it was an enjoyable read at least.</p>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[This is a short story of one of those problems where you scratch your head, but curiosity does not allow you to leave questions unanswered so you dig deeper and deeper until the revelation comes. In this case it was also an necessity and not just curiosity.]]></summary></entry><entry><title type="html">Running A Yocto Generated Distribution On Google Coral Dev Board</title><link href="/2019/05/23/running-a-yocto-generated-distribution-on-google-coral-dev-board.html" rel="alternate" type="text/html" title="Running A Yocto Generated Distribution On Google Coral Dev Board" /><published>2019-05-23T00:00:00+00:00</published><updated>2019-05-23T00:00:00+00:00</updated><id>/2019/05/23/running-a-yocto-generated-distribution-on-google-coral-dev-board</id><content type="html" xml:base="/2019/05/23/running-a-yocto-generated-distribution-on-google-coral-dev-board.html"><![CDATA[<p>Updated instructions can be found here
<a href="https://github.com/mirzak/meta-coral/wiki/Quick-start-guide">https://github.com/mirzak/meta-coral/wiki/Quick-start-guide</a></p>

<p>Last week I got my hands on a Google Coral Dev Board and finally got some time
to play with it.</p>

<p><img src="https://lh3.googleusercontent.com/ySyx1CFwvy7dxA6L7XJCOb4jD6H4UK1DYa6jUUm8EFFbC40ce3YXkWNDKPnQLtATwhSDThPi0Dr5LfJHBzYf6VM7y5W7XT3qYrjWIA=w1000-rw" alt="" /></p>

<p>If you are not familiar with this board please
<a href="https://www.theverge.com/circuitbreaker/2019/3/6/18253106/google-ai-developer-new-tools-dev-board-usb-accelerator-camera-coral">read this article</a>
and also pay the
<a href="https://coral.withgoogle.com/products/dev-board">official product site</a> a visit
for more technical details. But in short it is a Linux based System-on-Module
called Edge TPU Module that is mounted on a development board which contains
some additional peripherals. Some key hardware features of the EDGE TP Module:</p>

<ul>
  <li>i.MX8MQ SoC with integrated GPU</li>
  <li>1 GB LPDDR4</li>
  <li>8 GB eMMC</li>
  <li>Google Edge TPU coprocessor (used to accelerate ML models)</li>
  <li>WiFI / Bluetooth</li>
</ul>

<p>The Coral Dev Board serves as an evaluation board for the Edge TPU Module but
it can also be used as a single-board computer similar to Rasbperry Pi 3 boards.
The Coral Dev Board comes with Linux distribution called Mendel OS which is
Debian derivative. The board did not actually contain the Mendel OS
pre-programmed, and I had to flash the board to get started. But this was
relativity easy as they do provide pre-built OS images and well documented
procedure how to flash the board. You can find the getting started guide here,</p>

<ul>
  <li><a href="https://coral.withgoogle.com/docs/dev-board/get-started/">https://coral.withgoogle.com/docs/dev-board/get-started/</a></li>
</ul>

<p>As I spend a lot of time building Linux distributions using
<a href="https://www.yoctoproject.org/">Yocto/OE-core</a> and Linux distributions on
embedded Linux devices in general are of interest to me, I had to dig deeper
in what Mendel OS was. I asked nicely on Coral website if the tooling to
generate Mendel OS was available publicly, and I received a prompt response
that it was and I got this link:</p>

<ul>
  <li><a href="https://coral.googlesource.com/docs/+/refs/heads/master/GettingStarted.md">https://coral.googlesource.com/docs/+/refs/heads/master/GettingStarted.md</a></li>
</ul>

<p>By following the outlined documentation above, I was able to fetch the source
code of all the components for further inspection. There where no real surprises
when I started looking closer and soon realized that that Mendel OS was built
upon fairly standard components coming from the NXP i.MX BSP for the i.MX8 SoC.
With this information I realized that I would be fairly easy to port this and I
set out to create a Yocto BSP layer to be able to build something that boots on
the Coral Dev Board. I only needed to implement three things in this layer to
get it to boot:</p>

<ul>
  <li>Recipe for U-boot fork</li>
  <li>Recipe for Linux kernel fork</li>
  <li>Created a recipe to deploy a <code class="language-plaintext highlighter-rouge">boot.scr</code>, and the source for the script I
copied from Mendel OS</li>
</ul>

<p>To build an image with Yocto you can use the following steps, Create directory
where you want to store the environment and change the shell to that location:</p>

<p>Initialize repo manifest:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>repo init <span class="nt">-u</span> https://github.com/Freescale/fsl-community-bsp-platform <span class="nt">-b</span> warrior
</code></pre></div></div>

<p>Fetch layers in manifest:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>repo <span class="nb">sync</span>
</code></pre></div></div>

<p>Clone <code class="language-plaintext highlighter-rouge">meta-clang</code>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone https://github.com/kraj/meta-clang.git sources/meta-clang <span class="nt">-b</span> warrior
</code></pre></div></div>

<p>Clone <code class="language-plaintext highlighter-rouge">meta-coral</code>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone https://github.com/mirzak/meta-coral.git sources/meta-coral <span class="nt">-b</span> warrior
</code></pre></div></div>

<p>Setup the environment:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">MACHINE</span><span class="o">=</span>coral-dev <span class="nv">DISTRO</span><span class="o">=</span>fslc-wayland <span class="nb">source</span> ./setup-environment build
</code></pre></div></div>

<p>Add the <code class="language-plaintext highlighter-rouge">meta-clang</code> layer to bblayers.conf:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s1">'BBLAYERS += "${BSPDIR}/sources/meta-clang"'</span> <span class="o">&gt;&gt;</span> conf/bblayers.conf
</code></pre></div></div>

<p>Add the <code class="language-plaintext highlighter-rouge">meta-coral</code> layer to bblayers.conf:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s1">'BBLAYERS += "${BSPDIR}/sources/meta-coral"'</span><span class="o">&gt;&gt;</span> conf/bblayers.conf
</code></pre></div></div>

<p>Start baking:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bitbake core-image-base
</code></pre></div></div>

<p>After the build has finished you should now have a WIC image:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">tmp/deploy/images/coral-dev/core-image-base-coral-dev.wic.gz</code></li>
</ul>

<p>This is an image that you can write either to the eMMC or an SD card to get a
booting system. To simplify things I changed boot mode of the Coral Dev Board
to boot from SD card instead of eMMC which is the default, and to do this I
adjusted the boot switches to the following,</p>

<p><img src="https://coral.withgoogle.com/static/docs/images/devboard/devboard-bootmode-sdcard.jpg" alt="" /></p>

<p>Since we already built our image, we can now write it to a SD card:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>zcat tmp/deploy/images/coral-dev/core-image-base-coral-dev.wic.gz | <span class="nb">sudo dd </span><span class="nv">of</span><span class="o">=</span>&lt;device&gt; <span class="nv">bs</span><span class="o">=</span>4M
</code></pre></div></div>

<p>Insert the SD card and boot the system, we should now end up at login prompt of a Yocto build distribution:</p>

<pre><code class="language-`bash">FSLC Wayland 2.7 coral-dev ttymxc0

coral-dev login
</code></pre>

<p>I have not yet done much testing of the different peripherals, but the basic
components (HDMI, Ethernet, USB) should work as I am using the same Linux kernel
as Mendel OS. I know of a couple of things that need some more work as it
depends on user-space components, and here is a very short list:</p>

<ul>
  <li>WiFi and Bluetooth (need to install correct firmware files)</li>
  <li>Google Edge TPU coprocessor (would be fun to get the ML demo from Mendel OS running in Yocto)</li>
</ul>

<p>The source code of the Yocto/OE-core BSP layer for Google Coral Dev can be found here</p>

<ul>
  <li><a href="https://github.com/mirzak/meta-coral">https://github.com/mirzak/meta-coral</a></li>
</ul>

<p>Happy testing and feel free to reach out if you are interested in getting involved.</p>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[Updated instructions can be found here https://github.com/mirzak/meta-coral/wiki/Quick-start-guide]]></summary></entry><entry><title type="html">Joining The Mission To Secure The Worlds Connected Devices</title><link href="/2018/07/02/joining-the-mission-to-secure-the-worlds-connected-devices.html" rel="alternate" type="text/html" title="Joining The Mission To Secure The Worlds Connected Devices" /><published>2018-07-02T00:00:00+00:00</published><updated>2018-07-02T00:00:00+00:00</updated><id>/2018/07/02/joining-the-mission-to-secure-the-worlds-connected-devices</id><content type="html" xml:base="/2018/07/02/joining-the-mission-to-secure-the-worlds-connected-devices.html"><![CDATA[<p>Exciting times!</p>

<p>I have gotten the opportunity to start working for
<a href="https://northern.tech/">northern.tech</a>, the commercial entity behind the
<a href="https://mender.io/">Mender</a> project. Before I start writing about my
relationship with Mender I wanted just link to
<a href="https://northern.tech/blog/tag:culture">Northern.tech culture blog</a>, to give
you an idea of the company culture which is always a deciding factor for me when
choosing an employer and there are some interesting ideas in the posts that
might inspire you and your company.</p>

<p>I have been a community member of the Mender project since 2016, doing various
things. It started out with me adding support for the popular Raspberry Pi
boards. The initial reference boards where Beaglebone Black and qemuarm, I did
not have a BBB board at the time but I wanted to try Mender out, so of course
you port it to what you have laying around on the desk. Now days the the
Raspberry Pi 3 is one of the official supported boards and the entry point for
many to the project.</p>

<p>Another contribution worth mentioning that I did during my time as a community
member, was to add support for updating UBI volumes on raw NAND based devices.
Initially Mender only supported block based devices, that is eMMC/SD. Should be
noted that I only did the initial UBI work, this was later picked up by the
project and integrated in QA/CI and became officially supported.</p>

<p>I have enjoyed following the projects from it early days and been part of the
community as it has grown and I look forward to continue being part of it now
as an employee.</p>

<p>Going from a community member to employee, it makes sense to focus on tasks
that will enable the community even further and one of the first things that I
am looking at and that we have planned is to a take look how we can improve
community integration of boards. The goal with this is:</p>

<ul>
  <li>Better overview of board support
    <ul>
      <li>What boards are supported?</li>
      <li>What is the status of the integration</li>
    </ul>
  </li>
  <li>Easier to get started on one of the supported boards</li>
  <li>Easier to contribute support for your board</li>
</ul>

<p>You can follow this work here:</p>

<ul>
  <li><a href="https://tracker.mender.io/browse/MEN-1962">Community integrated boards</a></li>
</ul>

<p>Feedback is always welcome, so please join the discussion. I really hope that we
can collaborate on this.</p>

<p>I would also like to extend a thank you to my previous employer
<a href="https://endian.se/">Endian Technologies AB</a>. I have really enjoyed working
here and we part ways on the best terms I believe. I have always felt the
support of the company and of my colleagues for all my idea and endeavors. If
you are looking for a job in Gothenburg, Sweden, they now have a slot to fill :).</p>

<p>Looking ahead of what will happen regarding posts on this site, I will probably
pause the article series that I have started on software updates solutions,
since now I am getting paid working a specific project. I do believe that I
could continue this without being effected by that, but I also want to write
about other things. I have not decided what yet. It will probably be more Yocto
focused posts and probably more stuff about hardware.</p>

<p>Stay tuned!</p>

<p>NOTE!</p>

<p>For more technical insights about Mender take a look at one of my previous posts:<br />
– <a href="https://mkrak.org/2018/02/09/updating-embedded-linux-devices-mender/">Updating Embedded Linux Devices: Mender</a>.</p>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[Exciting times!]]></summary></entry><entry><title type="html">Elc 2018 Retrospective</title><link href="/2018/03/24/elc-2018-retrospective.html" rel="alternate" type="text/html" title="Elc 2018 Retrospective" /><published>2018-03-24T00:00:00+00:00</published><updated>2018-03-24T00:00:00+00:00</updated><id>/2018/03/24/elc-2018-retrospective</id><content type="html" xml:base="/2018/03/24/elc-2018-retrospective.html"><![CDATA[<p>My last post was written from Portland, Oregon where I was attending and
speaking at the Embedded Linux Conference. It was definitely a busy week that I
spent there trying to absorb as much as possible from all the sessions and the
“hallway track”, while also connecting with people over beers
(Portland = beer town).</p>

<p>My intention was to write-up a summary of the event from my perspective and here
it is.</p>

<p>This years ELC event was hosted in the downtown
<a href="http://www3.hilton.com/en/hotels/oregon/hilton-portland-downtown-PDXPHHH/index.html">Hilton Hotel in Portland</a>.
The date of event was March 12 – 14 and that was Monday – Wednesday.</p>

<h2 id="venue">Venue</h2>

<p>One thing that surprised me when we entered the Hilton Hotel on Monday morning
was the lack of information/signs in the lobby. I thought first that we arrived
at the wrong Hilton Hotel (do not know actually know if there are multiple
Hilton hotels Portland). I was mostly comparing this experience with past ELCE
events where you are usually greeted at the door and it is very hard to miss
that there is a ELC event going on here. But here there was nothing. We walked
past the huge lobby and reached a couple of stairs, and it was first here we
saw a sign saying that ELC event registration is upstairs. Which brings up the
second problem and last problem/complaint I had with the venue. This particular
venue and event was distributed across several floors and the floors where
quite small, mostly meaning that there where no large open areas. This layout
made the event feel a lot smaller then it actually was because you had people
distributed across several floors and this is how it was most of the day. During
the evening events you would get most the people in one place but then it was
very crowded and loud.</p>

<p>There was one thing that was new at the registration, at least I have not seen
this on earlier events. And that was that you where able to choose the design
of your conference t-shirt. Though they called it “create a custom design” you
where only able to choose from two different templates with no additional
customization, which means that you where able to choose between two different
t-shirts. Note that there there two design for ELC and two for IoT Summit. But
they did actually print the t-shirt design that you choose on site. To me this
was mostly a inconvenience and it did not add much value to the experience. You
choose which design you wanted at registration, waited a day to get a
notification that it was ready to be picked up, waited in line to pick it up
and that was it. I would rather have just picked it up when I registered which
was on Sunday during the pre-registration to avoid the initial lines.</p>

<h2 id="overall-impressions">Overall impressions</h2>

<p>Every ELC(E) event that I have been to, there has been something that stands
out. I have mostly been to ELCE, but one year it was all Yocto, the next one
was all Yocto again, 2016 was big focus on software updates and so on.</p>

<p>This year, for me it was RISC-V, the new kid on the block. I have not really
heard about SiFive until they announced their
<a href="https://www.sifive.com/products/hifive-unleashed/">HiFive Unleashed</a> board,
The First Linux-ready RISC-V Chip. They first announced it in February 2018 at
<a href="https://fosdem.org/2018/">FOSDEM</a>. I had heard of RISC-V but never really
given it much thought or looked closer what it actually is.</p>

<p>RISC-V is an open-source full-featured ISA with origins in UC Berkeley and is
now days standardized and managed by the non-profit organization
<a href="https://riscv.org/">RISC-V Foundation</a>. The members list is impressive with
companies like Google, NVIDIA, Qualcomm, Samsung and many more. Having an open
and free ISA means that there are no license fees nor restrictions on the
entities that implement it, which of course is interesting to the major silicon
vendors in the mobile and embedded market which is exclusively ARM which is
associated with license fees. A free ISA opens some new exciting doors and it
will be interesting to follow what lays ahead.</p>

<p>SiFive hosted a Hackathon along side ELC which I attended. You can read more
about the actual Hackathon <a href="https://www.sifive.com/blog/2018/03/03/all-aboard-part-11-risc-v-hackathon-presented-by-sifive/?utm_campaign=Newsletter&amp;utm_source=hs_email&amp;utm_medium=email&amp;_hsenc=p2ANqtz-9UVbS-YikeZ2CEM1f1hcRioEsM4TSfI4-Tg_NMJ7zDUrH3XagUloJlgw2ChJKaSAQWWFOR">here</a>.</p>

<p>My intention with attending was not be part of the competitions, because I
knew that I could not spend the time necessary. I did have one goal though,
booting something built with Yocto/OE-core on the board, using
<a href="https://github.com/riscv/meta-riscv">meta-riscv</a> which at the time only had
support for a qemuriscv64 machine. I did not accomplish this completely during
the event but I did manage to do some work which I cleaned up when I got home
and which I
<a href="https://github.com/riscv/meta-riscv/pull/3">published, and it got accepted in the upstream meta-riscv layer</a>.
There is actually still some tests pending to be run on my work as very few
people have the actual board but hopefully it is only minor tweaks to get it
working fully.</p>

<p><img src="/assets/images/2018-elc-hackaton.jpg" alt="" />
<em>Hacking on the HiFive Unleashed @ SiFive Hackethon</em></p>

<h2 id="day-1-sessions">Day 1 (Sessions)</h2>

<p>On day one I arrived early (do not want to miss anything) and ate of the
complementary breakfast. And then it was off to the Grand Ballroom, venue for
the keynotes. I obviously arrived a bit earlier to get a good seat, which I was
happy about because the room filled up fast.</p>

<p><img src="/assets/images/2018-elc-grand-ballroom.jpg" alt="" />
<em>Grand Ballroom</em></p>

<p>It was hard to capture the full room from that angle but it should give you an
idea of how it was. Note that most of the pictures where taken with my phone
which does not have the best camera.</p>

<p>I sat through all the keynotes which where:</p>

<ul>
  <li><a href="https://www.youtube.com/watch?v=wirx1SwMlbA">Keynote: Welcome – Tim Bird, ELC Co-Chair &amp; Philip DesAutels, IoT Co-Chair</a></li>
</ul>

<p>It is always pleasant to listen to Tim Bird and you can feel the passion that
he has for this community and the events that we all like to attend to much.</p>

<ul>
  <li><a href="https://www.youtube.com/watch?v=Jux_FAzpP30">Keynote: Intelligent Internet of Things: Start Analyzing Your Global Device
Data for Real-Time – Antony Passemard, Product Management Lead – Cloud IoT, Google</a></li>
</ul>

<p>In this talk Antony talked about how he feels that “IoT will disappear” and how
it is not interesting to bring up numbers of connected devices but instead talk
about the value that these devices bring by utilizing cloud technologies
combined with machine learning and AI.</p>

<p>The three challenges with IoT that Antony focused on was:</p>

<ul>
  <li>Connecting devices securely</li>
  <li>Scaling (big-data)</li>
  <li>Actionable insights (ML)</li>
</ul>

<p>And presented solutions on Google solve these within the Google Cloud IoT
solution.</p>

<p>Overall a very good presentation and I can recommend you watching the full
video which I linked.</p>

<ul>
  <li><a href="https://www.youtube.com/watch?v=pxd93jb1OAk">Keynote: Designing the Next Billion Chips: How RISC-V is Revolutionizing
Hardware – Yunsup Lee, Co-Founder and CTO, SiFive</a></li>
</ul>

<p>Yunsup Lee from SiFive explained on how they are planing on changing the
hardware market (silicon) taking inspiration from software, that is basing it
on open-source and RISC-V. In the hopes to reduce cost and lead-times making
custom chips available to the masses.</p>

<p>One interesting analogy from the talk is that the effort to order a custom SoC
should be as easy as ordering pizza.</p>

<p>Watch the full presentation!</p>

<p>After the keynotes it was time to head up to the 23rd floor to the SiFive
Hackethon for an introduction. I did not stay for the full introduction as I
wanted to attend the Mender BoF which was at the same time.</p>

<ul>
  <li><a href="https://www.youtube.com/watch?v=SAWxFqzH-dY">BoF: Mender, Current and Future Status of the Open Source Project – Eystein Stenberg, Mender.io</a></li>
</ul>

<p>This obviously interested me as I am involved on the community side of the
<a href="https://mender.io/">Mender project</a>, which I have been part for the last two
years and it is always nice to talk with people that have used the project and
discuss the future road-map.</p>

<p>Eystein Stenberg gave an introduction with an demo of the Mender server which
is used for device and deployment management.</p>

<p>The current focus for the Mender development team is:</p>

<ul>
  <li>Automatic U-boot patching
    <ul>
      <li>This is basically a bash script that is able to patch most of the upstream
boards in U-boot with the required   integration points for Mender. Mender
uses U-boot to do the A/B rootfs switching and for roll-back.</li>
    </ul>
  </li>
  <li>Mender community integrations
    <ul>
      <li>Index of community ports of Mender</li>
    </ul>
  </li>
  <li>Free CI
    <ul>
      <li>Mender has extensive CI environment that they plan on making available to
the community. TBD how this will work.</li>
    </ul>
  </li>
</ul>

<p>Then there was a free discussion. Here are some keywords from my notes:</p>

<ul>
  <li>Schedule updates
    <ul>
      <li>cron like</li>
      <li>Salting out / campaign management</li>
    </ul>
  </li>
  <li>Factory reset?
    <ul>
      <li>Overlay FS?</li>
    </ul>
  </li>
  <li>Chain devices?
    <ul>
      <li>http proxy?</li>
    </ul>
  </li>
  <li>Delta updates?
    <ul>
      <li>Payed alternative CI service</li>
    </ul>
  </li>
  <li>Dynamic groups</li>
</ul>

<p>After the Mender BoF it was back to the 23rd floor for the SiFive Hackethon,
and I stayed here for a while working until late afternoon when I joined the
following session.</p>

<ul>
  <li><a href="https://www.youtube.com/watch?v=TdsmjqWJmfc">OpenEmbedded/Yocto on RISC-V – New Kid on the Block – Khem Raj, Comcast</a></li>
</ul>

<p>Obviously I went to this as I was attending the Hackethon and working on
getting Yocto/OE-core to boot on the HiFive Unleashed board.</p>

<p>In this talk Khem Raj provides an good overview of the current state of the
RISC-V port (linux, gcc, qemu and more) in general and what the status is of
meta-riscv and RISC-V in OE-core.</p>

<p>To summarize (what works):</p>

<ul>
  <li>You can build
    <ul>
      <li>core-image-minimal</li>
      <li>core-image-base</li>
      <li>core-image-fullcmdline</li>
    </ul>
  </li>
  <li>You can generate SDK/eSDK</li>
  <li>You can build and boot RISC-V qemu</li>
</ul>

<p>To summarize (needs work!)</p>

<ul>
  <li>Graphical target images (core-image-sato/x11/weston)</li>
  <li>QEMU self-test
    <ul>
      <li>Important to get working, large run-time test suite provided by Yocto/OE-core.</li>
    </ul>
  </li>
</ul>

<p>I approached Khem after his talk and told him that I was working on the HiFive
Unleashed board support for meta-riscv. He later joined us at the 23rd floor
and helped me out with some issues I was having. Big thanks for that!</p>

<ul>
  <li><a href="https://www.youtube.com/watch?v=ULouYBeoNBY&amp;t=1s">Update My Board! – Mirza Krak, Endian Technologies AB</a></li>
</ul>

<p>The day of my presentation on how to integrate an open-source software update
solution to a custom board. My time-slot was 10:50am and I decided that I would
skip the keynotes this morning and found an empty room to test out all the
technical stuff, that is connecting my laptop to a projector and to actually
see that it works smoothly. I had tested back home but was a bit paranoid and
wanted to make sure that it all still worked, and it did!</p>

<p>Rest of the time I spent walking around being nervous. This was the first time
for me speaking to a larger audience (20+) and in my field ELC is the biggest
conference, so the pressure was on. I actually went to the last keynote which
was in the same room where my session was planned (Grand Ballroom II) to be
nearby and to be able to setup my presentation straight after the keynotes
finished.</p>

<p>Overall I am happy with how the session went and there was good number of people
attending. I am happy that there where many questions at the end of my session
as it always more fun to interact with the audience. Though I did the rookie
mistake and did not repeat the questions on the microphone and it can be hard
to hear the questions on the recording. It is an learning journey and hopefully
if I am given the opportunity to speak again I will remember this lesson.</p>

<p>When my session was over it felt a bit lighter to walk around at the event and
I mostly enjoyed the hallway track for the rest of day and hacking on the 23rd
floor.</p>

<p>There was a sponsor/technical showcase at the end of the day, as there normally
is at these events, but it was pretty much the same what was shown during the
normal sponsor showcase which was available during the day + beer :).</p>

<p>Last day of the conference was packed with content as well. I decided to attend
the keynotes in the morning. The one that stuck with me was:</p>

<ul>
  <li><a href="https://youtu.be/wKHa889Q5Uw">Keynote: Calm Technology: Design for the Next 50 Billion Things – Amber Case, Author and Fellow at Harvard’s Berkman Klein Center</a></li>
</ul>

<p>In this talk Amber Case talks about how we are all cyborgs and how to apply
Calm Technology in our design of technology. Best experienced if watched!</p>

<p>After the keynotes I again went to the 23rd floor where it was time to finish
up the SiFive Hackaton. There was a demo session where attendees presented what
they have accomplished during the event.</p>

<p>Here are the winners:</p>

<p>The winner of the JavaScript benchmark competition, ported
<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/1.8.5">SpiderMonkey</a>
to RISC-V and ran the
<a href="https://webkit.org/perf/sunspider/sunspider.html">SunSpider</a> JavaScript
benchmark on the HiFive Unleashed board. I do not actually have results of the
benchmark but still an impressive achievement in a short time period.</p>

<p>The winner of the coolest demo was the was a team running OpenEmbedded on the
HiFive Unleashed board and running python.</p>

<p>I also presented the patches that I was preparing for meta-riscv which are now
upstream:</p>

<p>After the Hackethon finished up I was mostly attending the “hallway track”
until this session:</p>

<ul>
  <li><a href="https://youtu.be/l6NwYGbWO5s">Living on Master: Using Yocto Project, Jenkins and LAVA for a Rolling Release – Tim Orling, Intel</a></li>
</ul>

<p>Tim Orling presents how they do rolling releases using Yocto, Jenkins and LAVA
at the Intel Open Source Technology Center following the “Linux kernel model”.</p>

<p>Some really great insights and one interesting part is that Intel is planing to
open-source their whole infrastructure so that more can use it and improve it.
Can not wait to see this and hopefully set it up my self.</p>

<p>This was the last session that I attended at the ELC 2018 event and pretty much
called the conference here and had to “move” to another location as I was
staying with a group of people that where leaving on Wednesday but I stayed
until Thursday.</p>

<p>I did join the SiFive team and Hackathon attendees at
<a href="https://henrystavern.com/menu.php?c=portland">Henry`s</a> in the evening and we
had a blast and was a really nice way of finishing of my trip.</p>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[My last post was written from Portland, Oregon where I was attending and speaking at the Embedded Linux Conference. It was definitely a busy week that I spent there trying to absorb as much as possible from all the sessions and the “hallway track”, while also connecting with people over beers (Portland = beer town).]]></summary></entry><entry><title type="html">Just In From Portland Oregon</title><link href="/2018/03/12/just-in-from-portland-oregon.html" rel="alternate" type="text/html" title="Just In From Portland Oregon" /><published>2018-03-12T00:00:00+00:00</published><updated>2018-03-12T00:00:00+00:00</updated><id>/2018/03/12/just-in-from-portland-oregon</id><content type="html" xml:base="/2018/03/12/just-in-from-portland-oregon.html"><![CDATA[<p>I am writing this post from Portland, Oregon. I am here because of the Embedded
Linux Conference where I am also presenting a talk on
<a href="https://elciotna18.sched.com/event/6239fc0d5ecd64fcddb0e195c12ad475">how to integrate an open-source software update solution on your board</a>. If you are in the area please stop by or get
in touch and lets grab a bear/coffe/whateva :).</p>

<p>This is my first visit to the United States of America and so far it has been a
pleasant experience, I arrived last night and have been able to walk around a
bit, seeing the city and socializing. Today I will be busy with the conference
which is packed with interesting sessions.</p>

<p>I have also registered for the
<a href="https://www.sifive.com/blog/2018/03/03/all-aboard-part-11-risc-v-hackathon-presented-by-sifive/">SiFive Hackathon</a>, which is co-hosted with ELC. I will probably not have time to focus on the
competitions but I am hoping on doing some kind of hacking on the
Freedom U540-C000, the world’s first Linux-capable RISC-V ASIC. First step is
probably to setup an Yocto build and boot it on the real hardware, I have tried
this with an qemu with successful result and hopefully the transition to real
hardware is not that painful.</p>

<p>I am planing on writing a article to summarize the full experience of ELC and
and the
<a href="https://www.sifive.com/blog/2018/03/03/all-aboard-part-11-risc-v-hackathon-presented-by-sifive/">SiFive Hackathon</a>,
so stay tuned! I will also be posting on the event continuously on my
<a href="https://twitter.com/KrakMirza">Twitter account</a>, follow if you are interested.</p>

<p>I still plan on continuing on writing on my “Updating embedded Linux devices”
article series when I get back home and the next project that I will cover is
<a href="https://ostree.readthedocs.io/en/latest/">libostree</a>.</p>

<p><img src="/assets/images/elc-2018-badge.jpg" alt="" /></p>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[I am writing this post from Portland, Oregon. I am here because of the Embedded Linux Conference where I am also presenting a talk on how to integrate an open-source software update solution on your board. If you are in the area please stop by or get in touch and lets grab a bear/coffe/whateva :).]]></summary></entry><entry><title type="html">Updating Embedded Linux Devices Mender</title><link href="/2018/02/09/updating-embedded-linux-devices-mender.html" rel="alternate" type="text/html" title="Updating Embedded Linux Devices Mender" /><published>2018-02-09T00:00:00+00:00</published><updated>2018-02-09T00:00:00+00:00</updated><id>/2018/02/09/updating-embedded-linux-devices-mender</id><content type="html" xml:base="/2018/02/09/updating-embedded-linux-devices-mender.html"><![CDATA[<p>This post if part of the “Updating embedded Linux devices” series, previous posts
are:</p>

<ul>
  <li><a href="https://mkrak.org/2017/11/18/updating-embedded-linux-devices-part-0/">Updating Embedded Linux Devices: Background</a></li>
  <li><a href="https://mkrak.org/2018/01/10/updating-embedded-linux-devices-part1/">Updating Embedded Linux Devices: Update strategies</a></li>
  <li><a href="https://mkrak.org/2018/01/26/updating-embedded-linux-devices-part2/">Updating Embedded Linux Devices: SWUpdate</a></li>
</ul>

<p>Next up on my software update journey is:</p>

<p>My introduction with Mender was back in 2016. They where sponsors of ELCE
(Embedded Linux Conference Europe) 2016 and that is how first found a link to
<a href="https://mkrak.org/2018/02/09/updating-embedded-linux-devices-mender/mender.io">mender.io</a>.
I had an interest for firmware updates on embedded Linux already back then I had
to try it out.</p>

<p>Back then they only supported QEMU and Beaglebone Black machines but I wanted
to test this out on my Raspberry Pi. Which lead to me porting Mender to
Rasbperry Pi boards and pushing it
<a href="https://github.com/mendersoftware/meta-mender/commit/59921e0862d3c778332bf09ace63e49e9024da84#diff-c91144d73d22cd6fa32d45e56576dc04">upstream</a>.
I have since then been a community member of the project with various contributions.</p>

<p>But what is Mender?</p>

<p>Mender is an open-source over-the-air firmware updater for embedded Linux
devices, written in Golang. There is a blog post that reasons on the choice of
<a href="https://mender.io/blog/why-did-we-choose-golang-over-c">Golang over C</a>.
Mender consists of a client that runs on your device but also a complete server
side solution in which you can manage your software deployments, which also
open-source. Mender is licensed under Apache 2.0.</p>

<p>Mender was developed by a commercial entity, https://northern.tech/. They are
still the main contributers to the project, though the community side of the
project has also grown and is quite active as well. This is a quite common
layout now days, and in my opinion it is handled very well in this case. Mender
has 35 repositories on their
<a href="https://github.com/mendersoftware">github organization</a>, which includes client,
server, QA and tooling. The project has also an open issue tracker where you can
get insight in what is currently worked on and external users can create new
issues. All this means that the entity behind Mender is serious with this being
a fully open-source project.</p>

<p>Lets get technical.</p>

<p>Mender is not a framework, compared to the
<a href="https://mkrak.org/2018/01/26/updating-embedded-linux-devices-part2/">previous</a>
project I covered. Instead Mender aims to be a robust out-of-the box end-to-end
solution to deploy a
<a href="https://mkrak.org/2018/01/10/updating-embedded-linux-devices-part1/">“Dual Copy”</a>
update strategy on your device.</p>

<p>Key features are:</p>

<ul>
  <li>Deployment management server part of the project</li>
  <li>Fully atomic image based updates</li>
  <li>Secure TLS communication between client/server</li>
  <li>Automated rollback implemented out-of-the box</li>
  <li>Support for signed update images</li>
  <li>Support for compressed update images which are streamed from server straight to storage medium</li>
  <li>Scripting support for custom application actions and control of update process</li>
  <li>Support of resuming download of update image, in case of unstable data connections</li>
  <li>Support for writing eMMC/SD and UBI volumes.</li>
  <li>Comprehensive QA system on reference boards</li>
</ul>

<p>There is a lot more which can be found <a href="https://mender.io/product/features">here</a>.</p>

<p>As I have mentioned earlier, Mender deploys a “Dual Copy” update strategy which
means that it is only able to do full image updates.</p>

<p>Mender has the following requirements:</p>

<ul>
  <li>Mender client is roughly 7 MB</li>
  <li>Partition layout of you storage medium (two partitions for root file-system,
and one data partition (persistent data storage))</li>
  <li>Mender relies on U-boot (2014.07 or newer) for rollback and to switch active
partition</li>
  <li>Yocto Project, in theory you could install Mender independently but you get a
lot when you use their Yocto layers.</li>
</ul>

<p>There is a blog post on
<a href="https://mender.io/blog/porting-mender-to-a-non-yocto-build-system">how to integrate Mender on non-Yocto system</a>. There is no need for me to duplicate this here, this means that we will start
off using Yocto.</p>

<p>My idea is to build a system image for my Beaglebone Black using Yocto and then:</p>

<ul>
  <li>
    <p>Try out the Mender client on target and perform updates using the standalone
mode, that is without utilizing the Mender server component</p>
  </li>
  <li>
    <p>Try out OTA updates using Mender server component</p>
  </li>
</ul>

<p>Lets start of with setting up our Yocto environment:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">mkdir </span>mender-yocto <span class="o">&amp;&amp;</span> <span class="nb">cd </span>mender-yocto

mender-yocto<span class="nv">$ </span><span class="nb">mkdir </span>layers <span class="o">&amp;&amp;</span> <span class="nb">cd </span>layers
mender-yocto/layers<span class="nv">$ </span>git clone git://git.yoctoproject.org/poky <span class="nt">-b</span> rocko
mender-yocto/layers<span class="nv">$ </span>git clone https://github.com/mendersoftware/meta-mender <span class="nt">-b</span> rocko
mender-yocto/layers<span class="nv">$ </span><span class="nb">cd</span> ..
mender-yocto<span class="nv">$ </span><span class="nb">.</span> layers/poky/oe-init-build-env build
mender-yocto/build<span class="nv">$ </span>bitbake-layers add-layer ../layers/meta-mender/meta-mender-core
mender-yocto/build<span class="nv">$ </span>bitbake-layers add-layer ../layers/meta-mender/meta-mender-demo
</code></pre></div></div>

<p>Before I can start baking an image I must add some configuration options to
<code class="language-plaintext highlighter-rouge">local.conf</code>.</p>

<p>First off we must set our desired machine.</p>

<p>To add all the features that Mender has to offer we must add the following.</p>

<p>Mender currently relies on <code class="language-plaintext highlighter-rouge">systemd</code> for a seamless experience, this means that
a <code class="language-plaintext highlighter-rouge">systemd</code> service is provided by default for the Mender client and
<code class="language-plaintext highlighter-rouge">meta-mender-demo</code> has some additional dependencies on <code class="language-plaintext highlighter-rouge">systemd-networkd</code>. But
there is not really a “hard” requirement to run <code class="language-plaintext highlighter-rouge">systemd</code>. Lets keep it simple
and make sure that <code class="language-plaintext highlighter-rouge">systemd</code> is used in our setup as well.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>DISTRO_FEATURES_append <span class="o">=</span> <span class="s2">" systemd"</span>
VIRTUAL-RUNTIME_init_manager <span class="o">=</span> <span class="s2">"systemd"</span>
DISTRO_FEATURES_BACKFILL_CONSIDERED <span class="o">=</span> <span class="s2">"sysvinit"</span>
VIRTUAL-RUNTIME_initscripts <span class="o">=</span> <span class="s2">""</span>
</code></pre></div></div>

<p>When we bake our image a Mender artifact will be created for us. This is the
file that we eventually will provide to the Mender client to perform the update.
This artifact contains version information that is set during build time, and
it is required to set this in our <code class="language-plaintext highlighter-rouge">local.conf</code>. “Different” images must have a
different name/version because Mender uses this string to rapport what software
the device is running an will skip updating if device is running an image with
the same name/version.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>MENDER_ARTIFACT_NAME <span class="o">=</span> <span class="s2">"starship-discovery"</span>
</code></pre></div></div>

<p>Now we can start baking</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mender-yocto/build<span class="nv">$ </span>bitbake core-image-full-cmdline
</code></pre></div></div>

<p>The Yocto setup process is also very well documented on <a href="https://docs.mender.io/1.3/artifacts/building-mender-yocto-image">Mender documentation site</a>.</p>

<p>From the build output there are two files that are of interest for us.</p>

<ul>
  <li>
    <p><code class="language-plaintext highlighter-rouge">*.sdimg</code> – This is the complete disk image that is partitioned according to
Mender requirements and this will be written to our device as a first step.
The partions that are created are:
	- bootpart (vfat) – Contains U-boot and MLO for the Beaglebone Black. This
	  part is optional as some boards store the bootloader at a certain offset
	  and not on a vfat partition</p>

    <ul>
      <li>
        <p>rootfsA – Our root file-system that we built using
<code class="language-plaintext highlighter-rouge">core-image-full-cmdline</code> and this is what will initially be booted.</p>
      </li>
      <li>
        <p>rootfsB – Same as above but this part will initially be inactive and this
is where we will write our next update.</p>
      </li>
      <li>
        <p>data – Persistent data partition that is not effected by updates. This
part is required as the Mender client will store some data here as well
while performing an update.</p>
      </li>
    </ul>
  </li>
  <li>
    <p><code class="language-plaintext highlighter-rouge">*.mender</code> – This is the file that we provide to the Mender client to perform
an update. The contents is simply a filesystem image, plus some additional
meta data. See
<a href="https://docs.mender.io/1.3/architecture/mender-artifacts">here</a> for more
info on the Mender artifact file-format.</p>
  </li>
</ul>

<p>This time around I will be using the uSD card on my Beaglebone and not the
on-board eMMC. This is because by default Mender assumes that our storage device
is <code class="language-plaintext highlighter-rouge">mmcblk0</code> which is the uSD interface on the Beaglebone Black. This is of
course configurable and we could have easily have changed this, but lets stick
to the defaults and use the uSD.</p>

<p>Lets write the <code class="language-plaintext highlighter-rouge">sdimg</code> to a uSD card</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">dd </span><span class="k">if</span><span class="o">=</span>core-image-full-cmdline-beaglebone.sdimg <span class="nv">of</span><span class="o">=</span>/dev/mmcblk0 <span class="nv">bs</span><span class="o">=</span>1M
</code></pre></div></div>

<p>Eject and inject the uSD to the BBB and power-on. Once booted we will see that
we now have the Mender client installed and it is running in “daemon” mode.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# systemctl status mender
</code></pre></div></div>

<blockquote>
  <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mender.service - Mender OTA update service

Loaded: loaded <span class="o">(</span>/lib/systemd/system/mender.service<span class="p">;</span> enabled<span class="p">;</span> vendor preset: enabled<span class="o">)</span>
Active: active <span class="o">(</span>running<span class="o">)</span> since Sat 2000-01-01 00:00:10 UTC<span class="p">;</span> 3min 37s ago
Process: 201 <span class="nv">ExecStartPre</span><span class="o">=</span>/bin/ln <span class="nt">-sf</span> /etc/mender/tenant.conf /var/lib/mender/authtentoken <span class="o">(</span><span class="nv">code</span><span class="o">=</span>exited, <span class="nv">status</span><span class="o">=</span>0/SUCCESS<span class="o">)</span>
Process: 198 <span class="nv">ExecStartPre</span><span class="o">=</span>/bin/mkdir <span class="nt">-p</span> <span class="nt">-m</span> 0700 /data/mender <span class="o">(</span><span class="nv">code</span><span class="o">=</span>exited, <span class="nv">status</span><span class="o">=</span>0/SUCCESS<span class="o">)</span>
Main PID: 202 <span class="o">(</span>mender<span class="o">)</span>
Tasks: 5 <span class="o">(</span>limit: 4915<span class="o">)</span>
CGroup: /system.slice/mender.service
─202 /usr/bin/mender <span class="nt">-daemon</span>
</code></pre></div>  </div>
</blockquote>

<p>Daemon mode is used when you connect to a Mender server to do OTA updates, we can keep it running even though we will not be using this part yet.</p>

<p>We can read-out the artifact info that we setup in our Yocto environment.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# <span class="nb">cat</span> /etc/mender/artifact_info
<span class="nv">artifact_name</span><span class="o">=</span>starship-discovery
</code></pre></div></div>

<p>We can also see that our uSD is partitioned according to what Mender expects.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~<span class="se">\#</span> fdisk <span class="nt">-l</span> /dev/mmcblk0
Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 <span class="se">\*</span> 512 <span class="se">\=</span> 512 bytes
Sector size <span class="o">(</span>logical/physical<span class="o">)</span>: 512 bytes / 512 bytes
I/O size <span class="o">(</span>minimum/optimal<span class="o">)</span>: 512 bytes / 512 bytes
Disklabel <span class="nb">type</span>: dos
Disk identifier: 0x13dabf82
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 <span class="se">\*</span> 49152 81919 32768 16M c W95 FAT32 <span class="o">(</span>LBA<span class="o">)</span>
/dev/mmcblk0p2 81920 507903 425984 208M 83 Linux
/dev/mmcblk0p3 507904 933887 425984 208M 83 Linux
/dev/mmcblk0p4 933888 1196031 262144 128M 83 Linux
</code></pre></div></div>

<p>If we inspect what is actually mounted.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# mount | <span class="nb">grep </span>mmc
/dev/mmcblk0p2 on / <span class="nb">type </span>ext4 <span class="o">(</span>rw,relatime,data<span class="o">=</span>ordered<span class="o">)</span>
/dev/mmcblk0p1 on /uboot <span class="nb">type </span>vfat <span class="o">(</span>rw,relatime,sync,fmask<span class="o">=</span>0022,dmask<span class="o">=</span>0022,codepage<span class="o">=</span>437,iocharset<span class="o">=</span>iso8859-1,shortname<span class="o">=</span>mixed,errors<span class="o">=</span>remount-ro<span class="o">)</span>
/dev/mmcblk0p4 on /data <span class="nb">type </span>ext4 <span class="o">(</span>rw,relatime,data<span class="o">=</span>ordered<span class="o">)</span>
</code></pre></div></div>

<p>We can see that <code class="language-plaintext highlighter-rouge">mmcblk0p2</code> is the current active root file-system and that
makes the <code class="language-plaintext highlighter-rouge">mmcblk0p3</code> the inactive one. We can also see that it has mounted
<code class="language-plaintext highlighter-rouge">mmcblk0p4</code> on <code class="language-plaintext highlighter-rouge">/data</code> and that is our persistent partition and anything we
store there will be left un-touched by updates. The bootpart is also mounted
to <code class="language-plaintext highlighter-rouge">/uboot</code>.</p>

<p>I earlier mentioned that I wanted to perform an update using the standalone
mode. So lets do that. We must somehow provide the <code class="language-plaintext highlighter-rouge">.mender</code> file to the Mender
client, I copied it to the persistent data partition (I was lacking network at
the time of writing as we could have also shared the file with a simple HTTP
server).</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# <span class="nb">ls</span> /data/
core-image-full-cmdline-beaglebone.mender lost+found mender persistent.txt u-boot
</code></pre></div></div>

<p>Now we can run a update.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# mender <span class="nt">-rootfs</span> /data/core-image-full-cmdline-beaglebone.mender
INFO[0000] Start updating from <span class="nb">local </span>image file: <span class="o">[</span>/data/core-image-full-cmdline-beaglebone.mender] <span class="nv">module</span><span class="o">=</span>rootfs
Installing update from the artifact of size 38288384
INFO[0000] opening device /dev/mmcblk0p3 <span class="k">for </span>writing <span class="nv">module</span><span class="o">=</span>block_device
INFO[0000] partition /dev/mmcblk0p3 size: 218103808 <span class="nv">module</span><span class="o">=</span>block_device
................................ 2% 1024 KiB
................................ 5% 2048 KiB
................................ 8% 3072 KiB
................................ 10% 4096 KiB
................................ 13% 5120 KiB
................................ 16% 6144 KiB
................................ 19% 7168 KiB
................................ 21% 8192 KiB
................................ 24% 9216 KiB
................................ 27% 10240 KiB
................................ 30% 11264 KiB
................................ 32% 12288 KiB
................................ 35% 13312 KiB
................................ 38% 14336 KiB
................................ 41% 15360 KiB
................................ 43% 16384 KiB
................................ 46% 17408 KiB
................................ 49% 18432 KiB
................................ 52% 19456 KiB
................................ 54% 20480 KiB
................................ 57% 21504 KiB
................................ 60% 22528 KiB
................................ 62% 23552 KiB
................................ 65% 24576 KiB
................................ 68% 25600 KiB
................................ 71% 26624 KiB
................................ 73% 27648 KiB
................................ 76% 28672 KiB
................................ 79% 29696 KiB
................................ 82% 30720 KiB
................................ 84% 31744 KiB
................................ 87% 32768 KiB
................................ 90% 33792 KiB
................................ 93% 34816 KiB
................................ 95% 35840 KiB
................................ 98% 36864 KiB
................INFO[0114] wrote 218103808/218103808 bytes of update to device /dev/mmcblk0p3 <span class="nv">module</span><span class="o">=</span>device
 100% 37391 KiB
INFO[0117] Enabling partition with new image installed to be a boot candidate: 3 <span class="nv">module</span><span class="o">=</span>device
</code></pre></div></div>

<p>Now we must reboot so that it can switch root file-system parts.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# reboot
</code></pre></div></div>
<p>And now we can see that it has changed root file-system part, making the initial
<code class="language-plaintext highlighter-rouge">mmcblk0p2</code> the inactive one.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# mount | <span class="nb">grep </span>mmc
/dev/mmcblk0p3 on / <span class="nb">type </span>ext4 <span class="o">(</span>rw,relatime,data<span class="o">=</span>ordered<span class="o">)</span>
/dev/mmcblk0p1 on /uboot <span class="nb">type </span>vfat <span class="o">(</span>rw,relatime,sync,fmask<span class="o">=</span>0022,dmask<span class="o">=</span>0022,codepage<span class="o">=</span>437,iocharset<span class="o">=</span>iso8859-1,shortname<span class="o">=</span>mixed,errors<span class="o">=</span>remount-ro<span class="o">)</span>
/dev/mmcblk0p4 on /data <span class="nb">type </span>ext4 <span class="o">(</span>rw,relatime,data<span class="o">=</span>ordered<span class="o">)</span>
</code></pre></div></div>

<p>One interesting thing though.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# <span class="nb">cat</span> /etc/mender/artifact_info
<span class="nv">artifact_name</span><span class="o">=</span>starship-discovery
</code></pre></div></div>

<p>We still have the same artifact name but I earlier said that it will skip
updating if it sees that the artifact matches what is already running on the
device. This is only true when performing OTA updates, and this check is skipped
when running updates in standalone mode.</p>

<p>There is one last step to perform to actually make this persistent.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# mender <span class="nt">-commit</span>
INFO[0000] Commiting update <span class="nv">module</span><span class="o">=</span>device
</code></pre></div></div>

<p>If we do not “commit” the update Mender would have rolled back to the previous
part on the next reboot. This is the mechanism that is used to prevent
corrupt/bad software updates. If the new update does not boot, it will not be
able to run <code class="language-plaintext highlighter-rouge">mender -commit</code> (obviously) and that will make sure that Mender
rolls back to the previous partition that is known to be good as it was the one
that initiated the update after all. One can also run addition tests before
running the <code class="language-plaintext highlighter-rouge">mender -commit</code> command, but this is highly application specific.</p>

<p>This was simple enough. Now I would like to try out OTA updates. And for that
we need a server for our devices to connect to. I am going to be a bit lazy
here and use the Mender Hosted (Beta) server for which I have access and I am
allowed to have 10 device connected to it.</p>

<p>It is well documented on how you setup your own server and Mender provides two
examples:</p>

<ul>
  <li><a href="https://docs.mender.io/1.3/administration/production-installation">Production</a></li>
  <li><a href="https://docs.mender.io/1.3/getting-started/create-a-test-environment">Demo</a></li>
</ul>

<p>To get my BBB to connect to my instance of the Mender server we need to go back
to Yocto and do some addition configuration.</p>

<p>We must setup the URL.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>MENDER_SERVER_URL <span class="o">=</span> <span class="s2">"https://hosted.mender.io"</span>
</code></pre></div></div>

<p>And we must the provide the tenant token (this requires an account on
hosted.mender.io).</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>MENDER_TENANT_TOKEN <span class="o">=</span> <span class="s2">"&lt;secret&gt;"</span>
</code></pre></div></div>

<p>The tenant token is only used the Hosted Mender (beta). For the
<a href="https://docs.mender.io/1.3/getting-started/create-a-test-environment">Demo</a>
and
<a href="https://docs.mender.io/1.3/administration/production-installation">Production</a>
environments the <code class="language-plaintext highlighter-rouge">/etc/mender/server.crt</code> file is used to authenticate the
device to your server. The <code class="language-plaintext highlighter-rouge">server.crt</code> for the demo environment is provided by
default without any changes. For the production environment you must replace the
demo <code class="language-plaintext highlighter-rouge">server.crt</code> with your custom one that you generated when you setup the
environment.</p>

<p>And now we must re-bake our image to make sure that this is added.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mender-yocto/build<span class="nv">$ </span>bitbake core-image-full-cmdline
</code></pre></div></div>

<p>Once it has finished we will use the <code class="language-plaintext highlighter-rouge">sdimg</code> once again to start of fresh.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">dd </span><span class="k">if</span><span class="o">=</span>core-image-full-cmdline-beaglebone.sdimg <span class="nv">of</span><span class="o">=</span>/dev/mmcblk0 <span class="nv">bs</span><span class="o">=</span>1M
</code></pre></div></div>

<p>Eject and inject to the BBB and power on.</p>

<p>Now I made sure that my BBB also has a Internet connection and I can see that it
was able to connect to my server.</p>

<p><img src="/assets/images/mender-overview.png" alt="" /></p>

<p>Before we can deploy any updates to device we must first authorize the device
and give it full access to the server. This is a one-time thing, the next time
the device connects to the server it will have full access. There are options on
the server to “block” or “decommission” devices en-forcing the authorization
step once again.</p>

<p>But I need to move to the “Devices” page and click the green button to accept
my BBB.</p>

<p><img src="/assets/images//mender-device-auth.png" alt="" /></p>

<p>Once I have done that I am able to get some additional information about my
device and here we see that we are running the <code class="language-plaintext highlighter-rouge">starship-discovery</code> artifact on a Beaglebone Black.</p>

<p><img src="/assets/images/mender-device-starship-discovery.png" alt="" /></p>

<p>To be able to deploy new software we must upload the artifacts (<code class="language-plaintext highlighter-rouge">.mender</code> files)
to the server under the “Artifacts” view. Lets start of with uploading the
<code class="language-plaintext highlighter-rouge">starship-discovery</code> artifact that was created in our latest build. Note that
we can not deploy this at the current state as this is already what is present
on our device.</p>

<p>Now we must create a second artifact that is not <code class="language-plaintext highlighter-rouge">starship-discovery</code> in our
Yocto environment. We update the <code class="language-plaintext highlighter-rouge">MENDER_ARTIFACT_NAME</code>.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>MENDER_ARTIFACT_NAME <span class="o">=</span> <span class="s2">"starship-enterprise"</span>
</code></pre></div></div>

<p>And bake.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mender-yocto/build<span class="nv">$ </span>bitbake core-image-full-cmdline
</code></pre></div></div>

<p>Now we can upload the <code class="language-plaintext highlighter-rouge">.mender</code> file that was generated with above build. And
the result on the server looks like this.</p>

<p><img src="/assets/images/mender-artifacts.png" alt="" /></p>

<p>And now I can start updating my BBB since I have two different images (though
the content is the same). I am not going to do a “step-by-step” instruction on
how to do deployments as it is pretty straightforward and I do not want to spam
this post with screen-shoots (already to late?).</p>

<p>But this is what it looks like once the deployments has started.</p>

<p><img src="/assets/images//mender-update-in-progress.png" alt="" /></p>

<p>Pretty neat overview of what is going on and we can follow the state changes
live as it progresses trough the update.</p>

<p>And if we go back to the “Devices” page once the deployment has finished we can
now see that my BBB is running the <code class="language-plaintext highlighter-rouge">starship-enterprise</code> artifact.</p>

<p><img src="/assets/images//mender-device-starship-enterprise.png" alt="" /></p>

<h2 id="conclusion">Conclusion</h2>

<p>The project has fantastic documentation and if I have caught your interest
continue reading <a href="https://docs.mender.io/">here</a>.</p>

<p>Mender has been around for a while and has a lot to offer and because it
enforces the
<a href="https://mkrak.org/2018/01/10/updating-embedded-linux-devices-part1/">“Dual Copy”</a>
strategy they are really able to optimize for this specific use case. The
Mender project has also put a lot of effort on integration tests that run on
real-hardware (BBB and RPi3) and qemu, and I really get that feeling when using
it (it just works).</p>

<p>It is a big plus that the deployment management server is integrated in the
project and the connection from client to server is seamless. It is relatively
easy to setup the server due to usage of <code class="language-plaintext highlighter-rouge">docker</code> and <code class="language-plaintext highlighter-rouge">docker-compose</code>.</p>

<p>Of course it does not fit everybody. Maybe it is not possible to deploy a
“Dual Copy” strategy on your device (due to size constraints) or image based
updates are not possible due to bandwidth costs but if you are thinking of
deploying a “Dual Copy” strategy on you device then it is probably best to
choose a project that focuses on that specific use-case.</p>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[This post if part of the “Updating embedded Linux devices” series, previous posts are:]]></summary></entry><entry><title type="html">Updating Embedded Linux Devices: SWUpdate</title><link href="/2018/01/26/updating-embedded-linux-devices-part2.html" rel="alternate" type="text/html" title="Updating Embedded Linux Devices: SWUpdate" /><published>2018-01-26T00:00:00+00:00</published><updated>2018-01-26T00:00:00+00:00</updated><id>/2018/01/26/updating-embedded-linux-devices-part2</id><content type="html" xml:base="/2018/01/26/updating-embedded-linux-devices-part2.html"><![CDATA[<p>This post if part of the “Updating embedded Linux devices” series, previous
posts are:</p>

<ul>
  <li><a href="https://mkrak.org/2017/11/18/updating-embedded-linux-devices-part-0/">Updating Embedded Linux Devices: Background</a></li>
  <li><a href="https://mkrak.org/2018/01/10/updating-embedded-linux-devices-part1/">Updating Embedded Linux Devices: Update strategies</a></li>
</ul>

<p>First up on my software update journey is:</p>

<p>In 2014 I attended ELCE (Embedded Linux Conference Europe) in Düsseldorf,
Germany, and this is also the time and place when I was introduced to
<a href="https://github.com/sbabic/swupdate">SWUpdate</a> when Stefane Babic did a
<a href="https://lccoelce14.sched.com/event/1yFSFUQ">talk</a> about this new project that
 he had started withing DENX. Was a great presentation and I left that session
 with a lot of new insights on the topic.</p>

<p>SWupdate has since then grown in to an mature project with an active community,
I try to keep up on what is happening in the project on the
<a href="https://groups.google.com/forum/#!forum/swupdate">mailing list</a> but it is
getting tougher to keep up as there is much going on. At the time of me writing
this there has been 16 releases and now days a new release is done every
3-4 months, a very healthy release cycle in my opinion.</p>

<p>But what is SWUpdate?</p>

<p>SWUpdate is an highly configurable and feature rich update agent
(written mostly in C). It does not enforce one specific kind of usage
(strategy) but instead provides a set of tools giving one the possibility to
fit it to your specific needs. In other words it is an framework to enable
software updates on you embedded Linux device.</p>

<p>Key features:</p>

<ul>
  <li>flexible update image format (.swu)
    <ul>
      <li>Syntax is one of
        <ul>
          <li>libconfig (default)</li>
          <li>JSON</li>
          <li>XML with an Lua parser</li>
        </ul>
      </li>
      <li>Supports targeting multiple targets/revisions with the same image file</li>
    </ul>
  </li>
  <li>Supports the common storage mediums trough different handlers
    <ul>
      <li>eMMC/SD,</li>
      <li>Raw flash (NAND, NOR, SPI-NOR)</li>
      <li>UBI volumes</li>
      <li>extensible with custom handlers in C or in Lua</li>
    </ul>
  </li>
  <li>Extensible with OTA support
    <ul>
      <li>Relies on <a href="https://projects.eclipse.org/proposals/hawkbit">Hawkbit</a> for the server part</li>
    </ul>
  </li>
  <li>Webserver can be activated to upload updates to device</li>
  <li>IPC trough a domain socket to get progress information on update</li>
  <li>Support for encrypted/signed update images</li>
  <li>Supports a master/slave approach, master can update multiple slaves running SWUpdate</li>
</ul>

<p>There is a lot more features, and you can read more about them
<a href="http://sbabic.github.io/swupdate/swupdate.html">here</a></p>

<p>The most common usage of SWUpdate is to do image based updates using a
“Single Copy” or a “Dual Copy” strategy. SWUpdate does support updating single
files on you root file-system or other partitions but I would assume that this
is only used in some specific cases such as updating some configuration file on
a “data” partition.</p>

<p>Lets get our hands dirty. But wait, what are the requirements of running
SWUpdate. I do not mean the dependencies to compile the program but the
requirements on the platform to be able to perform image based updates. Well
first of you must use a storage medium which SWUpdate supports and there exists
a handler for it, otherwise you need to write one but you are pretty safe here
as SWUpdate supports the most common mediums used on a embedded device.
Secondly you need a boot-loader which will have handle the “Dual Copy”
switching or the entrance to the “Recovery OS” in a “Single Copy” mode. This is
normally done by modifying some variable that both Linux and the boot-loader
have access to (environment variables). SWUpdate currently supports U-boot and
GRUB as boot-loaders.</p>

<p>I will be using a Beablebone Black as reference board which ticks of the
requirements and I was thinking of doing the following as a first step:</p>

<ul>
  <li>Install the latest official debian image on by board</li>
  <li>Download and compile SWUpdate natively on BBB (to keep it simple)</li>
  <li>Perform a “raw file” update, that is we will update an single file</li>
</ul>

<p>This is probably not something that I recommend for my readers to do as this is
a quite manual process and I am only doing this to provide some insight in the
different steps of doing an update with SWUpdate on a “concept” level. This is
probably not something that you can re-use a production environment.</p>

<p>I will later on do the same thing using Yocto which is a more production ready
approach.</p>

<p>Lets flash an SD card with the latest BBB debian image (at the time of me
writing this the latest image was 2017-10-10, this could have changed but
should work with newer images as well):</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>wget https://debian.beagleboard.org/images/bone-debian-9.2-iot-armhf-2017-10-10-4gb.img.xz
<span class="nv">$ </span>unxz bone-debian-9.2-iot-armhf-2017-10-10-4gb.img.xz
<span class="nv">$ </span><span class="nb">sudo dd </span><span class="k">if</span><span class="o">=</span>bone-debian-9.2-iot-armhf-2017-10-10-4gb.img <span class="nv">of</span><span class="o">=</span>/dev/mmcblk0
</code></pre></div></div>
<p>Insert the card and boot it.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Debian GNU/Linux 9 beaglebone ttyS0

BeagleBoard.org Debian Image 2017-10-10

Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

default username:password is <span class="o">[</span>debian:temppwd]

beaglebone login:
</code></pre></div></div>

<p>Before we can proceed we need to install some extra packages on our “fresh” image that are needed by SWUpdate:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~<span class="nv">$ </span><span class="nb">sudo </span>apt-get <span class="nb">install </span>lua5.2-dev libssl-dev libconfig-dev libarchive-dev <span class="se">\</span>
    libzmq3-dev libz-dev libcurl4-gnutls-dev libjson-c-dev
</code></pre></div></div>

<p>Now we download the SWUpdate source (2017.11 was the latest release at the time
of writing this):</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~<span class="nv">$ </span>git clone https://github.com/sbabic/swupdate.git <span class="nt">-b</span> 2017.11 <span class="o">&amp;&amp;</span> <span class="nb">cd </span>swupdate
</code></pre></div></div>

<p>SWUpdate uses the same build system as the Linux kernel (Kbuild) which might be
familiar to some. This means that there are a set of pre-defined configuration
files that we can use to configure and build SWUpdate.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~/swupdate<span class="nv">$ </span><span class="nb">ls </span>configs/
cms1_defconfig
cms_defconfig
debian_defconfig
hawkbit_defconfig
nodwl_defconfig
raspi_defconfig
sha256_defconfig
swuforwarder_defconfig
test_defconfig
with_lua_handlers_defconfig
with_lua_nohandlers_defconfig
without_libconfig_defconfig
without_lua_defconfig
with_systemd_defconfig
</code></pre></div></div>

<p>We are going to use <code class="language-plaintext highlighter-rouge">test_defconfig</code> which is convenient for our test purpose.
Some key features that are enabled/disabled.</p>

<ul>
  <li>No bootloader support (we do not want this feature at this stage as this
requires some integration work on the board)</li>
  <li>Webserver enabled</li>
  <li>Signed/Encrypted images</li>
  <li>Support to download update image from URL</li>
</ul>

<p>Lets configure our project:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~/swupdate<span class="nv">$ </span>make test_defconfig
</code></pre></div></div>

<p>And we can use <code class="language-plaintext highlighter-rouge">menuconfig</code> to browse/change the configuration of our project</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~/swupdate<span class="nv">$ </span>make menuconfig
</code></pre></div></div>

<p><img src="/assets/images/swupdate-menuconfig.png" alt="" /></p>

<p>But we are happy with the options enabled in <code class="language-plaintext highlighter-rouge">test_defconfig</code> so we are not
gonna make any additional changes.</p>

<p>Lets build and install:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~/swupdate<span class="nv">$ </span>make <span class="o">&amp;&amp;</span> <span class="nb">sudo </span>make <span class="nb">install</span>
</code></pre></div></div>

<p>If we try and start the binary that we have compiled we get the following error:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~<span class="nv">$ </span>swupdate
Swupdate v2017.11.0
Licensed under GPLv2. See <span class="nb">source </span>distribution <span class="k">for </span>detailed copyright notices.
swupdate built <span class="k">for </span>signed image, provide a public key file

&lt; ... <span class="se">\&gt;</span>
</code></pre></div></div>

<p>Since we enabled support for signed images we must provide a public key and all
update images must be signed with the corresponding private key.</p>

<p>Lets create a key-pair, we will do it on the BBB for convenience:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Create private key</span>
debian@beaglebone:~<span class="nv">$ </span>openssl genrsa <span class="nt">-out</span> swupdate-priv.pem

<span class="c"># Create a public key</span>
debian@beaglebone:~<span class="nv">$ </span>openssl rsa <span class="nt">-in</span> swupdate-priv.pem <span class="nt">-out</span> swupdate-public.pem <span class="se">\</span>
 <span class="nt">-outform</span> PEM <span class="nt">-pubout</span>
</code></pre></div></div>

<p>And now we can start SWUpdate:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~<span class="nv">$ </span><span class="nb">sudo </span>swupdate <span class="nt">-v</span> <span class="nt">-k</span> /home/debian/swupdate-public.pem <span class="se">\</span>
 <span class="nt">-w</span> <span class="s2">"-document_root /home/debian/swupdate/www"</span>
</code></pre></div></div>

<p>Since we built SWUpdate with the web-server enabled we can now go to our
browser and go to <code class="language-plaintext highlighter-rouge">http://&lt;device ip&gt;:8080/</code>, and we will be presented with
this:</p>

<p><img src="/assets/images/swupdate-webserver.png" alt="" /></p>

<p>Very simple web-interface that allows us to upload an update image, and its
power is really in that it is so simple and you need it to be. If you have
devices in the “wild” and can not provide updates over-the-air, you will rely
on people that are maybe not as technologically advanced as you are to update
devices, and then simplicity is key!</p>

<p>We have not yet created a update image so we can not upload anything, or well I
tried uploading some random file trying to fool it but as expected it did not
like that very much:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">[</span>network_initializer] : Main loop Daemon
Waiting <span class="k">for </span>requests...
<span class="o">[</span>network_initializer] : Main thread <span class="nb">sleep </span>again <span class="o">!</span>
Image invalid or corrupted. Not installing ...
ERROR core/cpio_utils.c : extract_cpio_header : 316 : CPIO Header corrupted, cannot be parsed
ERROR core/cpio_utils.c : get_cpiohdr : 44 : CPIO Format not recognized: magic not found
Software Update started <span class="o">!</span>
File information: random-file.zip size: 364724005 bytes
</code></pre></div></div>

<p>So lets try and construct a valid update image instead. First we must create
a <code class="language-plaintext highlighter-rouge">sw-description</code> file, which shall contain a set of instruction to SWUpdate
(what to install/update and where). The default syntax for this file is based
on <a href="http://www.hyperrealm.com/libconfig/libconfig_manual.html">libconfig</a> and
it looks like this in our simple case:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>software <span class="o">=</span>

<span class="o">{</span>
 version <span class="o">=</span> <span class="s2">"1.0.1"</span><span class="p">;</span>
 beaglebone <span class="o">=</span> <span class="o">{</span>
     hardware-compatibility: <span class="o">[</span> <span class="s2">"1.0"</span> <span class="o">]</span><span class="p">;</span>
         files: <span class="o">(</span>
             <span class="o">{</span>
             filename <span class="o">=</span> <span class="s2">"SWUpdate"</span><span class="p">;</span>
             path <span class="o">=</span> <span class="s2">"/SWUpdate"</span><span class="p">;</span>
             sha256 <span class="o">=</span> <span class="s2">"27ebafbe58603437d819cde3470811e5e64a8aa876a4fa680e5266e36bbee519"</span><span class="p">;</span>
             <span class="o">}</span>
         <span class="o">)</span><span class="p">;</span>
     <span class="o">}</span><span class="p">;</span>
<span class="o">}</span>
</code></pre></div></div>
<p>We want to update/install the file <code class="language-plaintext highlighter-rouge">SWUpdate</code> and the location on the target is
<code class="language-plaintext highlighter-rouge">/SWUpdate</code>. Simple enough. The <code class="language-plaintext highlighter-rouge">sw-description</code> files are highly configurable
and I will not try and to cover every aspect of it here as it already documented
<a href="https://sbabic.github.io/swupdate/sw-description.html">here</a>.</p>

<p>Our <code class="language-plaintext highlighter-rouge">sw-description</code> file says that it is only compatible with the hardware
version <code class="language-plaintext highlighter-rouge">1.0</code> of the <code class="language-plaintext highlighter-rouge">beaglebone</code> board. SWUpdate parses <code class="language-plaintext highlighter-rouge">/etc/hwrevision</code> on
start-up to figure out which board it is running and what version. We must
provide this file and it must contain the same information that we have provided
in our <code class="language-plaintext highlighter-rouge">sw-description</code> file:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"beaglebone 1.0"</span> <span class="o">&gt;</span> /etc/hwrevision
</code></pre></div></div>

<p>And we must restart SWUpdate because it only parses this on start-up.</p>

<p>We must also create the <code class="language-plaintext highlighter-rouge">SWUpdate</code> file that we want install/update and we
should end up with this:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~/update-image# <span class="nb">ls
</span>sw-description SWUpdate
root@beaglebone:~/update-image# <span class="nb">cat </span>sw-description
software <span class="o">=</span>
<span class="o">{</span>
 version <span class="o">=</span> <span class="s2">"1.0.1"</span><span class="p">;</span>
 beaglebone <span class="o">=</span> <span class="o">{</span>
     hardware-compatibility: <span class="o">[</span> <span class="s2">"1.0"</span> <span class="o">]</span><span class="p">;</span>
         files: <span class="o">(</span>
             <span class="o">{</span>
             filename <span class="o">=</span> <span class="s2">"SWUpdate"</span><span class="p">;</span>
             path <span class="o">=</span> <span class="s2">"/SWUpdate"</span><span class="p">;</span>
             sha256 <span class="o">=</span> <span class="s2">"27ebafbe58603437d819cde3470811e5e64a8aa876a4fa680e5266e36bbee519"</span><span class="p">;</span>
             <span class="o">}</span>
         <span class="o">)</span><span class="p">;</span>
     <span class="o">}</span><span class="p">;</span>
<span class="o">}</span>

root@beaglebone:~/update-image# <span class="nb">cat </span>SWUpdate
SWUpdate v1
</code></pre></div></div>

<p>The format of the update image that SWUpdate expects is an <code class="language-plaintext highlighter-rouge">cpio</code> archive and
the <code class="language-plaintext highlighter-rouge">sw-description</code> file must be the first file in the archive. To achieve this
we can run the following:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~/update-image# <span class="nb">export </span><span class="nv">FILES</span><span class="o">=</span><span class="s2">"sw-description SWUpdate"</span>
root@beaglebone:~/update-image# <span class="k">for </span>i <span class="k">in</span> <span class="nv">$FILES</span><span class="p">;</span> <span class="k">do </span><span class="nb">echo</span> <span class="nv">$i</span><span class="p">;</span> <span class="k">done</span> | cpio <span class="nt">-ov</span> <span class="nt">-H</span> crc <span class="o">&gt;</span> update-image-v1.swu
sw-description
SWUpdate
3 blocks
root@beaglebone:~/update-image# <span class="nb">ls
</span>sw-description SWUpdate update-image-v1.swu
</code></pre></div></div>

<p>And we have just created our first SWUpdate update image file! Lets try and upload it trough the web-interface:</p>

<p>(pasting log from web-interface instead of screen-shoots from now on)</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">[</span>network_initializer] : Main loop Daemon
Waiting <span class="k">for </span>requests...
<span class="o">[</span>network_initializer] : Main thread <span class="nb">sleep </span>again <span class="o">!</span>
Image invalid or corrupted. Not installing ...
<span class="o">[</span>extract_file_to_tmp] : description file name not the first of the list: SWUpdate instead of sw-description.sig
<span class="o">[</span>extract_file_to_tmp] : Found file: filename sw-description size 243
Software Update started <span class="o">!</span>
File information: update-image-v1.swu size: 1024 bytes
</code></pre></div></div>

<p>It is complaining that our image is corrupted or invalid. It is not super
obvious what is wrong here, but I intentionally uploaded an image that is not
signed and was expecting it to fail. Since we built SWUpdate with “signed image”
support it will not accept images that are not signed with a private key that
matches the public key we provided when we started SWUpdate.</p>

<p>So lets try this again. To add a signature to our update image we must create
the <code class="language-plaintext highlighter-rouge">sw-description.sig</code> file and it needs to be placed in the <code class="language-plaintext highlighter-rouge">cpio</code> archive
directly after the <code class="language-plaintext highlighter-rouge">sw-description</code> file.</p>

<p>To create an signature we must run the following:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~/update-image# openssl dgst <span class="nt">-sha256</span> <span class="nt">-sign</span> <span class="se">\</span>
    ~/swupdate-priv.pem sw-description <span class="o">&gt;</span> sw-description.sig
</code></pre></div></div>

<p>And re-create the cpio archive:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~/update-image# <span class="nb">export </span><span class="nv">FILES</span><span class="o">=</span><span class="s2">"sw-description sw-description.sig SWUpdate"</span>
root@beaglebone:~/update-image# <span class="k">for </span>i <span class="k">in</span> <span class="nv">$FILES</span><span class="p">;</span> <span class="k">do </span><span class="nb">echo</span> <span class="nv">$i</span><span class="p">;</span> <span class="k">done</span> | cpio <span class="nt">-ov</span> <span class="nt">-H</span> crc <span class="o">&gt;</span> update-image-v1.swu
sw-description
sw-description.sig
SWUpdate
3 blocks
</code></pre></div></div>
<p>And upload the file again:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">[</span>network_initializer] : Main loop Daemon
Waiting <span class="k">for </span>requests...
<span class="o">[</span>network_initializer] : Main thread <span class="nb">sleep </span>again <span class="o">!</span>
SWUPDATE successful <span class="o">!</span>
<span class="o">[</span>install_raw_file] : Installing file SWUpdate on /SWUpdate
<span class="o">[</span>install_single_image] : Found installer <span class="k">for </span>stream SWUpdate rawfile
Installation <span class="k">in </span>progress
<span class="o">[</span>network_initializer] : Valid image found: copying to FLASH
<span class="o">[</span>extract_files] : Found file: filename SWUpdate size 12 required
<span class="o">[</span>check_hw_compatibility] : Hardware compatibility verified
<span class="o">[</span>check_hw_compatibility] : Hardware beaglebone Revision: 1.0
<span class="o">[</span>swupdate_verify_file] : Verified OK
<span class="o">[</span>swupdate_verify_file] : Verify signed image: Read 332 bytes
<span class="o">[</span>parse_files] : Found File : SWUpdate <span class="nt">--</span><span class="o">&gt;</span> /SWUpdate <span class="o">(</span>ROOTFS<span class="o">)</span>
<span class="o">[</span>parse_hw_compatibility] : Accepted Hw Revision : 1.0
<span class="o">[</span>parse_cfg] : Version 1.0.1
<span class="o">[</span>extract_file_to_tmp] : Found file: filename sw-description.sig size 256
<span class="o">[</span>extract_file_to_tmp] : Found file: filename sw-description size 332
Software Update started <span class="o">!</span>
File information: update-image-v1.swu size: 1536 bytes
</code></pre></div></div>

<p>Success! And we can see that the file got installed:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# <span class="nb">cat</span> /SWUpdate
SWUpdate v1
</code></pre></div></div>

<p>SWUpdate also exposes an API for third party applications to monitor progress
of an update and provides some control as well of the process. A client library
is provided which communicates trough an Unix Domain Socket with the SWUpdate
process.</p>

<p>There are a couple of reference applications that was built together with
SWUpdate that utilize the client library.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~/swupdate/tools<span class="nv">$ </span>./progress <span class="nt">--help</span>

./progress <span class="o">(</span>compiled Jan 21 2018<span class="o">)</span>

Usage ./progress <span class="o">[</span>OPTION]

<span class="nt">-c</span>, <span class="nt">--color</span> : Use colors to show results
<span class="nt">-r</span>, <span class="nt">--reboot</span> : reboot after a successful update
<span class="nt">-w</span>, <span class="nt">--wait</span> : <span class="nb">wait </span><span class="k">for </span>a connection with SWUpdate
<span class="nt">-p</span>, <span class="nt">--psplash</span> : send info to the psplash process
<span class="nt">-s</span>, <span class="nt">--socket</span> &lt;path&gt; : path to progress IPC socket
<span class="nt">-h</span>, <span class="nt">--help</span> : print this <span class="nb">help </span>and <span class="nb">exit</span>
</code></pre></div></div>

<p>And this is one example what it can look like when it is running while
performing an update:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~/swupdate/tools<span class="nv">$ </span>./progress
Trying to connect to SWUpdate...
Connected to SWUpdate via /tmp/swupdateprog
Update started <span class="o">!</span>
Interface: UNKNOWN

<span class="o">[</span> <span class="o">============================================================</span> <span class="o">]</span> 1 of 1 100% <span class="o">(</span>SWUpdate<span class="o">)</span>

SUCCESS <span class="o">!</span>
</code></pre></div></div>

<p>Above could be used to display information about the update process if your
device has a graphical interface. One can also start or stop an update trough
the client library API, meaning that the application can be in full control
when the update can be started.</p>

<p>Moving forward my intention is to do a more advanced setup using SWupdate. For
this we will utilize Yocto where SWUpdate is supported with the
<a href="https://github.com/sbabic/meta-swupdate">meta-swupdate</a> layer. There is also a
layer provided a reference implementation of “Dual Copy” strategy on BBB and
Raspberry Pi 3 boards,
<a href="https://github.com/sbabic/meta-swupdate-boards">meta-swupdate-boards</a>.</p>

<p>For this we must setup our Yocto environment:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">mkdir </span>swupdate-yocto <span class="o">&amp;&amp;</span> <span class="nb">cd </span>swupdate-yocto

swupdate-yocto<span class="nv">$ </span><span class="nb">mkdir </span>layers <span class="o">&amp;&amp;</span> <span class="nb">cd </span>layers
swupdate-yocto/layers<span class="nv">$ </span>git clone git://git.yoctoproject.org/poky <span class="nt">-b</span> rocko
swupdate-yocto/layers<span class="nv">$ </span>git clone git://github.com/openembedded/meta-openembedded.git <span class="nt">-b</span> rocko
swupdate-yocto/layers<span class="nv">$ </span>git clone https://github.com/sbabic/meta-swupdate <span class="nt">-b</span> rocko
swupdate-yocto/layers<span class="nv">$ </span>git clone https://github.com/sbabic/meta-swupdate-boards.git <span class="nt">-b</span> master
swupdate-yocto/layers<span class="nv">$ </span>git clone https://github.com/agherzan/meta-raspberrypi.git <span class="nt">-b</span> rocko
swupdate-yocto/layers<span class="nv">$ </span><span class="nb">cd</span> ..
swupdate-yocto<span class="nv">$ </span><span class="nb">.</span> layers/poky/oe-init-build-env build
swupdate-yocto/build<span class="nv">$ </span>bitbake-layers add-layer ../layers/meta-openembedded/meta-oe
swupdate-yocto/build<span class="nv">$ </span>bitbake-layers add-layer ../layers/meta-openembedded/meta-multimedia
swupdate-yocto/build<span class="nv">$ </span>bitbake-layers add-layer ../layers/meta-openembedded/meta-python
swupdate-yocto/build<span class="nv">$ </span>bitbake-layers add-layer ../layers/meta-openembedded/meta-networking
swupdate-yocto/build<span class="nv">$ </span>bitbake-layers add-layer ../layers/meta-raspberrypi
swupdate-yocto/build<span class="nv">$ </span>bitbake-layers add-layer ../layers/meta-swupdate
swupdate-yocto/build<span class="nv">$ </span>bitbake-layers add-layer ../layers/meta-swupdate-boards

</code></pre></div></div>

<p>And now we can build an image:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>swupdate-yocto/build<span class="nv">$ MACHINE</span><span class="o">=</span>beaglebone bitbake update-image
</code></pre></div></div>

<p>or</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>swupdate-yocto/build<span class="nv">$ MACHINE</span><span class="o">=</span>raspberrypi3 bitbake update-image
</code></pre></div></div>

<p>I have used <code class="language-plaintext highlighter-rouge">beaglebone</code> as my target and that is what I will refer to from now
on.</p>

<p>Time for a coffee!</p>

<p>Hopefully the build finished successfully and there are two images that are of
interest to us:</p>

<ul>
  <li>
    <p><code class="language-plaintext highlighter-rouge">core-image-full-cmdline-beaglebone.wic</code> – Image to write to the eMMC on the
BBB, which will contain SWUpdate which is also started at boot-up. We have to
utilize the eMMC because the boot partition logic is setup to utilize this.</p>
  </li>
  <li>
    <p><code class="language-plaintext highlighter-rouge">update-image-beaglebone.swu</code> – This is the update image we will provide to
SWUpdate, and it contains the full root-filesystem</p>
  </li>
</ul>

<p>We transfer the <code class="language-plaintext highlighter-rouge">core-image-full-cmdline-beaglebone.wic</code> image to our BBB that
is running the debian image that we used earlier.</p>

<p>Write the image to the eMMC:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>debian@beaglebone:~<span class="nv">$ </span><span class="nb">sudo dd </span><span class="k">if</span><span class="o">=</span>core-image-full-cmdline-beaglebone.wic <span class="nv">of</span><span class="o">=</span>/dev/mmcblk1 <span class="nv">bs</span><span class="o">=</span>1M
</code></pre></div></div>

<p>Eject the uSD card, to make sure that it does not boot from there anymore and
restart the device (power-cycle).</p>

<p>Once we have booted from the eMMC we can see that SWUpdate is running on our
image already:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# ps ax | <span class="nb">grep </span>swupdate

 503 ? S 0:00 /usr/bin/swupdate-progress <span class="nt">-w</span> <span class="nt">-p</span> <span class="nt">-r</span>
 504 ? Sl 0:00 /usr/bin/swupdate <span class="nt">-v</span> <span class="nt">-H</span> beaglebone 1.0 <span class="nt">-e</span> stable,copy2 <span class="nt">-f</span> /etc/swupdate.cfg <span class="nt">-u</span> <span class="nt">-w</span>
 530 ? Sl 0:00 /usr/bin/swupdate <span class="nt">-v</span> <span class="nt">-H</span> beaglebone 1.0 <span class="nt">-e</span> stable,copy2 <span class="nt">-f</span> /etc/swupdate.cfg <span class="nt">-u</span> <span class="nt">-w</span>
 531 ? S 0:00 /usr/bin/swupdate <span class="nt">-v</span> <span class="nt">-H</span> beaglebone 1.0 <span class="nt">-e</span> stable,copy2 <span class="nt">-f</span> /etc/swupdate.cfg <span class="nt">-u</span> <span class="nt">-w</span>
</code></pre></div></div>

<p>One interesting take away from above is that there is an <code class="language-plaintext highlighter-rouge">-H</code> option to provide
board and hardware revision, which we earlier provided trough the
<code class="language-plaintext highlighter-rouge">/etc/hwrevision</code> file.</p>

<p>Also one interesting thing that might seem confusing is that if we look at how
our eMMC is partitioned:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# fdisk <span class="nt">-l</span> /dev/mmcblk1

Disk /dev/mmcblk1: 1.8 GiB, 1920991232 bytes, 3751936 sectors

Units: sectors of 1 <span class="k">*</span> 512 <span class="o">=</span> 512 bytes

Sector size <span class="o">(</span>logical/physical<span class="o">)</span>: 512 bytes / 512 bytes

I/O size <span class="o">(</span>minimum/optimal<span class="o">)</span>: 512 bytes / 512 bytes

Disklabel <span class="nb">type</span>: dos

Disk identifier: 0x9bf174dc

Device Boot Start End Sectors Size Id Type

/dev/mmcblk1p1 <span class="k">*</span> 8 42605 42598 20.8M c W95 FAT32 <span class="o">(</span>LBA<span class="o">)</span>

/dev/mmcblk1p2 42608 325475 282868 138.1M 83 Linux
</code></pre></div></div>

<p>We do not have a second partition for our root file-system, but I said that we
where going to deploy a “Dual Copy” strategy
(<a href="https://mkrak.org/2018/01/10/updating-embedded-linux-devices-part1/">if you need to refresh your
memory regarding update strategies</a>).
What will happen is that when we run our first update the update image will run
a script (which is embedded) that will do the eMMC setup. This could have been
taken care of during “build-time” using a custom WIC file but this will work as
well for our test.</p>

<p>Actually lets take a look at the <code class="language-plaintext highlighter-rouge">sw-description</code> file that is in
<a href="https://github.com/sbabic/meta-swupdate-boards">meta-swupdate-boards</a>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>software <span class="o">=</span>
<span class="o">{</span>
 version <span class="o">=</span> <span class="s2">"0.1.0"</span><span class="p">;</span>
 beaglebone <span class="o">=</span> <span class="o">{</span>
     hardware-compatibility: <span class="o">[</span> <span class="s2">"1.0"</span><span class="o">]</span><span class="p">;</span>
     stable : <span class="o">{</span>
             copy1 : <span class="o">{</span>
                 images: <span class="o">(</span>
                     <span class="o">{</span>
                         filename <span class="o">=</span> <span class="s2">"core-image-full-cmdline-beaglebone.ext4.gz"</span><span class="p">;</span>
                         device <span class="o">=</span> <span class="s2">"/dev/mmcblk1p2"</span><span class="p">;</span>
                         <span class="nb">type</span> <span class="o">=</span> <span class="s2">"raw"</span><span class="p">;</span>
                         installed-directly <span class="o">=</span> <span class="nb">true</span><span class="p">;</span>
                         compressed <span class="o">=</span> <span class="nb">true</span><span class="p">;</span>
                     <span class="o">}</span>
                 <span class="o">)</span><span class="p">;</span>
                 scripts: <span class="o">(</span>
                     <span class="o">{</span>
                         filename <span class="o">=</span> <span class="s2">"emmcsetup.lua"</span><span class="p">;</span>
                         <span class="nb">type</span> <span class="o">=</span> <span class="s2">"lua"</span><span class="p">;</span>
                     <span class="o">}</span>
                 <span class="o">)</span><span class="p">;</span>
                 uboot: <span class="o">(</span>
                     <span class="o">{</span>
                         name <span class="o">=</span> <span class="s2">"boot_targets"</span><span class="p">;</span>
                         value <span class="o">=</span> <span class="s2">"legacy_mmc1 mmc1 nand0 pxe dhcp"</span><span class="p">;</span>
                     <span class="o">}</span>,
                     <span class="o">{</span>
                         name <span class="o">=</span> <span class="s2">"bootcmd_legacy_mmc1"</span><span class="p">;</span>
                         value <span class="o">=</span> <span class="s2">"setenv mmcdev 1;setenv bootpart 1:2; run mmcboot"</span><span class="p">;</span>
                     <span class="o">}</span>
                 <span class="o">)</span><span class="p">;</span>
             <span class="o">}</span><span class="p">;</span>
             copy2 : <span class="o">{</span>
                 images: <span class="o">(</span>
                     <span class="o">{</span>
                         filename <span class="o">=</span> <span class="s2">"core-image-full-cmdline-beaglebone.ext4.gz"</span><span class="p">;</span>
                         device <span class="o">=</span> <span class="s2">"/dev/mmcblk1p3"</span><span class="p">;</span>
                         <span class="nb">type</span> <span class="o">=</span> <span class="s2">"raw"</span><span class="p">;</span>
                         installed-directly <span class="o">=</span> <span class="nb">true</span><span class="p">;</span>
                         compressed <span class="o">=</span> <span class="nb">true</span><span class="p">;</span>
                     <span class="o">}</span>
                 <span class="o">)</span><span class="p">;</span>
                scripts: <span class="o">(</span>
                     <span class="o">{</span>
                         filename <span class="o">=</span> <span class="s2">"emmcsetup.lua"</span><span class="p">;</span>
                         <span class="nb">type</span> <span class="o">=</span> <span class="s2">"lua"</span><span class="p">;</span>
                     <span class="o">}</span>
                 <span class="o">)</span><span class="p">;</span>
                 uboot: <span class="o">(</span>
                     <span class="o">{</span>
                         name <span class="o">=</span> <span class="s2">"boot_targets"</span><span class="p">;</span>
                         value <span class="o">=</span> <span class="s2">"legacy_mmc1 mmc1 nand0 pxe dhcp"</span><span class="p">;</span>
                     <span class="o">}</span>,
                     <span class="o">{</span>
                         name <span class="o">=</span> <span class="s2">"bootcmd_legacy_mmc1"</span><span class="p">;</span>
                         value <span class="o">=</span> <span class="s2">"setenv mmcdev 1;setenv bootpart 1:3; run mmcboot"</span><span class="p">;</span>
                     <span class="o">}</span>
                 <span class="o">)</span><span class="p">;</span>
            <span class="o">}</span><span class="p">;</span>
        <span class="o">}</span><span class="p">;</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<p>Here we can see that there is a <code class="language-plaintext highlighter-rouge">emmcsetup.lua</code> script that will take care of
the eMMC setup for us. We can also see an example of how a “Dual Copy” strategy
can be setup using SWUpdate. The boot part switching is done using the <code class="language-plaintext highlighter-rouge">uboot</code>
handlers that will make changes to U-boot environment variables when performing
an update.</p>

<p>It is now time to do an update, lets browse to the SWUpdate web-interface and
upload the <code class="language-plaintext highlighter-rouge">update-image-beaglebone.swu</code> file that we got from our Yocto build.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
Waiting <span class="k">for </span>requests...
<span class="o">[</span>network_initializer] : Main thread <span class="nb">sleep </span>again <span class="o">!</span>
SWUPDATE successful <span class="o">!</span>
<span class="o">[</span>update_bootloader_env] : Updating bootloader environment
<span class="o">[</span>start_lua_script] : Calling Lua /tmp/emmcsetup.lua
<span class="o">[</span>start_lua_script] : Script output: Post installed script called script end
<span class="o">[</span>install_single_image] : Found installer <span class="k">for </span>stream core-image-full-cmdline-beaglebone.ext4.gz raw
<span class="o">[</span>start_lua_script] : Script output: Checking that no-one is using this disk right now ... FAILED Disk /dev/mmcblk1: 1.8 GiB, 1920991232 bytes, 3751936 sectors Units: sectors of 1 <span class="k">*</span> 512 <span class="o">=</span> 512 bytes Sector size <span class="o">(</span>logical/physical<span class="o">)</span>: 512 bytes / 512 bytes I/O size <span class="o">(</span>minimum/optimal<span class="o">)</span>: 512 bytes / 512 bytes Disklabel <span class="nb">type</span>: dos Disk identifier: 0x07679a7d Old situation: Device Boot Start End Sectors Size Id Type /dev/mmcblk1p1 <span class="k">*</span> 8 42605 42598 20.8M c W95 FAT32 <span class="o">(</span>LBA<span class="o">)</span> /dev/mmcblk1p2 42608 327017 284410 138.9M 83 Linux <span class="o">&gt;&gt;&gt;</span> Script header accepted. <span class="o">&gt;&gt;&gt;</span> Script header accepted. <span class="o">&gt;&gt;&gt;</span> Script header accepted. <span class="o">&gt;&gt;&gt;</span> Script header accepted. <span class="o">&gt;&gt;&gt;</span> Created a new DOS disklabel with disk identifier 0x07679a7d. /dev/mmcblk1p1: Created a new partition 1 of <span class="nb">type</span> <span class="s1">'W95 FAT32 (LBA)'</span> and of size 20.8 MiB. /dev/mmcblk1p2: Created a new partition 2 of <span class="nb">type</span> <span class="s1">'Linux'</span> and of size 138.9 MiB. /dev/mmcblk1p3: Created a new partition 3 of <span class="nb">type</span> <span class="s1">'Linux'</span> and of size 138.9 MiB. /dev/mmcblk1p4: Done. New situation: Disklabel <span class="nb">type</span>: dos Disk identifier: 0x07679a7d Device Boot Start End Sectors Size Id Type /dev/mmcblk1p1 <span class="k">*</span> 8 42605 42598 20.8M c W95 FAT32 <span class="o">(</span>LBA<span class="o">)</span> /dev/mmcblk1p2 42608 327017 284410 138.9M 83 Linux /dev/mmcblk1p3 327018 611427 284410 138.9M 83 Linux The partition table has been altered. Calling ioctl<span class="o">()</span> to re-read partition table. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe<span class="o">(</span>8<span class="o">)</span> or kpartx<span class="o">(</span>8<span class="o">)</span><span class="nb">.</span> Syncing disks. script end
<span class="o">[</span>start_lua_script] : Calling Lua /tmp/emmcsetup.lua
Installation <span class="k">in </span>progress
<span class="o">[</span>network_initializer] : Valid image found: copying to FLASH
<span class="o">[</span>extract_files] : Found file: filename core-image-full-cmdline-beaglebone.ext4.gz size 31829134 required
<span class="o">[</span>extract_files] : Found file: filename emmcsetup.lua size 1691 required
<span class="o">[</span>check_hw_compatibility] : Hardware compatibility verified
<span class="o">[</span>check_hw_compatibility] : Hardware beaglebone Revision: 1.0
<span class="o">[</span>parse_bootloader] : Bootloader var: boot_targets <span class="o">=</span> legacy_mmc1 mmc1 nand0 pxe dhcp
<span class="o">[</span>parse_bootloader] : Bootloader var: bootcmd_legacy_mmc1 <span class="o">=</span> setenv mmcdev 1<span class="p">;</span>setenv bootpart 1:3<span class="p">;</span> run mmcboot
<span class="o">[</span>parse_scripts] : Found Script: emmcsetup.lua
<span class="o">[</span>parse_images] : Found compressed Image : core-image-full-cmdline-beaglebone.ext4.gz <span class="k">in </span>device : /dev/mmcblk1p3 <span class="k">for </span>handler raw
<span class="o">[</span>parse_hw_compatibility] : Accepted Hw Revision : 1.0
<span class="o">[</span>extract_file_to_tmp] : Found file: filename sw-description size 1138

Software Update started <span class="o">!</span>

File information: update-image-beaglebone.swu size: 31832576 bytes
</code></pre></div></div>

<p>Success! We need to reboot the device for the update to have any effect. There
is a button conveniently placed in the web-interface to trigger a reboot.</p>

<p>We can see now that the devices has changed root file-system part to
<code class="language-plaintext highlighter-rouge">/dev/mmcblk1p3</code> which was created during our update as can be seen in above
log.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@beaglebone:~# mount
/dev/mmcblk1p3 on / <span class="nb">type </span>ext4 <span class="o">(</span>rw,relatime,data<span class="se">\=</span>ordered<span class="o">)</span>
&lt; ... <span class="o">&gt;</span>

</code></pre></div></div>

<p>NOTE! SWUpdate is built without “signed image” support by default in Yocto,
there are means to enable it but I will not cover it at this time.</p>

<h2 id="conclusion">Conclusion</h2>

<p>SWUpdate is a mature and feature rich update framework which is fairly easy to
setup. I have only covered a fragment of what SWUpdate can do but hopefully it
can be helpful to someone.</p>

<p>There is of course a learning curve to using SWUpdate, that is because there
are so many configuration options you need to read-up on what you want to use
and configure appropriately. But this is also the goal of the project, to be a
framework and not an out-of-the box solution.</p>

<p>Also even though there is a fairly good starting point when using Yocto and the
SWUpdate layers to deploy a “Dual Copy” strategy (on a BBB and RPi3 at least),
this is only for testing purposes and is not in anyway production ready and
addition work is needed to make it robust. We are lacking roll-back support is
one example of features that need to be implemented for better robustness when
using a “Dual Copy” strategy.</p>

<p>One thing that is lacking in the project is testing. From what I can see there
are no unit tests nor integration test. To able to maintain such a project
which aims to be flexible you need automation to test the very rich feature
list. I checked the <a href="https://sbabic.github.io/swupdate/roadmap.html">road-map</a>
of the project and sadly it is not even listed there, instead the focus is
feature on growth.</p>

<p>I am not criticizing as SWUpdate is mainly a community based project meaning
that people develop this on their free time and it is understandable that some
infrastructure is missing. If you have a lot of free time go over to SWUpdate
and start hacking!</p>]]></content><author><name>Mirza Krak</name></author><summary type="html"><![CDATA[This post if part of the “Updating embedded Linux devices” series, previous posts are:]]></summary></entry></feed>