HomeACcessoryKid / LCMdev

Development space for the next generation of Life-Cycle-Manager - NOT STABLE
Apache License 2.0
1 stars 0 forks source link

Quick version check at every boot #3

Open HomeACcessoryKid opened 4 years ago

HomeACcessoryKid commented 4 years ago

@AchimPieters asked: I would like to see a quick version check at every boot. Only when there is a new version do a update. otherwise just start. that would be awesome!

HomeACcessoryKid commented 4 years ago

Hmmm, interesting idea but with a big impact. Note that the boot loader is VERY small. It does not have anything worth mentioning and all functions are coming from the chips ROM. So, what you ask would imply running ota-main every boot. That is not really quick, but maybe ok for you. It would, in this use case, be better to swap the function of the ota-main and the user code, where user code would be temp-rom.

Next level of the impact is HOW to make one code base become several distinct things?

The main issue here is that there is no actual user interface for the boot loader. How would we influence the behaviour to be different for something that never had a configuration moment? We could use a small part of the rboot config sector 0x1000 but HOW would we get our choice in there? It would have to be via the user code.

So, let's assume that we had found a way for that, then we would need to add code to the bootloader to read this config message and do something with it. The binary size is now 3028 and the max is 4080 (I use the last 16 bytes for the version watermark)

All of this could be doable but requires a design of what options would have to exist, how to make them all fit in the code and how to encode the options.

If you feel like this is worth it (consider the speed!), then we can continue this dialogue and get details on the desirable options

AchimPieters commented 4 years ago

Running ota-main every boot, isn't ideal. Maybe it's to complicated. Speed is key in this case. My intent is to make it "end-user friendlier", what I mean by that, is that there has to be a easier way for the "end-user" to update / or select the option to update, once the device is running.

HomeACcessoryKid commented 4 years ago

OK, with those criteria, we must declare it infeasible for the boot loader.
You can however consider that GitHub offers the "watch" feature and this would allow people to be aware of the creation of a new version. Then doing a triple power cycle does the trick for an update.
Bonus, they get to read the release notes and might decide it is not worth it...

AchimPieters commented 4 years ago

The "watch" feature isn't ideal for end users. the triple power cycle is a really nice feature, but not what I'm looking for, and in some cases not applicable. If you use simple lamp it's a real addition!

Ideal situation: is a opt-in or opt-out for updates, when update is available it installs or a eg. software button to check for update. know that LCM v1.0.0 has the ability to update trough the Eve app. But how to integrate into HomeKit?

Let's say I make a device for my father, he doest know how these thing work but he wants to be able to update without the help from me or someone else, how to realize that?

HomeACcessoryKid commented 4 years ago

OK, first thing is that running ota-main every boot was not the right approach for being too slow. This means that the solution HAS to come from the user-app since bootloader is by its nature incapable.

The interface with LCM is very easy and offers a huge amounts of options. Some examples:

Just take care that you do not create a user-app binary that when installed on 1000 devices wil make all of them engage in an update check at the same time. That could end us up in a blacklist on GitHub ;-(

Bottom line: LCM has its 'api ' and that is what you can work with.

Remember that LCM does not run when user code is running so there is no option do do anything inside of it. The bootloader has some possibilities but very limited, and we want to keep it universal as well (see issue 4 to contribute there)

maccoylton commented 4 years ago

@AchimPieters is the requirement for no end user intervention at all, or for a very simple trigger. For some devices I can see issues if no trigger, e.g. light going off in the dark to do an auto update. So for auto update it normally has to have an on/off setting and an ability to set a time. Manual trigger is much less problematic and can be supported by trigger on x power cycles