2021-04-27 11:49:21 +02:00
|
|
|
#
|
|
|
|
# buildroot/share/PlatformIO/scripts/mks_encrypt.py
|
|
|
|
#
|
|
|
|
# Apply encryption and save as 'build.firmware' for these environments:
|
2021-06-02 08:42:15 +02:00
|
|
|
# - env:mks_robin
|
2021-06-13 22:43:33 +02:00
|
|
|
# - env:mks_robin_e3
|
2021-04-27 11:49:21 +02:00
|
|
|
# - env:flsun_hispeedv1
|
2021-06-02 08:42:15 +02:00
|
|
|
# - env:mks_robin_nano35
|
2021-04-27 11:49:21 +02:00
|
|
|
#
|
2020-07-30 08:43:19 +02:00
|
|
|
Import("env")
|
|
|
|
|
|
|
|
from SCons.Script import DefaultEnvironment
|
|
|
|
board = DefaultEnvironment().BoardConfig()
|
|
|
|
|
2021-06-13 22:43:33 +02:00
|
|
|
if 'encrypt' in board.get("build").keys():
|
2020-07-30 08:43:19 +02:00
|
|
|
|
2021-04-27 11:49:21 +02:00
|
|
|
import marlin
|
|
|
|
|
2021-06-13 22:43:33 +02:00
|
|
|
# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt
|
2021-04-27 11:49:21 +02:00
|
|
|
def encrypt(source, target, env):
|
2021-06-13 22:43:33 +02:00
|
|
|
marlin.encrypt_mks(source, target, env, board.get("build.encrypt"))
|
2021-04-27 11:49:21 +02:00
|
|
|
|
|
|
|
marlin.add_post_action(encrypt);
|
2020-07-30 08:43:19 +02:00
|
|
|
|
|
|
|
else:
|
2021-04-27 11:49:21 +02:00
|
|
|
|
|
|
|
import sys
|
2021-06-13 22:43:33 +02:00
|
|
|
print("You need to define output file via board_build.encrypt = 'filename' parameter", file=sys.stderr)
|
2021-04-27 11:49:21 +02:00
|
|
|
env.Exit(1);
|