# mabbott2011/skl-ota architecture

> Architecture diagram of the GitHub repository mabbott2011/skl-ota, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mabbott2011/skl-ota
- Repository: https://github.com/mabbott2011/skl-ota

## Overview

SKL-OTA is an ESP32 Arduino library for signed, rollback-safe firmware updates, plus a host-side release tool. The main device workflow checks a manifest, verifies the signed release, waits for an install request, streams and validates an image into the alternate OTA slot, then relies on a self-test to confirm the new build or trigger rollback. The graph also preserves release signing and compressed-image support. Source excerpts are partial; README statements support documented behavior where implementation details were not shown.

Main entry points: [`src/SKLOta.cpp`](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp) (Image download), [`src/SKLOta.h`](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.h) (OTA API), [`tools/ota_release.py`](https://github.com/mabbott2011/skl-ota/blob/main/tools/ota_release.py) (Keygen and signing), [`src/SKLOtaInflate.h`](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOtaInflate.h) (Zlib inflater)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_release["Release preparation"]
  node_release_tool["Keygen and signing<br/>[ota_release.py]"]
  node_release_host[("Web host")]
end

subgraph group_device["Device update"]
  node_firmware_app["Running firmware"]
  node_ota_api["OTA API<br/>[SKLOta.h]"]
  node_ota_scheduler["Check scheduler<br/>[SKLOta.cpp]"]
  node_manifest_check["Manifest check<br/>[SKLOta.cpp]"]
  node_signature_gate["Signature gate<br/>[SKLOta.cpp]"]
  node_install_task["Install task<br/>[SKLOta.cpp]"]
  node_image_download["Image download<br/>[SKLOta.cpp]"]
  node_image_inflater["Zlib inflater<br/>[SKLOtaInflate.h]"]
  node_image_verify["Hash verification<br/>[SKLOta.cpp]"]
  node_ota_writer["OTA slot writer<br/>[SKLOta.cpp]"]
  node_self_test["Self-test<br/>[SKLOta.cpp]"]
  node_result_store[("Result persistence<br/>[SKLOta.cpp]")]
  node_callbacks["Status callbacks<br/>[SKLOta.cpp]"]
end

subgraph group_platform["ESP32 platform"]
  node_bootloader["ESP32 bootloader"]
  node_ota_slots[("A/B app slots")]
end

node_developer(("Developer"))

node_developer -->|"prepares release"| node_release_tool
node_release_tool -->|"publishes files"| node_release_host
node_developer -->|"configures API"| node_firmware_app
node_firmware_app -->|"requests checks"| node_ota_api
node_firmware_app -->|"requests installs"| node_ota_api
node_ota_scheduler -->|"starts checks"| node_manifest_check
node_ota_api -->|"queues requests"| node_ota_scheduler
node_manifest_check -->|"fetches manifest"| node_release_host
node_manifest_check -->|"checks release"| node_signature_gate
node_signature_gate -->|"offers release"| node_install_task
node_install_task -->|"starts download"| node_image_download
node_image_download -->|"fetches image"| node_release_host
node_image_download -->|"inflates stream"| node_image_inflater
node_image_download -->|"writes image"| node_ota_writer
node_ota_writer -->|"hashes image"| node_image_verify
node_image_verify -->|"validates image"| node_ota_slots
node_ota_writer -->|"selects slot"| node_bootloader
node_bootloader -->|"boots new build"| node_firmware_app
node_firmware_app -->|"runs health check"| node_self_test
node_self_test -->|"marks valid or rolls back"| node_bootloader
node_self_test -->|"saves outcome"| node_result_store
node_ota_scheduler -->|"delivers status"| node_callbacks
node_install_task -->|"posts log"| node_callbacks

click node_release_tool "https://github.com/mabbott2011/skl-ota/blob/main/tools/ota_release.py"
click node_ota_api "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.h"
click node_ota_scheduler "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"
click node_manifest_check "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"
click node_signature_gate "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"
click node_install_task "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"
click node_image_download "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"
click node_image_inflater "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOtaInflate.h"
click node_image_verify "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"
click node_ota_writer "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"
click node_self_test "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"
click node_result_store "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"
click node_callbacks "https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_release_tool,node_release_host toneBlue
class node_firmware_app,node_ota_api,node_ota_scheduler,node_manifest_check,node_signature_gate,node_install_task,node_image_download,node_image_inflater,node_image_verify,node_ota_writer,node_self_test,node_result_store,node_callbacks toneAmber
class node_bootloader,node_ota_slots toneMint
class node_developer toneIndigo
```

## Components

### Release preparation

- [Keygen and signing](https://github.com/mabbott2011/skl-ota/blob/main/tools/ota_release.py): `tools/ota_release.py`
- **Web host**

### Device update

- **Running firmware**
- [OTA API](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.h): `src/SKLOta.h`
- [Check scheduler](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`
- [Manifest check](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`
- [Signature gate](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`
- [Install task](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`
- [Image download](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`
- [Zlib inflater](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOtaInflate.h): `src/SKLOtaInflate.h`
- [Hash verification](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`
- [OTA slot writer](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`
- [Self-test](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`
- [Result persistence](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`
- [Status callbacks](https://github.com/mabbott2011/skl-ota/blob/main/src/SKLOta.cpp): `src/SKLOta.cpp`

### ESP32 platform

- **ESP32 bootloader**
- **A/B app slots**

### Other components

- **Developer**

## Connections

- Developer → Keygen and signing: prepares release (evidence: `README.md`)
- Keygen and signing → Web host: publishes files (evidence: `README.md`)
- Developer → Running firmware: configures API
- Running firmware → OTA API: requests checks (evidence: `src/SKLOta.h`)
- Running firmware → OTA API: requests installs (evidence: `src/SKLOta.h`)
- Check scheduler → Manifest check: starts checks (evidence: `src/SKLOta.cpp`)
- OTA API → Check scheduler: queues requests (evidence: `src/SKLOta.cpp`)
- Manifest check → Web host: fetches manifest (evidence: `README.md`)
- Manifest check → Signature gate: checks release (evidence: `src/SKLOta.cpp`)
- Signature gate → Install task: offers release (evidence: `README.md`)
- Install task → Image download: starts download (evidence: `src/SKLOta.cpp`)
- Image download → Web host: fetches image (evidence: `README.md`)
- Image download → Zlib inflater: inflates stream (evidence: `README.md`)
- Image download → OTA slot writer: writes image (evidence: `src/SKLOta.cpp`)
- OTA slot writer → Hash verification: hashes image (evidence: `src/SKLOta.cpp`)
- Hash verification → A/B app slots: validates image (evidence: `src/SKLOta.cpp`)
- OTA slot writer → ESP32 bootloader: selects slot (evidence: `src/SKLOta.cpp`)
- ESP32 bootloader → Running firmware: boots new build (evidence: `README.md`)
- Running firmware → Self-test: runs health check
- Self-test → ESP32 bootloader: marks valid or rolls back (evidence: `README.md`)
- Self-test → Result persistence: saves outcome (evidence: `src/SKLOta.cpp`)
- Check scheduler → Status callbacks: delivers status (evidence: `src/SKLOta.cpp`)
- Install task → Status callbacks: posts log (evidence: `src/SKLOta.cpp`)
