Skip to content

Commit 1d87872

Browse files
updating from release 2.1.2 to 2.2.5
- note this means a longer update cycle - note that using EC makes it slower, but also safer - added features ota_string and ota_count in sysparam
1 parent aeba7d8 commit 1d87872

File tree

3 files changed

+28
-29
lines changed

3 files changed

+28
-29
lines changed

README.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,19 @@
22
Initial install, WiFi settings and over the air firmware upgrades for any esp-open-rtos repository on GitHub
33
(c) 2018-2022 HomeAccessoryKid
44

5-
## NO ISSUE with GitHub introduction of Elliptic Curve based certificates
6-
#### starting 1 April 2022
7-
IT DOES NOT BREAK, a misunderstanding from my side
8-
When updating the root certificate, I forgot to add an old root CA to the file
9-
Fixed 3 April 18:50 CEST
10-
11-
But check back later because next I want to make a version that will
12-
make the update of LCM or bootloader itself not depend on certificate validation but only on signature.
13-
The verification of the GitHub certificate remains a necessity to validate the user main.bin file.
5+
## Update season 16 April 2022
6+
After 14 months, version 2.1.2 will get upgraded to version 2.2.5. So be aware your own app update will take extra long.
7+
It would be recommendable to also update devices that do not have an user app update.
8+
Not that 2.1.2 is broken or in danger, but 2.2.5 is more future proof.
149

