FwUpdate phase 1: only in FW_OTA images, manifest layout 2, no downgrade over the mesh

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-13 16:33:29 +01:00
1 parent c93f5d906d
commit 0b38eab008
7 files changed
+1107 -12

No files matched your search

+11 -2
View File
@@ -29,6 +29,7 @@ if __name__ == "__main__": # run by hand (--help): the header above, nothing el
raise SystemExit(0)
Import("env")
import os
import re
import subprocess
from datetime import datetime
@@ -117,11 +118,19 @@ build_date = now.strftime("%y%m%d %H%M")[:DATE_LIMIT]
# the tree is already fully recompiled each time.
build_epoch = int(now.timestamp())
# src/helpers/FwUpdate refuses a package built for another target: the env,
# plus the image variant when one env is released as several
# (FW_OTA_VARIANT=observer-ota -> "SenseCap_Solar_repeater-observer-ota"), or a
# full package would silently swap a node's variant.
ota_variant = os.environ.get("FW_OTA_VARIANT", "").strip()
ota_target = env["PIOENV"] + ("-" + ota_variant if ota_variant else "")
if len(ota_target) > 47: # Manifest.target[48] in FwUpdate.cpp, NUL-terminated
raise SystemExit("build_version.py: OTA target %r longer than 47 chars" % ota_target)
env.Append(CPPDEFINES=[
("FIRMWARE_VERSION", env.StringifyMacro(version)),
("FIRMWARE_BUILD_DATE", env.StringifyMacro(build_date)),
("FIRMWARE_BUILD_EPOCH", str(build_epoch)),
# src/helpers/FwUpdate refuses a package built for another env
("FW_OTA_TARGET", env.StringifyMacro(env["PIOENV"])),
("FW_OTA_TARGET", env.StringifyMacro(ota_target)),
])
print("build_version.py: %s (Build: %s, epoch %d)" % (version, build_date, build_epoch))