[FL-2527] Updater: Migrating to new manifest path convention (#1213)

* Updater: Migrating to new manifest path convention
* RPC: Added update preparation status to RPC
* RPC: bumped protobuf submodule
* Bumped protobuf_version.h
* FuriCore: add missing include. Lib: make mlib smaller
* Explicitly tell where we have doubles and fix random in animations
* makefile: added -DLFS_NO_DEBUG
* Updater: path len constant dedup
* Updater: checking for hardware version match before parsing manifest
* LD: moved _DRIVER_CONTEXT sections to .bss, where they belong.
* LD: avoiding PROBGITS warning, moved _CONTEXT to data
* Updater: Added version check on update package - refusing to install outdated

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2022-05-11 12:45:01 +03:00
committed by GitHub
parent dfdc33b076
commit 597ee5b939
32 changed files with 299 additions and 226 deletions

View File

@@ -13,6 +13,7 @@ import math
class Main(App):
UPDATE_MANIFEST_VERSION = 2
UPDATE_MANIFEST_NAME = "update.fuf"
# No compression, plain tar
@@ -93,7 +94,9 @@ class Main(App):
)
file = FlipperFormatFile()
file.setHeader("Flipper firmware upgrade configuration", 1)
file.setHeader(
"Flipper firmware upgrade configuration", self.UPDATE_MANIFEST_VERSION
)
file.writeKey("Info", self.args.version)
file.writeKey("Target", self.args.target[1:]) # dirty 'f' strip
file.writeKey("Loader", stage_basename)
@@ -102,7 +105,7 @@ class Main(App):
file.writeKey("Firmware", dfu_basename)
file.writeKey("Radio", radiobin_basename or "")
file.writeKey("Radio address", self.int2ffhex(radio_addr))
file.writeKey("Radio version", self.int2ffhex(radio_version))
file.writeKey("Radio version", self.int2ffhex(radio_version, 12))
if radiobin_basename:
file.writeKey("Radio CRC", self.int2ffhex(self.crc(self.args.radiobin)))
else:
@@ -149,11 +152,10 @@ class Main(App):
return " ".join(f"{b:02X}" for b in value)
@staticmethod
def int2ffhex(value: int):
n_hex_bytes = 4
def int2ffhex(value: int, n_hex_syms=8):
if value:
n_hex_bytes = math.ceil(math.ceil(math.log2(value)) / 8) * 2
fmtstr = f"%0{n_hex_bytes}X"
n_hex_syms = math.ceil(math.ceil(math.log2(value)) / 8) * 2
fmtstr = f"%0{n_hex_syms}X"
hexstr = fmtstr % value
return " ".join(list(Main.batch(hexstr, 2))[::-1])