setup firmware.json packaging

This commit is contained in:
Adeeb Shihadeh
2024-08-21 11:31:24 -07:00
parent 472b90c2d4
commit c90c718a23
+24 -20
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
import sys
import json
import os
import hashlib
@@ -68,30 +69,33 @@ def process_file(fn, name, full_check=True, has_ab=True, alt=None):
if __name__ == "__main__":
OTA_OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
files = [
process_file(OUTPUT_DIR / "boot.img", "boot"),
process_file(OUTPUT_DIR / "system.img", "system", full_check=False, alt=OUTPUT_DIR / "system-skip-chunks.img"),
]
if len(sys.argv[1:]):
files = [process_file(Path(fn), Path(fn).stem) for fn in sys.argv[1:]]
else:
files = [
process_file(OUTPUT_DIR / "boot.img", "boot"),
process_file(OUTPUT_DIR / "system.img", "system", full_check=False, alt=OUTPUT_DIR / "system-skip-chunks.img"),
]
# pull in firmware not built in this repo
with open(ROOT/"firmware.json") as f:
fws = json.loads(f.read())
for fw in fws:
files.append({
"name": fw["name"],
"url": fw["url"],
"hash": fw["hash"],
"hash_raw": fw["hash"],
"size": fw["size"],
"sparse": False,
"full_check": True,
"has_ab": True,
})
configs = [
(AGNOS_UPDATE_URL, "ota.json"),
(AGNOS_STAGING_UPDATE_URL, "ota-staging.json"),
]
# pull in firmware not built in this repo
with open(ROOT/"firmware.json") as f:
fws = json.loads(f.read())
for fw in fws:
files.append({
"name": fw["name"],
"url": fw["url"],
"hash": fw["hash"],
"hash_raw": fw["hash"],
"size": fw["size"],
"sparse": False,
"full_check": True,
"has_ab": True,
})
for remote_url, output_fn in configs:
processed_files = []
for f in deepcopy(files):