Hi Stefano, thanks for the quick response!
Some comments below.
On Thu, May 20, 2021 at 4:37 PM Stefano Babic <
stefan...@denx.de> wrote:
>
> Hi Rob,
>
> On 20.05.21 18:51, Rob Lee wrote:
> > Hi, the company I work for is evaluating the possible use of SWUpdate
> > for system OTA updates for a particular project. There are a few
> > missing features though that we need to develop. Some of these are
> > already listed on the SWUpdate roadmap, so I wanted to first check the
> > status of any planning or development that may have already been
> > performed towards these features:
> >
> > Selective Downloading - In the case of a power event or other critical
> > failure, we require the ability to continue an update where it last left
> > off.
>
> This is not "selective downloading" and the feature you require is
> already implemented. SWUpdate can store the incoming SWU and can resume
> after a poweroff, and this feature is already mainlined.
>
> See :
> --cache <file> Use cache file as starting SWU
>
> The feature is implemented saving the incoming SWU and using it as cache
> file if a power cut occurs. SWUpdate will consume the cached file and
> download just the rest.
>
Our requirement is to *not* cache the entire SWU (we have large update
images, and
limited storage space) but instead
use the installed-directly flag to write directly to storage as the data becomes
available. And if this is interrupted by a power event, then later
the installation
should continue from where it left off. Our devices operate in regions
with metered or poor data connections so avoiding the download of
unnecessary data is important for our customers. This could work using
a progress "bookmark"
be stored for each chunk of data stored so the system could know where
to continue
from and allow the downloader to pull data from the proper bookmarked
location in
the power event and resume case. In our case, we'll be using own downloader and
we use block-based image updates to partitions (not filesystem
individual files).
Another possible implementation would be to use a list or map of hashes possibly
of the installation data stored in the sw-configuration file itself to
allow the installer to
read from storage and calculate and compare hashes to determine how far
the previous installation made it and where to continue the installation from.
While I haven't yet surveyed the different implementation
possibilities, I was thinking
that the client callback hooks could be extended to add a new callback
to be called by the
handler after it parses the sw-configuration and then detects a valid
continue operation
(same version is being installed, bookmark or progress hash check
validated, etc.).
In the callback it can give the download offset to skip to and continue from.
All that said, if your "cached" implementation could be made to only cache the
last megabyte or two of downloaded that, that would be an option for
us. But my current
understanding is that it will cache the entire image (please correct
me if I misunderstood)
and the would not work for us.
Thanks for providing that link to the previous discussion. I just
read it and it seems like
there are some functional similarities to what I'm asking about even
if the purpose is
different. As mentioned in that thread, the installer could control
the download parameters
(size and offset).
One user's comment from the thread:
" Maybe we could
extent the passive stream mode by an active mode. In the active mode the
installer controls the image provider. The installer instructs the image
provider to send x bytes or to skip x bytes. Its up to the image
provider if it discards data or requests only needed data. The
downloader could request the needed data from the server and the web
server could simple drop unneeded data."
> The status for that is that I have a customer requiring it, and I am
> waiting for his order to start the implementation.
>
> >
> > Other feature support we might consider adding is "Support for further
> > compressors (in particular xz) for the individual images.
>
> This can be done, it has a very lower priority after the "zst"
> compressor was added. XZ (lzma) can compress better, it requires a
> higher CPU load - ZST seems at the moment the best compromise.
>
Ok, yes, I'm very familiar with Zstd as is it used elsewhere in our system
when real-time compression takes place. But given our OTA update
packages are performed by build servers without strict performance
requirements, xz is preferred by us for the OTA update packages. The
decode may also be slower and more CPU intensive but we perform the
"double copy with fall-back" type of installation in the background at a
low priority while the device functionality is
still available to the user, so performance is still less of a concern relative
to user data connection usage.
> > And this
> > would need to support the "streaming" feature (aka, write data to
> > partition progressively).
>
> This is a must, both gzip and zst compressor are done in this way.
> Adding XZ is IMHO not a big deal as there is a library, but as I said,
> this has not a high priority in the project. A new compressor means to
> rework the pipeline (see copyfile function and similar), and this means
> higher efforts for regression tests.
>
> I have no customers requiring this, that means I do not plan to work on it.
>
Understood. Our goal would be to implement it ourselves but to do so in
a SWUpdate project-friendly way so that the implementation could be
upstreamed at some point. That said, we may also just end up
compressing the SWU CPIO archive itself and just have the
> > We may also be interested in adding support
> > for other SWU archive formats other than CPIO such as zip archive,
> > tar.gz, etc.
>
> SWUpdate does not really use CPIO, but just a simplified version as
> container. Files are flat, and so on. There is no reason to change this
> and I will probably reject such as changes.
>
Understood.