Modern Apps git

MAOS.git

Public
git clone https://git.maproj.org/MAOS.git
main ▾

MAOS.git / ota / README.md

README.md2.7 KiBRenderedCodeRaw
1# MAOS OTA
2
3How over-the-air updates flow. There are no standalone OTA scripts in this
4directory: building and publishing OTAs is the `release` and `publish` phases
5of `../build-maos.sh`.
6
7## Pipeline
8
9```
10build-maos.sh build ──▶ target-files ──release──▶ signed OTA zip + factory image
11 │
12 publish (per device)
13 ▼
14 Cloudflare R2 bucket `maos`
15 │
16 ota.maproj.org (custom domain)
17 │
18 ▼
19 MA Updater on device
20```
21
22- **`release`** signs the staged target-files with the MAOS key set and
23 generates the factory image + full OTA zip (`script/generate-release.sh`
24 in the AOSP tree).
25- **`publish`** uploads the OTA zip first with an immutable cache header,
26 then the `<device>-<channel>` metadata file with `no-store`, so a device
27 polling mid-publish never sees metadata referencing a zip that isn't
28 there yet. It also prepares/uploads the web-installer factory artifacts
29 via `../installer/prepare-factory.sh`.
30- **`ota.maproj.org`** is the R2 bucket `maos` exposed via a Cloudflare
31 custom domain: an object keyed `<file>` is served at
32 `https://ota.maproj.org/<file>`. Devices download straight from R2 — no
33 GitHub Release and no server proxy are involved.
34- The **MA Updater** app polls `https://ota.maproj.org/<device>-<channel>`
35 (from `ro.maos.ota.server`; see `../updater/README.md`).
36
37## Credentials (never commit)
38
39The `publish` phase reads R2 credentials from the environment:
40
41| Var | Meaning |
42| --- | --- |
43| `R2_ACCOUNT_ID` | Cloudflare account id (builds the R2 endpoint) |
44| `R2_ACCESS_KEY_ID` | R2 API token access key id |
45| `R2_SECRET_ACCESS_KEY` | R2 API token secret |
46
47The bucket is fixed to `maos` in `build-maos.sh`. Create the API token in
48the Cloudflare dashboard (R2 → Manage API Tokens) with **Object Read &
49Write** on that bucket.
50
51## Cloudflare setup (one-time)
52
531. Create the R2 bucket `maos`.
542. Attach the custom domain `ota.maproj.org` to it (R2 → Settings → Custom
55 Domains). Cloudflare provisions TLS automatically.
563. Add a bucket CORS policy so the installer page (`ma.vayunmathur.com`)
57 can fetch factory images (see `../docs/BUILD_RUNBOOK.md`).
584. Add a Cache Rule that bypasses cache for the channel-metadata files
59 (paths not ending in `.zip`) so devices never see a stale build pointer.
60
61See `../docs/BUILD_RUNBOOK.md` for the full build → sign → OTA → publish
62sequence.