apache / mynewt-mcumgr

Apache mynewt
https://mynewt.apache.org/
99 stars 76 forks source link

Incremental update support #23

Open sjanc opened 5 years ago

sjanc commented 5 years ago

This should allow to reduce size of uploaded new image to delta image. Tool for generating delta images should be also provided.

utzig commented 5 years ago

delta against what?

sjanc commented 5 years ago

against running firmware

utzig commented 5 years ago

sorry to ask, not sure you have implementation already or this is just an idea, but is it supposed to do delta sector by sector or the whole firmware? does the linker already stack symbols in a fixed order?

sjanc commented 5 years ago

I plan to use modified ('stream' friendly) version of bsdiff algorithm [1], which is kinda optimized for elfs. That way while delta is being uploaded (I've already have working stream version of bspatch library), new image in slot1 is reconstructed from delta and image in slot 0.

[1] https://github.com/mendsley/bsdiff

utzig commented 5 years ago

Nice, I was thinking about how hard would it be to store slot1 in bsdiff form and still enable MCUBoot to updated it; If it is a sector by sector binary diff it might be feasible to swap with a normal image!

sjanc commented 5 years ago

sector by sector binary diff is not useful since adding even 1 byte to binary will result in rest of the image to have all sectors changed (shifted), and this is where bsdiff shines

sterlinghughes commented 5 years ago

It would be good to refactor mcumgr to allow for streaming firmware updates over BLE as well in this patch. I don't think we'd do patched upgrades for awhile, but it will speed up downloads for everyone if we can avoid having to ACK every chunk. Also, plan to update Android/iOS libraries?

sjanc commented 5 years ago

yeap, I plan to work on streaming too (probably as a separate issue/PR)

As for Android support, maybe, for iOS probably not :)