🔨 Trigorilla Pro disk based update (#24591)

This commit is contained in:
J.C. Nelson
2022-08-05 22:09:46 -07:00
committed by Scott Lahteine
parent 98095ddad6
commit e06340abd1
3 changed files with 36 additions and 6 deletions

View File

@ -4,7 +4,9 @@
#
import pioutil
if pioutil.is_pio_build():
import struct,uuid
import struct,uuid,marlin
board = marlin.env.BoardConfig()
def calculate_crc(contents, seed):
accumulating_xor_value = seed;
@ -104,12 +106,21 @@ if pioutil.is_pio_build():
# Encrypt ${PROGNAME}.bin and save it as 'update.cbd'
def encrypt(source, target, env):
from pathlib import Path
fwpath = Path(target[0].path)
fwsize = fwpath.stat().st_size
fwfile = fwpath.open("rb")
upfile = Path(target[0].dir.path, 'update.cbd').open("wb")
encrypt_file(fwfile, upfile, fwsize)
import marlin
enname = board.get("build.crypt_chitu")
enpath = Path(target[0].dir.path)
fwfile = fwpath.open("rb")
enfile = (enpath / enname).open("wb")
print(f"Encrypting {fwpath} to {enname}")
encrypt_file(fwfile, enfile, fwsize)
fwfile.close()
enfile.close()
fwpath.unlink()
marlin.relocate_firmware("0x08008800")
marlin.add_post_action(encrypt);