🔨 Trigorilla Pro disk based update (#24591)
This commit is contained in:
committed by
Scott Lahteine
parent
98095ddad6
commit
e06340abd1
@ -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);
|
||||
|
Reference in New Issue
Block a user