mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-07-24 00:02:04 +08:00
setup firmware.json packaging
This commit is contained in:
+24
-20
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user