nerves icon indicating copy to clipboard operation
nerves copied to clipboard

firmware.patch handles FAT resources

Open jeanparpaillon opened this issue 1 year ago • 4 comments

jeanparpaillon avatar Mar 20 '23 10:03 jeanparpaillon

fwup part implemented in https://github.com/fwup-home/fwup/pull/202

jeanparpaillon avatar Mar 20 '23 10:03 jeanparpaillon

@fhunleth I definitly agree on moving the code to a single place. However, can we split it into:

  • patch creation: elixir code, used by nerves_hub_www, nerves (mix firmware.patch task)
  • patch application: C code, used by fwup

If you agree with this split, I can start an elixir application (nerves_delta ?), that could be used as a dep by nerves and nerves_hub _www for consistency.

I don't really understand why order matters in data as well but I can update the code to tackle with that also.

jeanparpaillon avatar Apr 06 '23 08:04 jeanparpaillon

@fhunleth I think part of the complexity lies in matching patch creation with capabilities of fwup. Should we couple this discussion with https://github.com/nerves-hub/nerves_hub_web/issues/556 and imagine the following architecture for OTA:

  • NH pushes meta.conf to device
  • for each resource, device request full data or delta based on its capability, with content-type like negotiation, for instance:
    • GET ...zImage (accept: application/raw)
    • GET ...rootfs (accept: application/raw+xdelta3)

Instead of having NervesHub behaviour depending on device's fwup version, we would just require the device to handle a protocol.

jeanparpaillon avatar Apr 06 '23 09:04 jeanparpaillon

NervesHub already knows the version of fwup running on the device so it can create and send down the proper update. There's no need to create a program or library on the device that does this for NervesHub. A side benefit of this is that firmware updates that don't use the fwup "unsafe" commands can be tested offline (on NervesHub, for example) to verify that they work without needing to send a byte down to a device. I don't know whether we'll get to implementing that right away, but I really like the idea of being able to debug firmware updates without worrying about runtime behavior other than transferring the one firmware update file down (and that's unavoidable).

I added this NervesHub issue to track making different deltas based on the device's fwup version.

I had a brief conversation with @oestrich and @jjcarstens on this. It sounds like there might or might not be concerns on the NervesHub side. I'll try to keep things posted to keep you on the same page.

fhunleth avatar Apr 10 '23 19:04 fhunleth