Add tools/install_release.py, a host script that takes a release from Gitea and puts it on a board over USB the way an update would: it downloads the release's application image and checks it against the release checksums, writes it to the slot that is not running, and rewrites otadata to select that slot as a new image before resetting the board. It reads the board's own partition table and slot selection rather than assuming a layout, refuses a board without the A/B partition table, and writes nothing until the image has been downloaded and verified. A dry run shows what it would do. This lets the A/B slots be tested with real releases while there is no over-the-air update source. The README documents it, and the full image's install steps now clear the slot selection, so that a board which had switched to the second slot runs the image just written. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
ae5ed848ad
commit
c6b1537c8c
2 files changed
+303
-2
No files matched your search
@@ -159,12 +159,38 @@ Each release has:
|
||||
|
||||
- `smart-light-<version>-full.bin`: bootloader, partition table and
|
||||
application. Write it at address 0 with
|
||||
`espflash write-bin 0x0 smart-light-<version>-full.bin`. It stops short of
|
||||
the `storage` partition, so the light keeps its Zigbee network.
|
||||
`espflash write-bin 0x0 smart-light-<version>-full.bin`, then clear the slot
|
||||
selection with `espflash erase-parts otadata` so that the board runs it.
|
||||
The image stops short of the `storage` partition, so the light keeps its
|
||||
Zigbee network.
|
||||
- `smart-light-<version>.bin`: the application alone, for a firmware slot.
|
||||
- `smart-light-<version>.elf.gz`: the unstripped build, for decoding backtraces.
|
||||
- `SHA256SUMS`.
|
||||
|
||||
### Installing a release over USB
|
||||
|
||||
Once a board has the A/B partition table, `tools/install_release.py` installs a
|
||||
release into the slot that is not running and switches to it, without
|
||||
touching the running image until the new one has been downloaded and checked:
|
||||
|
||||
```sh
|
||||
tools/install_release.py # the latest release
|
||||
tools/install_release.py 0.1.23 # a particular one
|
||||
tools/install_release.py --dry-run # show what would be done, write nothing
|
||||
```
|
||||
|
||||
It reads the board's partition table and slot selection, downloads the release's
|
||||
application image and checks it against `SHA256SUMS`, writes it to the idle
|
||||
slot, rewrites `otadata` to select that slot as a new image, and resets the
|
||||
board. The firmware logs the version it is running, which slot it came from,
|
||||
and when it confirms the image, so the log shows the update has worked. Run it
|
||||
again and the board alternates to the other slot.
|
||||
|
||||
This is a way of testing the A/B slots with real releases, not an update
|
||||
mechanism for lights in use: it needs the board on a USB cable. There is no
|
||||
rollback yet (see `TODO.md`), so an image that does not start has to be fixed
|
||||
by flashing over USB.
|
||||
|
||||
The workflow's `runs-on` must match a label of your Gitea runner. If the job's
|
||||
own token is not allowed to create releases, add a token with write access to
|
||||
the repository as a secret named `RELEASE_TOKEN`.
|
||||
|
||||
Reference in new issue
Block a user