1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-13 05:06:30 +04:00

[FL-1699, FL-1700] Scripts: new radio firmware bundling scheme, manifest for resources. (#700)

* Scripts: new radio firmware bundling scheme, manifest for resources.
* Scripts: add destination address for copro binaries.
* Bootloader: update linker scripts
* Scripts: resource manifest FsTree.
This commit is contained in:
あく
2021-09-13 12:52:50 +03:00
committed by GitHub
parent 202c1d4b0e
commit 4456982e27
9 changed files with 424 additions and 15 deletions

27
scripts/flipper/utils.py Normal file
View File

@@ -0,0 +1,27 @@
import datetime
import hashlib
import os
def timestamp():
return int(datetime.datetime.now().timestamp())
def file_hash(path: str, algo: str, block_size: int = 4096):
fd = open(path, "rb")
h = hashlib.new(algo)
while True:
data = fd.read(block_size)
if len(data) > 0:
h.update(data)
else:
break
return h.hexdigest()
def file_md5(path, block_size=4096):
return file_hash(path, "md5", block_size)
def file_sha256(path, block_size=4096):
return file_hash(path, "sha256", block_size)