1510
## Version
1611
[Changelog](https://github.com/HomeACcessoryKid/life-cycle-manager/blob/master/Changelog.md)
1712
With version 2.0.0 LCM has arrived to a new stage with its own adaptation of rboot - rboot4lcm - which counts powercycles.
18-
These are used to check updates, reset wifi clear or set LCM_beta or factory reset. It also gives access to the emergency mode.
13+
These are used to check updates, reset wifi, clear or set LCM_beta or factory reset. It also gives access to the emergency mode.
1914
Setting a value for a led_pin visual feedback is possible.
2015
By having introduced the latest-pre-release concept in version 1.0.0, users (and LCM itself) can test new software before exposing it to production devices.
2116
See the 'How to use it' section.
2217

23-
In version 2.2.x there is a new possibility for those user apps that need some configuration data to work that is specific to each instantiation.
24-
One can set the ota_string parameter which can be parsed by the user app to set e.g. MQTT server, user and password or whatever else you fancy.
25-
Since it is to the user app to parse it, you test whatever works for you within the cgi transfer of parameters.
26-
Using the 'erase wifi' mode, new settings can also be set again when needed.
27-
2818
https://github.com/HomeACcessoryKid/ota-demo has been upgraded to offer system-parameter editing features which allows for flexible testing of the LCM code.
2919

3020
## Scope
@@ -34,7 +24,7 @@ This is a program that allows any simple repository based on esp-open-rtos on es
3424
- assign app specific and device specific parameters
3525
- update the user app over the air by using releases and versions on GitHub
3626

37-
## New feature version 2
27+
## New features version 2
3828

3929
This new LCM code is able to load/update the bootloader from github.
4030
The new bootloader is able to count the amount of short power cycles (<1.5s)
@@ -74,6 +64,15 @@ If `ota_count_step=="1"`
7464

7565
Missing or other `ota_count_step` values will be interpreted as 3
7666

67+
In version 2.2.5 there are two new features:
68+
There is a new possibility for those user apps that need some configuration data to work that is specific to each instantiation.
69+
One can set the `ota_string` parameter which can be parsed by the user app to set e.g. MQTT server, user and password or whatever else you fancy.
70+
Since it is up to the user app to parse it, you test whatever works for you within the cgi transfer of parameters.
71+
Also, using the 'erase wifi' mode, new settings can be set again when needed.
72+
73+
There also exists the possibility to set the sysparam `ota_count` to activate the 'erase wifi' etc from the user app as well.
74+
75+
7776
## Non-typical solution
7877
The solution is dedicated to a particular set of repositories and devices, which I consider is worth solving.
7978
- Many ESP8266 devices have only 1Mbyte of flash
@@ -133,13 +132,13 @@ User device setup part
133132
- wipe out the entire flash (not essential, but cleaner)
134133
- upload these three files:
135134
```
136-
0x0 /Volumes/ESPopenHK/esp-open-rtos//bootloader/firmware_prebuilt/rboot.bin
137-
0x1000 /Volumes/ESPopenHK/esp-open-rtos//bootloader/firmware_prebuilt/blank_config.bin
138-
0x2000 versions/x.y.zv/otaboot.bin
135+
0x0 <path_to>/esp-open-rtos/bootloader/firmware_prebuilt/rboot.bin
136+
0x1000 <path_to>/esp-open-rtos/bootloader/firmware_prebuilt/blank_config.bin
137+
0x2000 <release>/otaboot.bin
139138
```
140139
- (or otabootbeta.bin if enrolling in the LCM pre-release testing)
141140
- start the code and either use serial input menu or wait till the Wifi AP starts.
142-
- set the repository you want to use in your device. yourname/repository and name of binary
141+
- set the repository you want to use in your device: `yourname/repository` and name of binary
143142
- then select your Wifi AP and insert your password
144143
- once selected, it will take up to 5 minutes for the system to download the ota-main software in the second bootsector and the user code in the 1st boot sector
145144
- you can follow progress on the serial port or use the UDPlogger using the terminal command `nc -kulnw0 45678`
@@ -155,7 +154,7 @@ printf "%08x" `cat firmware/main.bin | wc -c`| xxd -r -p >>firmware/main.bin.sig
155154
This design serves to read through the code base.
156155
The actual entry point of the process is the self-updater which is called ota-boot and which is flashed by serial cable.
157156

158-
![](https://github.com/HomeACcessoryKid/life-cycle-manager/blob/master/design-v4.png)
157+
![](https://github.com/HomeACcessoryKid/life-cycle-manager/blob/master/design-v5.png)
159158

160159
### Concepts
161160
```
@@ -201,12 +200,6 @@ From the sector containing up to date certificates the sha384 hash has been sign
201200
Using the available public key, the validity is verified.
202201
From here, the files are intended to be downloaded with server certificate verification activated. If this fails, the server is marked as invalid.
203202

204-
```
205-
server valid?
206-
```
207-
If in the previous steps the server is marked invalid, we return to the main app in boot slot 0 and we report by syslog to a server (to be determinded) so we learn that github has changed its certificate CA provider and HomeACessoryKid can issue a new certificate sector.
208-
Now that the downloading from GitHub has been secured, we can trust whatever we download based on a checksum.
209-
210203
```
211204
new boot version?
212205
```
@@ -216,14 +209,20 @@ This will download the latest version of [rboot4lcm](https://github.com/HomeACce
216209
new OTA version?
217210
download OTA-boot➔0
218211
update OTA-main➔1
219-
checksum OK?
212+
sig & checksum OK?
220213
```
221214

222215
We verify if there is an update of this OTA repo itself? If so, we use ota-boot to self update. After this we have the latest OTA code.
223216

217+
```
218+
server valid?
219+
```
220+
If by checking the certificates the server is marked invalid, we return to the main app in boot slot 0 and we report by syslog to a server (to be determinded) so we learn that github has changed its certificate CA provider and HomeACessoryKid can issue a new certificate sector.
221+
Now that the downloading from GitHub has been secured, we can trust whatever we download based on a checksum.
222+
224223
```
225224
OTA-main(1) updates User app➔0
226-
checksum OK?
225+
sig & checksum OK?
227226
```
228227
Using the baseURL info and the version as stored in sysparam area, the latest binary is found and downloaded if needed. If the checksum does not work out, we return to the OTA app start point considering we cannot run the old code anymore.
229228
But normally we boot the new code and the mission is done.

design-v4.png

-260 KB
Binary file not shown.

design-v5.png

241 KB
Loading

0 commit comments

Comments
 (0)