lawik

lawik

Nerves Core Team

NervesHub - Delta updates

Nerves, fwup and NervesHub have had delta updates as a feature on the checklist for a long time. A delta update being essentially a patch you send to update the binary data on a device instead of sending all the desired data. It can be way more efficient in terms of bandwidth. We use xdelta3 for the binary diffing.

The delta support has been kind of gnarly though. In several important ways they were best-effort and whether they worked or not was dependent on what fwup features you used and how you used them. If you used disk encryption it was a no-go.

Thanks to work at SmartRent we now get fully functional delta updates that understand way more about what the heck you are doing with your firmware. And you don’t really need to think about it very much. Just turn on Delta updates for your deployment and if you have a compatible setup you should get the advantages. This is all on main in nerves_hub and you get it if you run the latest tag for the container or similar.

There are still updates we can do to Nerves systems to make delta updates apply to a larger part of the system. Currently they tend to apply to the rootfs.

A bunch of things needed to be lined up to make this happen:

  • NervesHub needed to get smarter about generating the delta packages to understand whether an update was possible. Is the version of fwup high enough? Does this archive have support for deltas at all? Does it use disk encryption and does the delta update respect that?
  • fwup needed to provide a combination of the disk encryption feature and the delta update feature. Awesome job by @fhunleth :sparkles:

fwup uses the libconfuse format for config files so as part of this I made a kind of rough library for dealing with those files, I call it confuse. A bunch of nimble_parsec and then some really helpful functionality to interpret the structure based on fwup usage and conventions. Most of the smarts around deltas for NervesHub live in confuse.

fwup itself does not know how to create a delta firmware archive, maybe it should but currently it does not. So NervesHub becomes the reference implementation so even if you want to use another delivery mechanism you can yoink the functionality out of it.

NervesHub will create deltas for the files that have the relevant delta options applied and other files will be provided in full.

For an extreme case where we just bumped the version number we actually saw a delta update down in the kilobytes for a firmware that was 90Mb. In reality it will vary significantly. One usually mild trade-off is that applying the firmware will likely take longer due to compression and the procedure of reading and patching the existing data to write to the new partition.

You can try this on NervesCloud already as we run very recent versions. Feel free to weigh in with questions in this thread or elsewhere.

Where Next?

Popular in News & Updates Top

zachdaniel
Hey folks! I’ve released the first version of our new AI policy. Accepting it is now part of our issue and pull request templates. Feel ...
New
zachdaniel
Hey friends! A long time quality of life feature we’ve been wanting to add is the ability to refer to to-one relationships in calculation...
New
zachdaniel
Ash Framework What is Ash? Ash Framework is a declarative, resource-oriented application development framework for Elixir. A resource can...
New
fhunleth
We recently released Nerves 1.6 and corresponding updates to the Nerves new project generator, nerves_bootstrap and our official systems....
New
sorenone
We have for you a new release candidate. Take :notes: if you use partitioned queues or make heavy use of Workflows. This is the RC for yo...
New
zachdaniel
Hey folks, we have a minor CVE issued for AshAuthentication. Please read the CVE and update accordingly. Relatively low severity, can’t c...
New
fhunleth
We’ve released Nerves v1.3.0 with support for Elixir 1.7 and Distillery 2.0! We encountered a few bumps over the past week, but it’s look...
New
fhunleth
We recently released Nerves 1.4.0 and an update to the Nerves new project generator, nerves_bootstrap. The biggest change is support for ...
New
zachdaniel
Hey folks! We’re giving a training at the upcoming ElixirConf EU! If you want a leg up on 3.0, this is definitely something you don’t wan...
New
fhunleth
We’ve released new versions of all of the officially maintained Nerves Systems. The official systems, nerves_system_rpi0, nerves_system_b...
New

Other popular topics Top

fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New

We're in Beta

About us Mission Statement