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
Had a great time at Jax.Ex! Gave a talk called “Model your Domain, Derive the Rest”. Thanks to the folks at HashRocket for having me!
New
barnabasJ
You can now add subscriptions using the DSL. subscriptions do pubsub YourAppWeb.Endpoint subscribe :something_changed do action...
New
mat-hek
Hi everyone, I’d like to share with you a new library from the Membrane team - Boombox. It’s a simple streaming tool built on top of Mem...
New
zachdaniel
Join us for our first Ash Office Hours next Thursday at 6PM EST! Myself and anyone from the core team who can make it will be answering q...
New
bartblast
Hi friends, I wanted to share an update on Hologram that’s been on my mind lately. After nearly 3 years of full-time work on Hologram, ...
New
fhunleth
We’re excited to announce that we’re actively working on NervesHub 2.0, an improved version of our IoT device firmware update and managem...
New
zachdaniel
Ash and AshPostgres generators/installers, built with igniter are available on main! I’ll be very grateful to anyone willing to give the...
New
jjcarstens
Testing code destined for hardware can be tricky, but it just got one tiny bit easier! :tty0tty was just released which is an Elixir por...
New
zachdaniel
Working with nested forms in Ash was already great, but it’s even better now with a the new features that will be in the next release of ...
New
polvalente
Nx, EXLA and Torchx 0.12 have just been published! This update set comes with the new Nx.block abstraction and the EXLA.CustomCall proto...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29703 241
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43806 214
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement