🐛 Fix Lerdge build / encrypt (#24391)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Bob Kuhn
2022-06-23 23:58:26 -05:00
committed by Scott Lahteine
parent a3629a7c28
commit ad96c36730
5 changed files with 70 additions and 70 deletions

View File

@ -26,10 +26,10 @@ if pioutil.is_pio_build():
input_file[i] = encryptByte(input_file[i])
output_file.write(input_file)
# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt
# Encrypt ${PROGNAME}.bin and save it with the name given in build.crypt_lerdge
def encrypt(source, target, env):
fwpath = target[0].path
enname = board.get("build.encrypt")
enname = board.get("build.crypt_lerdge")
print("Encrypting %s to %s" % (fwpath, enname))
fwfile = open(fwpath, "rb")
enfile = open(target[0].dir.path + "/" + enname, "wb")
@ -41,9 +41,9 @@ if pioutil.is_pio_build():
enfile.close()
os.remove(fwpath)
if 'encrypt' in board.get("build").keys():
if board.get("build.encrypt") != "":
if 'crypt_lerdge' in board.get("build").keys():
if board.get("build.crypt_lerdge") != "":
marlin.add_post_action(encrypt)
else:
print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter")
print("LERDGE builds require output file via board_build.crypt_lerdge = 'filename' parameter")
exit(1)

View File

@ -41,8 +41,8 @@ def custom_ld_script(ldname):
elif flag == "-T":
env["LINKFLAGS"][i + 1] = apath
# Encrypt ${PROGNAME}.bin and save it with a new name
# Called by specific encrypt() functions, mostly for MKS boards
# Encrypt ${PROGNAME}.bin and save it with a new name. This applies (mostly) to MKS boards
# This PostAction is set up by offset_and_rename.py for envs with 'build.encrypt_mks'.
def encrypt_mks(source, target, env, new_name):
import sys

View File

@ -39,15 +39,15 @@ if pioutil.is_pio_build():
env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
#
# For build.encrypt rename and encode the firmware file.
# For build.encrypt_mks rename and encode the firmware file.
#
if 'encrypt' in board_keys:
if 'encrypt_mks' in board_keys:
# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt
# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt_mks
def encrypt(source, target, env):
marlin.encrypt_mks(source, target, env, board.get("build.encrypt"))
marlin.encrypt_mks(source, target, env, board.get("build.encrypt_mks"))
if board.get("build.encrypt") != "":
if board.get("build.encrypt_mks") != "":
marlin.add_post_action(encrypt)
#