Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FS update in two steps #6505

Merged
merged 6 commits into from
Oct 16, 2019
Merged

Support FS update in two steps #6505

merged 6 commits into from
Oct 16, 2019

Conversation

Androbin
Copy link
Contributor

Problem: I am updating my sketch and FS over HTTPS and keep the certificates in FS like in the httpUpdateSecure.ino example. If updating the FS fails (e.g. power failure during download) and the certificates get damaged, my customers might not be able to update and recover anymore.

Solution: Support the same two step process that is used to update the sketch.

A step towards #905. Hopefully the option to move from RTC to flash will be merged soon also.

@d-a-v
Copy link
Collaborator

d-a-v commented Sep 19, 2019

where or when is UPDATE_IN_TWO_STEPS supposed to be defined ?
Is this PR dependent of #6533 ?

@Androbin
Copy link
Contributor Author

@d-a-v It's an independent effort. I'm using #ifdef, so not defining it is the point.
As long as this flag is not defined (by the user), it will default to the current behavior.

@d-a-v d-a-v self-requested a review October 11, 2019 16:30
@d-a-v
Copy link
Collaborator

d-a-v commented Oct 11, 2019

Can you elaborate on how this is supposed to be used when UPDATE_IN_TWO_STEPS is defined ?

@earlephilhower
Copy link
Collaborator

The FS is presently updated right in Updater.cpp during the upload, and can end up in an inconsistent state should there be a dropout or other problem during update.

It's not like the app where the new copy is only uploaded if the entire upload and MD5 match. What this looks to do is treat the FS the same way as the program, and upload to spare area and only ask the bootloader to overwrite it iff the upload is a success.

Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me. Need to leave it as optional since in most cases you don't have enough unused space to do this 2-step process.

@d-a-v
Copy link
Collaborator

d-a-v commented Oct 12, 2019

I understand UPDATE_IN_TWO_STEPS is only used for FS, so can this macro be renamed to make this code more easily readable ?

@earlephilhower
Copy link
Collaborator

@Androbin can you see to @d-a-v's request? Maybe ATOMIC_FS_UPDATEor UPDATE_FS_IN_TWO_STEPS?

Also, now that I think about it, a short note somewhere in the docs/ota_updates about this define (since it seems unintuitive to some people) would be appropriate.

@Androbin
Copy link
Contributor Author

I renamed the flag and left a note in the docs as suggested.

@d-a-v d-a-v merged commit 45d71ae into esp8266:master Oct 16, 2019
@Androbin Androbin deleted the twostepupdate branch October 16, 2019 22:31
Lauszus added a commit to Lauszus/PlantFriends that referenced this pull request Nov 29, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants